XBMC Library Updater

Come up with a useful post-processing script? Share it here!
Post Reply
kLAcK
Newbie
Newbie
Posts: 7
Joined: April 27th, 2008, 11:26 pm

XBMC Library Updater

Post 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.
evidenceunseen
Jr. Member
Jr. Member
Posts: 56
Joined: February 11th, 2008, 2:33 pm

Re: XBMC Library Updater

Post 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.
kLAcK
Newbie
Newbie
Posts: 7
Joined: April 27th, 2008, 11:26 pm

Re: XBMC Library Updater

Post 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)
evidenceunseen
Jr. Member
Jr. Member
Posts: 56
Joined: February 11th, 2008, 2:33 pm

Re: XBMC Library Updater

Post 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?
kLAcK
Newbie
Newbie
Posts: 7
Joined: April 27th, 2008, 11:26 pm

Re: XBMC Library Updater

Post 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.
evidenceunseen
Jr. Member
Jr. Member
Posts: 56
Joined: February 11th, 2008, 2:33 pm

Re: XBMC Library Updater

Post 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)
ju1ced
Newbie
Newbie
Posts: 3
Joined: June 21st, 2008, 1:04 pm

Re: XBMC Library Updater

Post 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
deepblue
Newbie
Newbie
Posts: 21
Joined: August 24th, 2008, 3:28 pm

Re: XBMC Library Updater

Post 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!
stanpete
Jr. Member
Jr. Member
Posts: 95
Joined: February 2nd, 2008, 11:35 am

Re: XBMC Library Updater

Post 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
JayBird
Jr. Member
Jr. Member
Posts: 82
Joined: August 18th, 2008, 3:21 am

Re: XBMC Library Updater

Post 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
stanpete
Jr. Member
Jr. Member
Posts: 95
Joined: February 2nd, 2008, 11:35 am

Re: XBMC Library Updater

Post 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
Last edited by stanpete on September 26th, 2008, 4:44 am, edited 1 time in total.
JayBird
Jr. Member
Jr. Member
Posts: 82
Joined: August 18th, 2008, 3:21 am

Re: XBMC Library Updater

Post by JayBird »

Thanks mate, i appreciate that  ;)
User avatar
interfacelift
Jr. Member
Jr. Member
Posts: 75
Joined: June 19th, 2008, 12:58 am
Location: Coruscant

Re: XBMC Library Updater

Post 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!
User avatar
thaylok
Newbie
Newbie
Posts: 29
Joined: November 20th, 2008, 11:39 am

Re: XBMC Library Updater

Post by thaylok »

Great tip!  ;D
bigdaddyo811
Newbie
Newbie
Posts: 20
Joined: October 22nd, 2008, 10:15 am

Re: XBMC Library Updater

Post 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
Post Reply