Export the database using command line
#1
Is there a way to Export the database (movies and series) to one file using the command line? Maybe without artwork and any other pictures? I could only find the solution using the kodi GUI.
Reply
#2
(2023-03-01, 09:35)Friedrich0404 Wrote: using the command line?

Hehe... How comfortable are you doing SQL statements?

Depending on the database type you use with Kodi (only SQLite or MySQL), there should be external open-source tools out there to list and get what you're looking for. But... be advised that all images in the Thumbnail cache are stored and linked via a separate SQLite database (also when using MySQL), and combining those in an export listing is not that simple. You'd need a dedicated export tool for that, and I have not come across any such external tools directly for Kodi.

People using alternate database solutions such as Ember, Plex may have better access to such export listings. Kodi itself does not really have those options. A dedicated add-on w(/c)ould be a solution.
Reply
#3
(2023-03-01, 09:35)Friedrich0404 Wrote: Is there a way to Export the database (movies and series) to one file using the command line? Maybe without artwork and any other pictures? I could only find the solution using the kodi GUI.

I have a Kodi addon which will allow table level exports out of the Kodi database (as long as it is local and not something like MySQL etc..).  I'd suggest trying he Episode View and Movie View.  I could update it to allow a command line option but we'd need to discuss exactly how you'd want that to work. 


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#4
I found this https://gist.github.com/jangeador/ba6f44...c6742b5753 (this is for separate files but perhaps its customizable):

Code:
curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Export", "params": { "options": { "overwrite": false, "actorthumbs": false, "images": true } }, "id": 1 }' -H 'content-type: application/json;' http://localhost:8080/jsonrpc

I've activated control over HTTP and the command line is running without error. But there is no file in the folder i'm running the terminal or on any folder in ~/.kodi.
Reply
#5
(2023-03-01, 14:17)Friedrich0404 Wrote: I found this https://gist.github.com/jangeador/ba6f44...c6742b5753 (this is for separate files but perhaps its customizable):
 
Code:
curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Export", "params": { "options": { "overwrite": false, "actorthumbs": false, "images": true } }, "id": 1 }' -H 'content-type: application/json;' http://localhost:8080/jsonrpc

I've activated control over HTTP and the command line is running without error. But there is no file in the folder i'm running the terminal or on any folder in ~/.kodi.


A little more information would be helpful here.  What format are you looking for with regards to the database export ?  If you want a full database backup in an SQLite DB format then you can use my Kodi Selective Cleaner addon, which has an option for this.  But quite honestly that can be done by simply copying the MyVideosXX.db file. 

It would really be helpful to understand exactly what your goal is here ?  If you are looking for a raw database file copy I've provided a couple of options.  You'd then need the specific tools to work with the database in this format.  DB Browser for SQlite is my recommendation.

if you are looking for Excel / CSV extracts of specific database tables  either addon I provided will do this but you aren't going to get different database tables into the same Excel / CSV extract because the tables are different in format and fields. 


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#6
(2023-03-01, 09:35)Friedrich0404 Wrote: Is there a way to Export the database (movies and series) to one file using the command line?

Perhaps we are overthinking things here regarding exports. Are you merely looking for a command line solution that mimics the Video Library Export option from the Kodi GUI menus?
Reply
#7
(2023-03-01, 15:08)Klojum Wrote: Perhaps we are overthinking things here regarding exports. Are you merely looking for a command line solution that mimics the Video Library Export option from the Kodi GUI menus?

Fair point.  Out of curiosity what format does the Video Library Export leverage in the output ?


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#8
(2023-03-01, 15:08)Klojum Wrote:
(2023-03-01, 09:35)Friedrich0404 Wrote: Is there a way to Export the database (movies and series) to one file using the command line?

Perhaps we are overthinking things here regarding exports. Are you merely looking for a command line solution that mimics the Video Library Export option from the Kodi GUI menus?

Thats what i need. The "videodb.xml" is enough. I will create a short content list with that file as source.
Reply
#9
(2023-03-01, 15:46)jbinkley60 Wrote: Out of curiosity what format does the Video Library Export leverage in the output ?

It exports metadata into .nfo files using xml tags.
Reply
#10
Re: the github gist that you found

thats kodi json rpc and you can find the information about it on the wiki - https://kodi.wiki/view/JSON-RPC_API/v12
Reply
#11
nfo and xml isn't the same Format?

So is there a command that does exactly the same like library Export into one file using kodi-gui?
Reply
#12
(2023-03-01, 16:35)jepsizofye Wrote: Re: the github gist that you found

thats kodi json rpc and you can find the information about it on the wiki - https://kodi.wiki/view/JSON-RPC_API/v12

This doesn't really help. The command i try runs without error but makes nothing. There is not xml file. The same with the commands in the wiki. All of them are running but doesn't create a file.
Reply
#13
i apologize if trying to expand your knowledge of what you're running did not help

it was meant as informative not a solution ( as i attempted to suggest when i said what it was regarding with re: )
Reply
#14
(2023-03-01, 16:32)Klojum Wrote: It exports metadata into .nfo files using xml tags.
Thanks.  That is what I thought and I don't see how that aligns to the original ask "Is there a way to Export the database (movies and series) to one file using the command line?"  Anyway, since I am missing the ultimate goal here I don't think I am adding any value and will politely bow out of the discussion but keep a curious eye on it to see what the final result is.


Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply

Logout Mark Read Team Forum Stats Members Help
Export the database using command line0