Page 1 of 8

XBMC Library Updater

Posted: May 6th, 2008, 8:27 pm
by kLAcK
Here is a simple script I wrote to automatically update your XBMC library when a download is complete.

Create these two files in the following directories:

C:\Program Files\sabnzbd\updatelibrary.scr

Code: Select all

open 192.168.0.110
username
password
literal site updatelibrary(video)
quit 
Replace with your XBMC IP address and username and password

C:\Program Files\sabnzbd\scripts\updatelibrary.cmd

Code: Select all

ftp -s:updatelibrary.scr
Prerequisites:
  • Assign a static IP to XBMC, and enable FTP
  • Setup Categories in SAB, enter a unique download folder for TV and one for Movies
  • i.e. D:\Video\TV and D:\Video\Movies
  • In XBMC assign a media type to the TV folder and Movies folder
Now every time you download a TV show or Movie, it will automatically be added to your XBMC library.  If you don't keep your Xbox on all the time, turn on the "Update library at startup" feature.

Re: XBMC Library Updater

Posted: May 7th, 2008, 7:49 am
by evidenceunseen
Could this be adapted for use on XBMC Linux? Have the option to run on the linux pc that sabnzbd is on as well.

Re: XBMC Library Updater

Posted: May 7th, 2008, 11:25 am
by kLAcK
Yes I'm sure it can.  I don't know the linux commands however.  All this script does is log into the XBMC ftp server and send one command.

Code: Select all

literal site updatelibrary(video)

Re: XBMC Library Updater

Posted: May 7th, 2008, 1:44 pm
by evidenceunseen
I didn't know you could send commands via ftpp to XBMC, doesn't the web server allow you to update the library?

Re: XBMC Library Updater

Posted: May 7th, 2008, 2:04 pm
by kLAcK
I don't think the webserver does.  That was my first aproach on building this script.  There are a whole bunch of commands that the ftp server supports though, check them out on the wiki.

Re: XBMC Library Updater

Posted: June 21st, 2008, 11:59 am
by evidenceunseen
Apparently the web server does support library updates through XBMC.builtinfunction. Here is the command that would update the video library:

Code: Select all

http://xbmcaddress/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)
Does anyone know how I can execute this in a shell or python script? (without opening a browser)

Re: XBMC Library Updater

Posted: June 21st, 2008, 1:08 pm
by ju1ced
evidenceunseen wrote: Apparently the web server does support library updates through XBMC.builtinfunction. Here is the command that would update the video library:

Code: Select all

http://xbmcaddress/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)
Does anyone know how I can execute this in a shell or python script? (without opening a browser)

Code: Select all

wget http://xbmcaddress/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video) >/dev/null 2>&1

Re: XBMC Library Updater

Posted: August 25th, 2008, 10:05 am
by deepblue
Here's the full python script if anyone is looking for it, just put this in a .py file and call it from the .cmd file:

Code: Select all

import urllib

urllib.urlopen("xbmcaddress/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)").close()
Thanks to the posters here for putting this out here, works a treat!

Re: XBMC Library Updater

Posted: September 15th, 2008, 7:25 pm
by stanpete
Cool, thanks.
Here's one that works with OSX just in case:

Code: Select all

curl --get "http://xbmcaddress/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)"
st

Re: XBMC Library Updater

Posted: September 23rd, 2008, 3:44 pm
by JayBird
stanpete wrote: Cool, thanks.
Here's one that works with OSX just in case:

Code: Select all

curl --get "http://xbmcaddress/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)"
st
That works great when i run it from the terminal, but how would i go about creating a script from this that i can get SABnzbd to run when the downloads complete.

Thanks

Re: XBMC Library Updater

Posted: September 25th, 2008, 8:08 pm
by stanpete
That is easy - all you need is a simple text editor.
I'd reccomend that you get NovoEdit or some other free editor since Apple's TextEdit doesn't work that well with
shell scripts and you don't seem to have much experience with unix tools.

OK, so
1) Get and run NovoEdit
2) Copy this to a new file

Code: Select all

#!/bin/sh
curl --get "http://xbmcaddress/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)"
Where xbmcaddress is of course your ip:port

3) Save file with ".sh" extension
4) Copy it to your scripts folder
5) Go to Terminal, enter "chmod 755 /sciptfolder/script.sh"
    Whith the real location and name of your script.

Hope this helps.
st

Re: XBMC Library Updater

Posted: September 26th, 2008, 2:40 pm
by JayBird
Thanks mate, i appreciate that  ;)

Re: XBMC Library Updater

Posted: October 29th, 2008, 5:44 pm
by interfacelift
stanpete wrote: Here's one that works with OSX just in case:

Code: Select all

curl --get "http://xbmcaddress/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)"
Works great with Plex (a Mac OS X fork of XBMC). Thanks!

Re: XBMC Library Updater

Posted: November 22nd, 2008, 6:21 pm
by thaylok
Great tip!  ;D

Re: XBMC Library Updater

Posted: December 4th, 2008, 1:47 pm
by bigdaddyo811
I get the following error:

External processing by /users/MCM/Library/Scripts/plexscript.sh:
nice: /users/MCM/Library/Scripts/plexscript.sh: Permission denied

1. What permission is being denied and to what?
2. How do I fix it?

Thanks