[aTV] Automatically update library via cron/launchd
#1
Getting frustrated by having to use the context menu all the time to scan for new content, I did a search and came across this handy command using cron and the xbmc http api to update the library every 5 minutes.

*/5 * * * * curl "http://192.168..66:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)" > /dev/null


now, I've set this up to run on one of my linux machines, but I was wondering if there was a way to get this working on the appletv. I searched and found you can copy cron from a 10.4 osx install to the appletv, but alas, I don't have any machines running 10.4.

I've found that you can do certain things with launchd, but I'm unable to find specific answers for what I want to do.

How can you use launchd to run the command above on the appletv so that it regularly updates the library via the http api?
Reply
#2
ewequeone Wrote:Getting frustrated by having to use the context menu all the time to scan for new content, I did a search and came across this handy command using cron and the xbmc http api to update the library every 5 minutes.

*/5 * * * * curl "http://192.168..66:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)" > /dev/null


now, I've set this up to run on one of my linux machines, but I was wondering if there was a way to get this working on the appletv. I searched and found you can copy cron from a 10.4 osx install to the appletv, but alas, I don't have any machines running 10.4.

I've found that you can do certain things with launchd, but I'm unable to find specific answers for what I want to do.

How can you use launchd to run the command above on the appletv so that it regularly updates the library via the http api?

http://developer.apple.com/macosx/launchd.html
Reply
#3
Thanks for that. Realised though that I'd still need to put curl on the system, so if I'm going to that much trouble, I may as well just put cron and crontab on it too and do what I'm currently doing Smile
Reply
#4
ewequeone Wrote:Thanks for that. Realised though that I'd still need to put curl on the system, so if I'm going to that much trouble, I may as well just put cron and crontab on it too and do what I'm currently doing Smile

wget should be present (atvusb-creator installs it), it's much nicer than curl in some aspects.
Reply
#5
Ok, finally got cron and crontab from a 10.4 machine and got it all working so it automatically updates the library every X minutes.

only thing is, I'm still having to manually update the library myself, unless I set the cron job to update it every minute, which seems overkill.

Is there some program / script under osx that I can run on the appletv which will monitor a directory (and all subdirectories both local or via the network) and when it notices a change (new subdirectory or file having been created) it then runs a command via the http api to update the library?
Reply
#6
Well, I've found a couple of options for what I want as per the above, but no way of using the options for what I want to do due to lack of knowledge in writing daemons and not having a 10.4 install to compile on.

fslogger is the first option, and can be found at http://osxbook.com/software/fslogger/ (I'll also add that fslogger works straight out of the box, just mount the dmg and it runs on the appletv)

the second is simplefilemon which is at http://benno.id.au/blog/2008/05/15/simplefilemon

and the third is logfmon http://logfmon.sourceforge.net/

without wanting to sound like I'm asking to be spoonfed, can someone suggest or assist in developing any of the three options above into a daemon which monitors any given directories and once a change is made in that directory and subdirectories, be it creation or deletion of files/directories, a command be given the http api to update the library?

I really wish I had of learnt to program instead of spending countless hours downloading pr0n and drinking beer.

Cheers,

jason.
Reply

Logout Mark Read Team Forum Stats Members Help
[aTV] Automatically update library via cron/launchd0