Gathering listing of movie library contents
#1
Hi all,

I have a couple of questions about the best method of getting information of what's in a user's library.

Right now, I can get a list of all movies in a library with the title and year through the JSON interface. This works as an addon, but the downside I see is that the user has to enable their web interface so I can query it.

1) Is there a way to get a list of media contents without having to enable the web interface?

Also, I'm looking to resend data when the library's contents have changed.

2) Is there a way to see when a library update has been triggered?

I suppose the easiest way would be to regularly query the count of items in the library and then resend if there was a change, but there is the case that the user removed 3 old movies, added 3 new ones, and the update wouldn't trigger then.

Thanks for any help!
Image
Reply
#2
1) you don't have to enable the web interface to do json queries from a python-addon.
2) we announce new videos added. we not currently announce removed videos, although this should be added.
Reply
#3
Thanks spiff.

I'm having trouble finding a good example of how to write the calls properly. I'm currently using urllib2 and sending the JSON request to http://localhost:8080/jsonrpc. Should I be sending the query differently? The way I'm doing it now requires the web server to be enabled.

For the announcements, also, I have no idea how to capture these announcements. Can someone point me in the right direction with either a quick snippet of code or a plugin's source that I can look at as an example?

Thanks!
Image
Reply
#4
use xbmc.executeJSONRPC. if you have problems formatting the json i suggest you use a json formatting library such as simplejson (avail as a script module). and from the looks of it, it seems like the announcements haven't been added to python yet :/
Reply
#5
Perfect! That was exactly what I needed and it's working great.

I've decided for the announcements then to query the video library and watch the total number of movies for changes. Not perfect but I think an acceptable workaround.

For reference in the future, if anyone wants to see the code implemented it's available on github: https://github.com/nmunson/script.sharet...default.py
Image
Reply

Logout Mark Read Team Forum Stats Members Help
Gathering listing of movie library contents0