Auto Rescan Library at Regular Interval?
#16
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)')
Reply
#17
Awesome. That is a lot more complicated than I expected, and I had zero chance of making that on my own.

Thank you
Reply
#18
joshua.lyon Wrote:For other people looking for details on how to have your library automatically update on a regular interval, I've posted a step-by-step how-to on my blog. Check it out and post back here (or in the comments) if you have questions.

Joshua I have used the info on your blog to do this before, but for whatever reason I don't think that the script is exiting properly after or something as after a day or two my machine slows down. As soon as I remove the cron items for the update it is fine. I had it set to 30 min updates and once a day cleaning.
I am trying try this python scripts to see if it is better.
Reply
#19
tstack77 Wrote:MDPauley, your scripts worked great! I even modified one to clean the library twice a day as well (simple I know, but I am a complete noob with scripting).

I made it by creating a CleanVideoLibrary.py and adding the job to autoexec.py

CleanVideoLibrary.py
Code:
import xbmc, xbmcgui
xbmc.executebuiltin('XBMC.CleanLibrary(video)')
xbmc.executebuiltin('XBMC.AlarmClock( CleanVideoLibrary, XBMC.RunScript(special://home/scripts/CleanVideoLibrary.py),720,true)')

autoexec.py
Code:
import xbmc, xbmcgui

xbmc.executebuiltin('XBMC.AlarmClock( VideoLibraryUpdater, XBMC.RunScript(special://home/scripts/VideoLibraryUpdater.py),45,true)')
xbmc.executebuiltin('XBMC.AlarmClock( CleanVideoLibrary, XBMC.RunScript(special://home/scripts/CleanVideoLibrary.py),720,true)')

I do have one quick question though that 20 minutes on google couldn't help me with. How do I set an exact time of day to run the script instead of every 12 hours? I tried changing the minutes to xx:yy format (18:15), but that wasn't the answer.

Thanks for all the help Smile

Clean just makes XBMC (Windows, v9.11 and r28256) freeze for me. There's no issue when i run it from the menu, but everytime i run it from a script, it freezes.
Reply
#20
MDPauley Wrote:autoexec.py
Code:
import xbmc, xbmcgui

xbmc.executebuiltin('XBMC.AlarmClock( VideoLibraryUpdater, XBMC.RunScript(special://home/scripts/VideoLibraryUpdater.py),45,true)')

VideoLibraryUpdater.py
Code:
import xbmc, xbmcgui
xbmc.executebuiltin('XBMC.UpdateLibrary(video)')
xbmc.executebuiltin('XBMC.AlarmClock( VideoLibraryUpdater, XBMC.RunScript(special://home/scripts/VideoLibraryUpdater.py),45,true)')

Put both scripts in your special://home/scripts directory. These 2 scripts will create a timed event that will update the library every 45 minutes...

How to make it work for latest svn with addon system?

Thanks
Reply
#21
Just updated to RC1, this doesn't seem to function any longer. I also set this as a favorite before to be run when needed on demand, but I can't access appdata anymore from the file manager.

Is there a workaround for this very needed function that I'm missing?
Reply
#22
Hate to dig up such an old thread but was wondering if the using the builtin library update function still works in Dharma release?
Reply
#23
Maybe I'm missing something here but there's a plugin that you can add within XBMC that will auto update your library on specified intervals...
Reply
#24
torchedlh Wrote:Maybe I'm missing something here but there's a plugin that you can add within XBMC that will auto update your library on specified intervals...

There is but I cant get it to work right. My library never updated automatically so I was hoping I could use the builtin functions and write my own script.
Reply
#25
tboooe Wrote:There is but I cant get it to work right. My library never updated automatically so I was hoping I could use the builtin functions and write my own script.

the library updater works no problem for me, but what doesn't work is the clean library function, i simply don't think it works in Dharma except by manually selecting it from the video settings, i've put it in advancedsettings.xml and nothing, tried via HTTP also nothing.
--
[Image: watched-clearlogo.jpg]
Reply
#26
prophetizer Wrote:the library updater works no problem for me, but what doesn't work is the clean library function, i simply don't think it works in Dharma except by manually selecting it from the video settings, i've put it in advancedsettings.xml and nothing, tried via HTTP also nothing.

Are you saying the addon works or the builtin functions via custom script?
Reply
#27
both for updating, and someone just pointed out an issue with my advancedsettings.xml file that should fix my clean up issue.
--
[Image: watched-clearlogo.jpg]
Reply
#28
OK great. I will try the custom script. Would you mind letting me know how you are doing the automatic cleanup script in advanced settings?
Reply
#29
Code:
<advancedsettings>
  <videolibrary>
    <cleanonupdate>true</cleanonupdate>
  </videolibrary>
</advancedsettings>
--
[Image: watched-clearlogo.jpg]
Reply
#30
I'm using this plugin, and works perfectly for me,

http://www.mediafire.com/?pyqmqxqqfbq3paq

just unpack to C:\Users\%username%\AppData\Roaming\XBMC\addons

or try install addon from zip
Reply
 
Thread Rating:
  • 1 Vote(s) - 5 Average



Logout Mark Read Team Forum Stats Members Help
Auto Rescan Library at Regular Interval?51