[LINUX] Force library update and clear from console / cron?
#1
Hi, my XBMC is running 24/7 since my mediastation is also a router and a torrent box. So i never "start" xbmc but i also need to clean the library (removing erased files) and update new ones from time to time.

So my question is, is there any way to do this, say, every 2-3 hours? Is it possibile to issue this command via command line? Or using a python script?

Thanks.
Reply
#2
Would really be great
Reply
#3
Yes, a quick search would have brought up a few options.

Add a cron job with something like:

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

more info at have a look at http://wiki.xbmc.org/?title=WebServerHTTP-API
Reply
#4
prae5 Wrote:Yes, a quick search would have brought up a few options.

Add a cron job with something like:

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

more info at have a look at http://wiki.xbmc.org/?title=WebServerHTTP-API

Good workaround but a native solution would be much better, moreover this requires no authentication at all on the xbmc interface or embedding user and password inside curl command which is no so beautiful.

A python module with callable methods or a cli interface would be much much better.
Reply
#5
Anyway i think this will be enaugh to clear and update everything (i hope this also clears erased files)
Thanks a lot!
Reply
#6
johnuopini Wrote:Good workaround but a native solution would be much better, moreover this requires no authentication at all on the xbmc interface or embedding user and password inside curl command which is no so beautiful.

A python module with callable methods or a cli interface would be much much better.


Patches welcome - this could be wrapped in a python module if you really wanted to.
Reply
#7
prae5 Wrote:Patches welcome - this could be wrapped in a python module if you really wanted to.

If i find some spare time to code ill create the module.
Thanks.
Reply
#8
I do it this way:

Code:
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
Reply
#9
Wow, thats a much better/cleaner solution, thanks!
Reply
#10
johnuopini Wrote:Wow, thats a much better/cleaner solution, thanks!

It does exactly the same thing?
Reply
#11
nah, it connects to the event server through a public, non-protected connection - it's worse security wise. but hey! atleast it doesn't show any passwords eh.
Reply
#12
spiff Wrote:nah, it connects to the event server through a public, non-protected connection - it's worse security wise. but hey! atleast it doesn't show any passwords eh.

If you are issuing commands locally (and that is what i want to do) its secure (if nobody have root access to your box).

And its more beautiful than using curl.
Reply
#13
was thinking... does XBMC have to be running when you run /usr/bin/xbmc-send -a "UpdateLibrary(video)" and /usr/bin/xbmc-send -a "CleanLibrary(video)"? 'cus obvously it has to run to exec the curl command
Reply
#14
prae5 Wrote:It does exactly the same thing?

AFAIK yes, because the same built in function is called (UpdateLibrary(database,[path])).

spiff Wrote:nah, it connects to the event server through a public, non-protected connection - it's worse security wise. but hey! atleast it doesn't show any passwords eh.

That's true, but I don't think it's a problem as long as the cron job runs on the same machine as XBMC. Furthermore there's a setting in XBMC to only allow events from localhost.
Reply

Logout Mark Read Team Forum Stats Members Help
[LINUX] Force library update and clear from console / cron?1