Auto Rescan Library at Regular Interval?
#1
hi everyone, im looking to see how i can setup xbmc to rescan my library to cleanup/add new titles as my collection shrinks and expands on a daily/weekly basis ... i found these commands but have no idea where to begin to use them in a XBMC Live environment ... has anyone work on this before? i did a google but only found references to it on the plex forum ...

http://wiki.xbmc.org/?title=List_of_Built_In_Functions
Reply
#2
I'd like to see the same feature. Where XBMC will monitor it's library folders and compensate for changes in the files every so often, both adds and deletes.
Use mythicalLibrarian to make a library out of your MythTV files. Leave the recording to MythTV and use XBMC as your library.
Installation and Instructions:http://wiki.xbmc.org/index.php?title=MythicalLibrarian
Technical Support:http://forum.xbmc.org/showthread.php?tid=65644
[url=http://forum.xda-developers.com/showthread.php?tid=1081892][/url]
Reply
#3
for now, I created a keymap.XML and assign the rescan function to one of my mce remote buttons ... it's not exactly what i'm hoping to achieve but this is a work around I think I can live with
Reply
#4
rwparris2 created a python script to do just that.
Hunt around in this forum to find it.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#5
1/ enable EventServer

2/ Install the xbmc-eventclients-xbmc-send package

3/ Schedule the Library Update with 'crontab -e'

Code:
xbmc@XBMCLive:~$ crontab -l
# m h  dom mon dow   command
0 * * * * /usr/bin/xbmc-send -a "UpdateLibrary(video)" >> /dev/null 2>&1
15 9 * * * /usr/bin/xbmc-send -a "CleanLibrary(video)" >> /dev/null 2>&1
xbmc@XBMCLive:~$ aptitude search xbmc-send
i   xbmc-eventclients-xbmc-send     - XBMC Media Center (Event Client XBMC-SEND
Update every hours, Cleaning everyday at 9:15
Reply
#6
or you could turn on the event server, install xbmc-eventclients-xbmc-send from the ppa and add the following line to your crontab with "crontab -e":

0 * * * * xbmc-send --action="XBMC.updatelibrary(video)"

your library will then update on the hour every hour

i use this along with cleanonupdate in advancedsettings.xml and it works a treat
Reply
#7
I added a feature to mythicalLibrarian to update the library, clean out the old junk that was deleted and send a UI notification
Use mythicalLibrarian to make a library out of your MythTV files. Leave the recording to MythTV and use XBMC as your library.
Installation and Instructions:http://wiki.xbmc.org/index.php?title=MythicalLibrarian
Technical Support:http://forum.xbmc.org/showthread.php?tid=65644
[url=http://forum.xda-developers.com/showthread.php?tid=1081892][/url]
Reply
#8
altern8 Wrote:for now, I created a keymap.XML and assign the rescan function to one of my mce remote buttons ... it's not exactly what i'm hoping to achieve but this is a work around I think I can live with

Can you post this? I'd prefer an on-demand, one click option than a timed option.
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#9
this is what my keymap.xml looks like... so whenever i press the #1 button, it executes a update library command ... im going to see how i can use the suggested timed option since i would like to have but options at my disposal ... thanks everyone ...

Code:
<keymap>
<global>
   <remote>
     <one>XBMC.UpdateLibrary(video)</one>
   </remote>
</global>
</keymap>
Reply
#10
bossanova808 Wrote:Can you post this? I'd prefer an on-demand, one click option than a timed option.

What is wrong with pressing update library on your remote?
Reply
#11
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.
Reply
#12
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...
Reply
#13
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...

thanks for the code, sorry for the noobie question but where exactly is "special://home/scripts" located? i couldnt find it logging in as root or xbmc
Reply
#14
Windows: %appdata%\xbmc\scripts\
Linux: ~/.xbmc/scripts/
OSX: not sure...
Reply
#15
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
Reply

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