MySQL: How to relocate a group of video files?
#1
The drive containing my video files is near capacity and I'd like to split my collection between two drives. I suppose the easiest way would be to clear my library, move the files, then re-scan/re-scrape my drives to put everything back into MySQL, but I live in the boondocks with a dead-slow internet connection and am a bit leery of trying to rescan a large collection at this time.

How feasible would it be to move the files, then manually (or scripted) update MySQL with the new locations? I wouldn't normally hesitate to update a MySQL database, but Kodi uses so many tables that I don't have a lot of confidence that I could find all the necessary path records.

Any thoughts on how I might proceed?
Reply
#2
Do a Video Library Export, using separate files. This will create .nfo files as well as fanart files (if selected).
Then you can move the part of the movies / tvseries folders you want to the new location.
Do a Clean Video Library action, and a subsequent rescan. The .nfo files will contain the metadata you need for the Kodi library.

There is no easy database tool available just yet when it comes to moving media files around.
Reply
#3
(2020-07-18, 18:59)Klojum Wrote: Do a Video Library Export, using separate files. This will create .nfo files as well as fanart files (if selected).
Then you can move the part of the movies / tvseries folders you want to the new location.
Do a Clean Video Library action, and a subsequent rescan. The .nfo files will contain the metadata you need for the Kodi library.

There is no easy database tool available just yet when it comes to moving media files around.
@Klojum That sounds really promising but I've never done a library export/import/update before so I'm not clear what to expect. The wiki says a separate-files export will store the video's metadata in .nfo files inside each video folder. Do the .nfo files then contain all the media's data from the database, i.e. actors, director, genre, plot, etc.?

Once the library is exported, the metadata will be in the .nfo files and, I assume, still in the MySQL database, and half my video files will be on a new Samba share. Would I then add the new Samba share as a video source, then scan both the old and new video sources with "Videos->Files->[source]->Scan for new content?" Will those scans update my existing MySQL database with the new file paths? And is "Scan for new content" the correct action to re-scan the media sources?

And at what point to I get to tell Kodi to use ONLY local information when scanning so that it won't try to update via the internet?
Reply
#4
(2020-07-18, 23:15)charlesmayo53 Wrote: Do the .nfo files then contain all the media's data from the database, i.e. actors, director, genre, plot, etc.?

Here is an example nfo file: https://paste.kodi.tv/otenemofod.kodi

(2020-07-18, 23:15)charlesmayo53 Wrote: Would I then add the new Samba share as a video source, then scan both the old and new video sources with "Videos->Files->[source]->Scan for new content?" Will those scans update my existing MySQL database with the new file paths? And is "Scan for new content" the correct action to re-scan the media sources?

If you no longer need a video source, then remove it. If you want to add a video source, you can do so via the Kodi GUI, by adding the source to the movies. I have 4 separate video sources for 1 movie source in Kodi.

(2020-07-18, 23:15)charlesmayo53 Wrote: And at what point to I get to tell Kodi to use ONLY local information when scanning so that it won't try to update via the internet?

Kodi will check for nfo files by default. So once you have exported/created the nfo files (don't forget to enabled the watched and resume statuses), then things will go okay. If you set the content to NFO ONLY, then new movies will not be scraped via the internet, and you will have to add the nfo files plus content yourself.
Reply
#5
@Klojum, hey, apologies for not acknowledging your last post to this thread. The board stopped email-notifying me of responses and I haven't been on the forum lately to notice that my message light was on. Sorry about that - I hate taking the time to respond to someone's question and then feeling like they couldn't be bothered to even say thanks. So thank you much, and I don't recall why I had trouble generating/using the .nfo files, but I wound up using the technique described in the Wiki's "HOW-TO:Update Paths In MySQL" guide (link below) to search-and-replace the old source path with the new one across all the tables. I've actually used it another time since then and it has worked really well for me:

https://kodi.wiki/view/HOW-TO:Update_Paths_In_MySQL
Reply
#6
Well, it's only been what, 1.5 years? Tongue

Hacking in databases is the quickest way for handling certain tasks, but it's not for everyone. Kodi certainly could use added built-in functionality regarding changing source locations. Sadly though, I only have part of the knowledge to fix that. I'm not a C++/Python programmer who can implement it directly. But there is still hope it will happen some day.
Reply

Logout Mark Read Team Forum Stats Members Help
MySQL: How to relocate a group of video files?0