Posts: 28
Joined: Oct 2008
Reputation:
10
I am creating an addon where i interface directly against the database through python sqlite library, and in that context i need to know what is the difference between MyVideos34.db and MyVideos44.db?
And another thing, is there any way i can get the path to the current video database? something a little less hardcoded than this?
xbmc.translatePath('special://database/MyVideos44.db')
Any help is appreciated!
Thanks!
Posts: 26,215
Joined: Oct 2003
Reputation:
187
44.db is version 44 - all sqlite databases update the file on disk now as the version updates. So you'll need to basically list the files and choose the latest, though that won't necessarily guarantee you're on the correct database - reason is that a user may have run a nightly build and then gone back to a stable (previous db version).
I suggest that querying the db directly will only lead to maintenance problems down the road (eg recently added script broke the other day because of a db bump).
If you can get away with using the JSON-RPC lib then that's the better way to go. Feel free to request extensions to it as you need.
Cheers,
Jonathan
Posts: 28
Joined: Oct 2008
Reputation:
10
Great! just the info i needed, thank you!.
For now i think my best option is to interface directly against the database. But in principle i absolutely agree, however the jsonrpc don't have the methods i need in order to do what i want. Basically what i need is the name,imdb id and playcount of every video file in the library. And the ability to set playcount myself.
Posts: 28
Joined: Oct 2008
Reputation:
10
Btw, can you tell me anything about what the default version of the latest stable is? is it MyVideos44.db?
Posts: 2,710
Joined: Feb 2009
Reputation:
12
ppic
Skilled Python Coder
Posts: 2,710
use the http api to get your data, it will be better.
Posts: 2,710
Joined: Feb 2009
Reputation:
12
ppic
Skilled Python Coder
Posts: 2,710
you can see exemple of db request through http api in recentlyadded, or tvtunes, or logo-downloder, or tvshow.next.aired
Posts: 28
Joined: Oct 2008
Reputation:
10
Sweet, this looks promising. But one snag, what about updating values in the database? can I set values through the json api aswell? I need to be able to set the playcount value.
Thanks for the help!
Posts: 5,184
Joined: Jan 2009
Reputation:
131
No there's no method in jsonrpc yet which allows the changing of values in the database.
Always read the
online manual (wiki),
FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the
forum rules (wiki).
Please read the pages on
troubleshooting (wiki) and
bug reporting (wiki) before reporting issues.