Editing media library from addon?
#1
Hi,
After a long time using XBMC, I decided it was time for me to start developping a few addons, so I'm pretty much a newb with XBMC's API.
One of my firsts attempts will be to add a DataBase editor inside XBMC, in order to easily detect and edit my badly tagged movies (when file name is not the name retrieved from the scrapper for example), and browse the movies that weren't found at all in the scrappers. The idea is to regroup what is already feasible inside XBMC inside a single screen, with less clicks required Tongue. It shouldn't be really hard, but hard enough for a first addon (something close to http://forum.xbmc.org/showthread.php?tid=57031) .

So, I've been searching the API for how to edit the DB from within XBMC, unsuccessfully. I've read that the DB is accessible from the JSON api, but I could only see getters, no setters.
Am I missing something? Is DB editing even available from python addons ?

Thanks !
Voop Smile
Reply
#2
I think you will have to use the HTTP API for this.
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#3
Well, I've been reading the HTTP API too, but didn't find references to anything to update the movies/music/series info ; the only setters I saw there are for settings.

I would understand if there were limitations in API for security reasons, but I haven't seen notes on that either yet;

The closest I've seen is using SQLite, but I would rather avoid that... Maybe there are some addons that already do that kind of stuff, and from which I could grab some code ?

Thanks Wink
Voop
Reply
#4
Look at 'Trakt Utilities' or 'Rating Update'.
They update the xbmc database
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#5
Kewl,
Thanks a lot Smile ! I'll look at it and I'll let you know what I found !

Voop Smile
Reply
#6
Haa nice,
I just peeked through the code, and found exactly what I wanted Smile :
Code:
def xbmcHttpapiExec(query):
    xml_data = xbmc.executehttpapi( "ExecVideoDatabase(%s)" % urllib.quote_plus(query), )
    return xml_data
xbmcHttpapiExec(
                    "UPDATE files"+
                    " SET playcount=%(playcount)s" % {'playcount':xcp(playcount)}+
                    " WHERE idFile=%(idFile)s" % {'idFile':xcp(idFile)})

So it seems I'll just have to wrap SQL a bit, and it should be nice and easy to use... Hope the JSon equivalent won't be too different Tongue

Thanks Martijn ! Hope I can post something useful soon Wink !
Reply
#7
I've been looking everywhere for something like this. XWMM comes pretty close, but it's really bugged down by issues related to browser compatibility and does not support Eden right now. Just as I decided to attempt writing my own I came across your post. I can help develop it together Smile
Reply
#8
Hey
I'd love it Smile
However, I didn't spend much time on development these days, but I found a few usefull stuff, especially this page :

http://wiki.xbmc.org/index.php?title=Lin...ped_Movies

which is a very good start ! Big Grin
It's not in python, but could easily be translated (Although the grep stuff may be a bit hard to keep efficient in python - lots of string comparisons). I'll try to find some time this week-end for this Smile

If you want, I'll post my code on some google-code-like tool as soon as I produce something Smile It could be very interesting to work together on this.
Reply
#9
Interesting script. Another point of entry can also be the built-in functionality currently in XBMC to edit the title of the movies. It also allows rescraping the movie from imdb it seems. (to clarify, rescraping is possible by loading the movie information screen for a movie and pressing refresh). Of course it only allows manual editing of only the title and we need to add manual editing of all fields.
btw, it would be awesome if you can upload any code you have to a github account.
Reply
#10
I seems the lack of plugins for this purpose is actually due to the design decision on XBMC devs' part to not include functionality for modifying the database. They also are saying that any functionality that currently exists (e.g. ExecVideoDatabase) is to be deprecated which seems to be further evident in their C++ code for handling json-rpc calls in Eden.

This is a terrible decision and realistically has absolutely no value in terms of security for the database.
Reply
#11
I have an idea for a way to do this...
Reply

Logout Mark Read Team Forum Stats Members Help
Editing media library from addon?0