XBMC Library Updater

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

Re: XBMC Library Updater

Postby JohnSCS » October 6th, 2011, 6:11 pm

The HTTP API will be fully depreciated in Eden. Should still be working in Dharma. I can't remember my exact version, but it's Live 10.1 and not a nightly build.
Is this a fresh install and have you had the script working in the past?
JohnSCS
Newbie
Newbie
 
Posts: 41
Joined: August 17th, 2009, 1:23 am

Re: XBMC Library Updater

Postby Ashex » October 25th, 2011, 5:58 pm

I haven't used it in the past, I was using xbmc-send before to do updates. This isn't exactly a fresh install but I haven't really tweaked it much since installing it.

I did sort out the jsonrpc script, here it is:

Code: Select all
#!/usr/bin/python
import jsonrpclib
server = jsonrpclib.Server('http://localhost:8080/jsonrpc')
server.VideoLibrary.ScanForContent()



That's pretty much it, you can add in a bit to send a notification when it runs with another jsonrpc call or do pretty much anything.

you need to install the library of course.
Ashex
Newbie
Newbie
 
Posts: 17
Joined: February 28th, 2009, 1:20 am

Re: XBMC Library Updater

Postby jadel » November 4th, 2011, 2:31 am

Hi guys,

Trying to get the libary update working on my setup. ATV1 (crystalbuntu [ubuntu 8.04]) and pre eden XBMC. I think the last post from Ashex is for pre eden builds but I just have no idea what to do with it.

I read through the whole thread and cant really figure it out. I think most of the scripts are for win 7 yeah?

Anyway any help would be appreciated.

Thanks
jadel
Newbie
Newbie
 
Posts: 2
Joined: November 4th, 2011, 2:02 am

Re: XBMC Library Updater

Postby Ashex » November 4th, 2011, 2:23 pm

If you want to use my python script, stick it in a file and name it xbmcupdate.py, don't forget to install the python library (look at the link in my previous post).

Grant it execute permissions (chmod +x xbmcupdate.py) then drop it in the scripts folder. Once you have done that you'll need to go in to sabnzbd+ and set that script for post-processing.
Ashex
Newbie
Newbie
 
Posts: 17
Joined: February 28th, 2009, 1:20 am

Re: XBMC Library Updater

Postby RedsGT » November 14th, 2011, 12:41 am

jadel wrote:Hi guys,

Trying to get the libary update working on my setup. ATV1 (crystalbuntu [ubuntu 8.04]) and pre eden XBMC. I think the last post from Ashex is for pre eden builds but I just have no idea what to do with it.

I read through the whole thread and cant really figure it out. I think most of the scripts are for win 7 yeah?

Anyway any help would be appreciated.

Thanks


I don't know if this is your only problem, but if you're using an up to date pre Eden nightly, Ashex code needs to be changed to:

Code: Select all
#!/usr/bin/python
import jsonrpclib
server = jsonrpclib.Server('http://localhost:8080/jsonrpc')
server.VideoLibrary.Scan()


With this small piece of code you also need to make sure you have this : http://pypi.python.org/pypi/jsonrpclib on top of Python and of course make sure you don't have a password set, because this doesn't handle usernames/passwords.
RedsGT
Newbie
Newbie
 
Posts: 4
Joined: November 14th, 2011, 12:28 am

Re: XBMC Library Updater

Postby CapnBry » December 29th, 2011, 10:34 am

You can do this without using python classes with just wget:
Code: Select all
wget -q -O/dev/null --header='Content-Type: application/json' --post-data='{"jsonrpc": "2.0", "method": "VideoLibrary.Scan"}' http://localhost:8000/jsonrpc

If you want to see the response, use -O- and add "id": "anything" to the end of the JSON POST data. Tested on Eden 11.0 Beta 1. Also note that my XBMC HTTP server is on port 8000, modify if necessary.
CapnBry
Newbie
Newbie
 
Posts: 1
Joined: December 29th, 2011, 10:30 am

Re: XBMC Library Updater

Postby premiso » January 7th, 2012, 7:28 pm

CapnBry: Thanks for that, works a treat!
premiso
Release Testers
Release Testers
 
Posts: 15
Joined: June 28th, 2010, 12:43 pm

Re: XBMC Library Updater

Postby Hitcher » January 20th, 2012, 7:11 am

CapnBry wrote:You can do this without using python classes with just wget:
Code: Select all
wget -q -O/dev/null --header='Content-Type: application/json' --post-data='{"jsonrpc": "2.0", "method": "VideoLibrary.Scan"}' http://localhost:8000/jsonrpc

If you want to see the response, use -O- and add "id": "anything" to the end of the JSON POST data. Tested on Eden 11.0 Beta 1. Also note that my XBMC HTTP server is on port 8000, modify if necessary.

I've tested this using ssh and it works great but I can't get it to work in SABnzbd.

I've saved it to the scripts folder as xbmcupdate.py and made sure it's executable but SABnzbd throws up this error -

Code: Select all
Cannot run script /storage/.xbmc/userdata/addon_data/service.downloadmanager.SABnzbd-Suite/scripts/xbmcupdate.py


Any help appreciated.
Hitcher
Newbie
Newbie
 
Posts: 12
Joined: May 24th, 2010, 12:06 pm

Re: XBMC Library Updater

Postby RedsGT » January 20th, 2012, 10:06 am

It's not python, that's why it won't work. Someone will tell me if I'm wrong, but you probably should save it as a bash script.
RedsGT
Newbie
Newbie
 
Posts: 4
Joined: November 14th, 2011, 12:28 am

Re: XBMC Library Updater

Postby Hitcher » January 20th, 2012, 11:18 am

Got there in the end using this -

Code: Select all
#!/usr/bin/python

import urllib
urllib.urlopen("http://localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video))").close()


saved as xbmcupdate.py and made executable.
Hitcher
Newbie
Newbie
 
Posts: 12
Joined: May 24th, 2010, 12:06 pm

Re: XBMC Library Updater

Postby Hitcher » January 23rd, 2012, 3:11 pm

And now it's not working. :(

Anyone got a script that works for Eden?

Thanks.
Hitcher
Newbie
Newbie
 
Posts: 12
Joined: May 24th, 2010, 12:06 pm

Re: XBMC Library Updater

Postby RedsGT » January 23rd, 2012, 3:21 pm

Did beta 2 break it? Does the wget method still work for you?
RedsGT
Newbie
Newbie
 
Posts: 4
Joined: November 14th, 2011, 12:28 am

Re: XBMC Library Updater

Postby Hitcher » January 23rd, 2012, 3:42 pm

I don't know how I should be saving the wget method?
Hitcher
Newbie
Newbie
 
Posts: 12
Joined: May 24th, 2010, 12:06 pm

Re: XBMC Library Updater

Postby RedsGT » January 23rd, 2012, 3:50 pm

I'm really rusty on my Linux skills but I think as a .sh file? With a "#!/bin/sh" header.
RedsGT
Newbie
Newbie
 
Posts: 4
Joined: November 14th, 2011, 12:28 am

Re: XBMC Library Updater

Postby Hitcher » January 23rd, 2012, 4:54 pm

RedsGT wrote:I'm really rusty on my Linux skills but I think as a .sh file? With a "#!/bin/sh" header.


It was the header that I didn't have and now it's working.

Many thanks.
Hitcher
Newbie
Newbie
 
Posts: 12
Joined: May 24th, 2010, 12:06 pm

PreviousNext

Return to Post-Processing Scripts