| Set XBMC to Auto Update Library |
| Written by Josh Lyon | |||||||||||||||||||
| Monday, 04 January 2010 21:16 | |||||||||||||||||||
|
After getting XBMC Live installed on my Revo and getting my library setup, I couldn't find a simple option to have XBMC watch my video folder and automatically update my library. In place of this missing functionality, I figured I would setup a simple timed job to automatically update my library for me every hour. Before I get started, I should note that there is an option to automatically update the library when the box is booted up which may work for some people. You can find this under System > Video > Update Library on Startup. This option wouldn't work for me though as I leave my box on 24/7 or at most just put it in a standby state. See below for the details on how to setup a timed job (cron) to update your video or music library. This consists of installing the xbmc-send application and setting up a cron job (and enabling the EventServer). Access the shell of your XBMC installation (either via SSH/putty or directly from the keyboard/Ctrl+Alt+F2) then run the following commands: Update the Aptitude local repository: sudo apt-get update Enter the password for the super user if prompted (the default is 'xbmc'). Install the xbmc-send client: sudo aptitude install xbmc-eventclients-xbmc-send Enter the password for the super user if prompted (the default is 'xbmc'). Press Y to continue when prompted. (Optional) Test out a command: xbmc-send -a "Notification(Testing,XBMC Command Success.)" You should see a quick notification box popup on your XBMC installation as soon as you press enter on the above command. (Optional) Test if Cron is installed: Oddly enough, cron was not installed by default on my XBMC-Live 9.11 (repack) installation so I had to manually install it first. To test if you have cron installed, try running the following command: crontab -l If you get an error that says something like "crontab: command not found" then you need to first install cron using the optional step below. If you get a listing of your cron entries or a message that says "no crontab for [username]" then you can skip the optional next step of installing cron. (Optional) Install Cron: sudo aptitude install cron If prompted, enter the root user password and hit Y if prompted to continue. Setup the Timed Job (Cron): Edit the crontab entry for the root user, using the nano editor: sudo env EDITOR=vi crontab -e You should now see a blank, command prompt version of something similar to Wordpad. If your crontab was empty, all you will see is "# m h dom mon dow command". Press down to start a new line and copy the following in: 0 * * * * /usr/bin/xbmc-send -a "UpdateLibrary(video)" >> /dev/null 2>&1 Press Ctrl+O to save. Press [enter] to confirm saving to the default filename. Press Ctrl+X to exit the nano editor. Congratulations, your cronjob should now be setup to run every hour! Other Thoughts: Here are some other ways to setup your cron job to run. Use these in place of the default line that you pasted into the editor in the last step above: At midnight every day: * 0 * * * /usr/bin/xbmc-send -a "UpdateLibrary(video)" >> /dev/null 2>&1 Every 3 hours: * */3 * * * /usr/bin/xbmc-send -a "UpdateLibrary(video)" >> /dev/null 2>&1 At 4:30pm (16:30): 30 16 * * * /usr/bin/xbmc-send -a "UpdateLibrary(video)" >> /dev/null 2>&1 If the test command doesn't work, you may need to enable the Event Server (XBMC Wiki Article). In 9.11 Camelot, this is under System > Network > Services > Allow programs on this system to control XBMC (and by default should be on). You can also use the list of functions from the XBMC wiki to schedule other cronjobs or create your own shell scripts for more fun automation on the XBMC platform.
Bookmark
Email This
Hits: 1771 Comments (5)
![]()
Brian
said:
|
|
... on my copy of 9.11 repack, i had to run "sudo apt-get update" first or else the cron install would fail to kick off |
|
Tom
said:
|
.. Thanks for this tip! I had to run that sudo apt-get update as well. Also I had to use "sudo env EDITOR=nano crontab -e" to edit the file through putty or I was in VI where the Down arrow and Ctrl-O don't work the same way. |
|
JFEllie
said:
|
Re The clients trust this resume service cause they are the most responsible! This service performs resume service to suit the precise range of science you wish. |
|
Alessandro
said:
|
... Hey - does XBMC need to be running for this to work? I have it running as part of a script at 4am - however - XBMC is not running! I tested it - and when I next ran XBMC (ubuntu) the video library was not updated? I know the xbmc send command works (although it was while XBMC was running) - I tried the test output and the update video command, but do I need to force run xbmc before I run the update then kill xbmc - then shutdown? |
|
| < Prev | Next > |
|---|

