XBMC Library Updater

Come up with a useful post-processing script? Share it here!

XBMC Library Updater

Postby kLAcK » May 6th, 2008, 9:27 pm

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.
kLAcK
Newbie
Newbie
 
Posts: 7
Joined: April 28th, 2008, 12:26 am

Re: XBMC Library Updater

Postby evidenceunseen » May 7th, 2008, 8:49 am

Could this be adapted for use on XBMC Linux? Have the option to run on the linux pc that sabnzbd is on as well.
evidenceunseen
Jr. Member
Jr. Member
 
Posts: 56
Joined: February 11th, 2008, 3:33 pm

Re: XBMC Library Updater

Postby kLAcK » May 7th, 2008, 12:25 pm

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)
kLAcK
Newbie
Newbie
 
Posts: 7
Joined: April 28th, 2008, 12:26 am

Re: XBMC Library Updater

Postby evidenceunseen » May 7th, 2008, 2:44 pm

I didn't know you could send commands via ftpp to XBMC, doesn't the web server allow you to update the library?
evidenceunseen
Jr. Member
Jr. Member
 
Posts: 56
Joined: February 11th, 2008, 3:33 pm

Re: XBMC Library Updater

Postby kLAcK » May 7th, 2008, 3:04 pm

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.
kLAcK
Newbie
Newbie
 
Posts: 7
Joined: April 28th, 2008, 12:26 am

Re: XBMC Library Updater

Postby evidenceunseen » June 21st, 2008, 12:59 pm

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¶meter=XBMC.updatelibrary(video)

Does anyone know how I can execute this in a shell or python script? (without opening a browser)
evidenceunseen
Jr. Member
Jr. Member
 
Posts: 56
Joined: February 11th, 2008, 3:33 pm

Re: XBMC Library Updater

Postby ju1ced » June 21st, 2008, 2:08 pm

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¶meter=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¶meter=XBMC.updatelibrary(video) >/dev/null 2>&1
ju1ced
Newbie
Newbie
 
Posts: 3
Joined: June 21st, 2008, 2:04 pm

Re: XBMC Library Updater

Postby deepblue » August 25th, 2008, 11:05 am

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¶meter=XBMC.updatelibrary(video)").close()


Thanks to the posters here for putting this out here, works a treat!
deepblue
Newbie
Newbie
 
Posts: 9
Joined: August 24th, 2008, 4:28 pm

Re: XBMC Library Updater

Postby stanpete » September 15th, 2008, 8:25 pm

Cool, thanks.
Here's one that works with OSX just in case:

Code: Select all
curl --get "http://xbmcaddress/xbmcCmds/xbmcHttp?command=ExecBuiltIn¶meter=XBMC.updatelibrary(video)"


st
stanpete
Jr. Member
Jr. Member
 
Posts: 95
Joined: February 2nd, 2008, 12:35 pm

Re: XBMC Library Updater

Postby JayBird » September 23rd, 2008, 4:44 pm

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¶meter=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
JayBird
Jr. Member
Jr. Member
 
Posts: 82
Joined: August 18th, 2008, 4:21 am

Re: XBMC Library Updater

Postby stanpete » September 25th, 2008, 9:08 pm

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¶meter=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
Last edited by stanpete on September 26th, 2008, 5:44 am, edited 1 time in total.
stanpete
Jr. Member
Jr. Member
 
Posts: 95
Joined: February 2nd, 2008, 12:35 pm

Re: XBMC Library Updater

Postby JayBird » September 26th, 2008, 3:40 pm

Thanks mate, i appreciate that  ;)
JayBird
Jr. Member
Jr. Member
 
Posts: 82
Joined: August 18th, 2008, 4:21 am

Re: XBMC Library Updater

Postby interfacelift » October 29th, 2008, 6:44 pm

stanpete wrote:Here's one that works with OSX just in case:
Code: Select all
curl --get "http://xbmcaddress/xbmcCmds/xbmcHttp?command=ExecBuiltIn¶meter=XBMC.updatelibrary(video)"


Works great with Plex (a Mac OS X fork of XBMC). Thanks!
User avatar
interfacelift
Jr. Member
Jr. Member
 
Posts: 75
Joined: June 19th, 2008, 1:58 am
Location: Coruscant

Re: XBMC Library Updater

Postby thaylok » November 22nd, 2008, 7:21 pm

Great tip!  ;D
User avatar
thaylok
Newbie
Newbie
 
Posts: 29
Joined: November 20th, 2008, 12:39 pm

Re: XBMC Library Updater

Postby bigdaddyo811 » December 4th, 2008, 2:47 pm

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
bigdaddyo811
Newbie
Newbie
 
Posts: 20
Joined: October 22nd, 2008, 11:15 am

Next

Return to Post-Processing Scripts