2010-01-12, 20:13
Change the 06 (6 AM) and 18 (6 PM) to the times you want to clean you library. I would do this in both autoexec.py and CleanVideoLibrary.py.
Code:
import time
import datetime
from datetime import date
import xbmc, xbmcgui
dt = datetime.datetime.now()
timeNow = time.time()
timeAM = time.mktime( (dt.year, dt.month, dt.day, 06, 00, 00, dt.weekday(), 0, -1) )
timePM = time.mktime( (dt.year, dt.month, dt.day, 18, 00, 00, dt.weekday(), 0, -1) )
if (timeNow < timeAM ):
print "Set AM time"
minutesToUpdate = round(abs(timeAM - timeNow))
if (timeNow > timeAM ):
print "Set PM time"
minutesToUpdate = round(abs(timePM - timeNow))
xbmc.executebuiltin('XBMC.AlarmClock( CleanVideoLibrary, XBMC.RunScript(special://home/scripts/CleanVideoLibrary.py), ' + str(minutesToUpdate) + ',true)')