XBMC Library Updater

Come up with a useful post-processing script? Share it here!
JohnSCS
Newbie
Newbie
Posts: 42
Joined: August 17th, 2009, 12:23 am

Re: XBMC Library Updater

Post by JohnSCS »

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?
Ashex
Newbie
Newbie
Posts: 18
Joined: February 28th, 2009, 12:20 am

Re: XBMC Library Updater

Post by Ashex »

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.
jadel
Newbie
Newbie
Posts: 2
Joined: November 4th, 2011, 1:02 am

Re: XBMC Library Updater

Post by jadel »

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
Ashex
Newbie
Newbie
Posts: 18
Joined: February 28th, 2009, 12:20 am

Re: XBMC Library Updater

Post by Ashex »

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.
RedsGT
Newbie
Newbie
Posts: 4
Joined: November 13th, 2011, 11:28 pm

Re: XBMC Library Updater

Post by RedsGT »

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.
CapnBry
Newbie
Newbie
Posts: 1
Joined: December 29th, 2011, 9:30 am

Re: XBMC Library Updater

Post by CapnBry »

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.
premiso
Release Testers
Release Testers
Posts: 16
Joined: June 28th, 2010, 11:43 am

Re: XBMC Library Updater

Post by premiso »

CapnBry: Thanks for that, works a treat!
Hitcher
Newbie
Newbie
Posts: 12
Joined: May 24th, 2010, 11:06 am

Re: XBMC Library Updater

Post by Hitcher »

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.
RedsGT
Newbie
Newbie
Posts: 4
Joined: November 13th, 2011, 11:28 pm

Re: XBMC Library Updater

Post by RedsGT »

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.
Hitcher
Newbie
Newbie
Posts: 12
Joined: May 24th, 2010, 11:06 am

Re: XBMC Library Updater

Post by Hitcher »

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, 11:06 am

Re: XBMC Library Updater

Post by Hitcher »

And now it's not working. :(

Anyone got a script that works for Eden?

Thanks.
RedsGT
Newbie
Newbie
Posts: 4
Joined: November 13th, 2011, 11:28 pm

Re: XBMC Library Updater

Post by RedsGT »

Did beta 2 break it? Does the wget method still work for you?
Hitcher
Newbie
Newbie
Posts: 12
Joined: May 24th, 2010, 11:06 am

Re: XBMC Library Updater

Post by Hitcher »

I don't know how I should be saving the wget method?
RedsGT
Newbie
Newbie
Posts: 4
Joined: November 13th, 2011, 11:28 pm

Re: XBMC Library Updater

Post by RedsGT »

I'm really rusty on my Linux skills but I think as a .sh file? With a "#!/bin/sh" header.
Hitcher
Newbie
Newbie
Posts: 12
Joined: May 24th, 2010, 11:06 am

Re: XBMC Library Updater

Post by Hitcher »

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