Solved Best way to update source locations
#1
SOLVED

The best option seems to be exporting the library with the build-in function (Settings > Media > Library > Export Library) then export to a single or separate files (depending on preference).
Then change the paths with a text editor or a simple script/piped commands.
After that just import the new file(s) with Kodi (Settings > Media > Library > Import Library).

A few notes:
  • It seems that exporting to separate files is slightly faster than exporting to a single file.
  • Separate files will be placed next to your media (Video/Music files).
  • Separate files can export thumbs and artwork, while single file can't.
  • Importing seems to lock the Kodi UI. Which isn't really an issue as such, but I did find it annoying that when it got to importing TV Shows I didn't get live (or correct) progress updates.
    • The UI was only refreshed when Kodi finished importing a TV Show (right before starting on the next) and it seemed to be showing the previous show in the UI, not the one it's currently working on.
      • I "solved" this "issue" by writing a small Python script that would use tail with argument -f to grab added lines from the Kodi Log.
      • I also had the script use a cat first to grab the entire log and then filter out all the lines that indicated the import process.
      • Beforehand I had collected a list of all my TV Show episodes (just counted the files really) to get a total or 100% if you will.
      • Then based on the current number of lines in the Log compared to my total number of files I was able to calculate the progress and estimate a time of completion.
      • (there is probably a better way to get around this. Also note that I was importing from a single file, I don't know if the same issue is present when importing from separate files.)
 


Original Post Below



Greetings,

I have all my video files stored on a NAS and I just moved, which means I'm on a new network and my NAS now has a new IP.
I don't have the option of giving it a statistic IP on this network (though it should retain it's current IP), so instead I have to update my media library in Kodi.

I have done some googling and the most talked about option I have seen is to export the database to xml and update the locations there, delete the video and textures database as well as the thumbnails and then import the updated xml.
However most of the posts suggesting this approach was rather old, so I was wondering if there is any other way to go about this that would be easier?
Reply
#2
(2019-12-01, 17:45)Son_Of_Diablo Wrote: which means I'm on a new network and my NAS now has a new IP.

If the paths themselves have not changed, but only the IP address, why not fixate that old IP address in your router to your NAS, and you are good to go.
Reply
#3
(2019-12-01, 17:52)Klojum Wrote:
(2019-12-01, 17:45)Son_Of_Diablo Wrote: which means I'm on a new network and my NAS now has a new IP.

If the paths themselves have not changed, but only the IP address, why not fixate that old IP address in your router to your NAS, and you are good to go.
I don't have access to the router and what I'm being told is that the router can't do static IPs and my old router had 192.168.0.X addresses where as this one has 192.168.1.X addresses.
I don't have much knowledge about networking and all that jazz, so please excuse me if what I'm saying is stupid and feel free to correct me ^^
Reply
#4
There is no need for excuses, not everyone has every bit of knowledge when it comes to computers. Personally I don't have a clue on how to programme in C++ or in other modern languages.
I was merely trying to hand you a shortcut, but if you have no access to the router, then that solution is off the table.

One other option is to 'hack' the database you are currently using. This requires a bit of SQL knowledge.

The last option is the solution that you already mentioned.
Personally I would do a Video Library Export with separate files (this has always worked for me). It is like creating a backup of all the video metadata.
Exporting with a single XML file will probably work as well, I never tried that method.
Reply
#5
(2019-12-01, 18:08)Klojum Wrote: There is no need for excuses, not everyone has every bit of knowledge when it comes to computers. Personally I don't have a clue on how to programme in C++ or in other modern languages.
I was merely trying to hand you a shortcut, but if you have no access to the router, then that solution is off the table.

One other option is to 'hack' the database you are currently using. This requires a bit of SQL knowledge.

The last option is the solution that you already mentioned.
Personally I would do a Video Library Export with separate files (this has always worked for me). It is like creating a backup of all the video metadata.
Exporting with a single XML file will probably work as well, I never tried that method.
Hmm.. Well poop, I was hoping there was some fancy way to just update it within Kodi or with a 3rd party tool.

I'm gonna go with the export option, it seems a bit safer and easier than trying to mess with the database.. I have looked in them before and they are a bit overwhelming xD

Thanks for the help though really appreciate it!
Reply
#6
@Klojum hey, I hope you don't mind me tagging you.

I tried backing up with a single file and then importing it, but it seems to get stuck the same place each time.. I forgot to turn on debug, so I don't have a log yet, I will try again soon.
But I just spent a little over 12 hours exporting separate files to try it that way, but once Kodi finished exporting I couldn't locate the files anywhere... is there any known issues with this exporting method I should be aware of? or should I try running it again with debug turned on so I can provide a log?

Many thanks in advance! Smile

Update 1: 
Just a quick update on the issue(s).
I'm redoing the single file import with Debug Logging turned on.
After monitoring the log for a little while it seems that the importing is progressing, it's just the GUI that is frozen once it start to import TV Shows for some reason.
At least that is what I can gather from it, I will let it run for now and provide the log once it's done or maybe before if it takes way too long.

Still not able to find the files generated by the separate files export.. I have search the entire system and my NAS (where the video files are) for .xml and .nfo files and nothing relevant showed up.

Update 2:

It seems that the GUI is just updating oddly... Example:
It's importing 3 shows in the following order Magnum P.I., Hawaii Five-0, Adventure Time.
It started by showing Magnum P.I. then when it finished with that show it didn't update the GUI, but according to the logs it did continue to work on Hawaii Five-0... It did however update the GUI to Hawaii Five-0 either when it finished that show or just around the end of the process for the show, now it has started working on Adventure Time (according to the log) but it hasn't updated the GUI yet, there it's still stuck at Hawaii Five-0.
Reply
#7
(2019-12-02, 14:56)Son_Of_Diablo Wrote: But I just spent a little over 12 hours exporting separate files to try it that way,
It all comes down to whatever hardware you are using to do the export.
12 hours... Either you have a gigantic amount of movies and/or tv shows, or you have a pretty slow component in your network/USB connection.
I also have no clue which hardware you are using for Kodi. The slowest of them is usually an older Raspberry Pi device.

(2019-12-02, 14:56)Son_Of_Diablo Wrote: but once Kodi finished exporting I couldn't locate the files anywhere
Exported nfo files are created by default next to their respective videos, as well as their fanart images.
I do regular exports via separate files myself, and I have yet to encounter a real problem with that method.

(2019-12-02, 14:56)Son_Of_Diablo Wrote: It seems that the GUI is just updating oddly... Example:
It's importing 3 shows in the following order Magnum P.I., Hawaii Five-0, Adventure Time.
Kodi doesn't do alphabetic sorting of folders or files. It's usually the physical order on the disk which is used: first come, first served.
Updating of the GUI is sometimes done in between, but usually it all falls into place after the import is ready.
Reply
#8
(2019-12-02, 17:37)Klojum Wrote: It all comes down to whatever hardware you are using to do the export.
12 hours... Either you have a gigantic amount of movies and/or tv shows, or you have a pretty slow component in your network/USB connection.
I also have no clue which hardware you are using for Kodi. The slowest of them is usually an older Raspberry Pi device.
Yea I'm using a RPi4, but the "NAS" is a RPi3b+ which only has USB2, so that is most likely the bottle neck if anything.
I also got a somewhat sizable collection, though I doubt it's more than a drop of water compared to others.
 
(2019-12-02, 17:37)Klojum Wrote: Exported nfo files are created by default next to their respective videos, as well as their fanart images.
I do regular exports via separate files myself, and I have yet to encounter a real problem with that method.
Yea I read that a few places, though no files were created... I'm going to redo that export when I'm done importing, this time with Debug Logging enabled to hopefully figure out that issue.
 
(2019-12-02, 17:37)Klojum Wrote: Kodi doesn't do alphabetic sorting of folders or files. It's usually the physical order on the disk which is used: first come, first served.
Updating of the GUI is sometimes done in between, but usually it all falls into place after the import is ready. 
The order wasn't really the issue.
The issue was/is that the GUI seem to update once a show finishes to be processed, like right now I was watching it and the GUI switched from Hawaii Five-0 to Adventure Time, but this was right after it finished with Adventure Time and started on the next show.
So in short, the GUI is showing the previous show in the status as opposed to the one it's actually working on. Which lead me to believe it was stuck since the first show will be shown on the status while that and the second show is being processed.

Not really an issue if you are patient and can figure out that it's actually working or if you already know that it's a thing I guess Smile
Would be great if the GUI doesn't freeze when it's importing though, so the user knows that Kodi isn't frozen/stalled, but actually working in the background... But eh, could also be hardware limit, though I doubt that since I'm only using ~82% of my memory and ~11% of my combined CPU power (according to Kodi's on screen Debug info).
Reply
#9
(2019-12-02, 17:53)Son_Of_Diablo Wrote: Yea I read that a few places, though no files were created.
Are the files on a NTFS drive? Using a HDD as a NAS on a RPi, it's preferred to use the native Linux EXT4 format instead.

If you use the RPi3 as a NAS, its SDcard is the biggest speed bump. Read speeds tend to be okay on sdcards, write speeds not so much.
Reply
#10
(2019-12-02, 18:26)Klojum Wrote: Are the files on a NTFS drive? Using a HDD as a NAS on a RPi, it's preferred to use the native Linux EXT4 format instead.
They are NTFS yes. 
I didn't know it was preferred to use EXT4, but thanks for that little nugget of information, I will be sure to keep that in mind for when I get time to redo my system ^^
(2019-12-02, 18:26)Klojum Wrote: If you use the RPi3 as a NAS, its SDcard is the biggest speed bump. Read speeds tend to be okay on sdcards, write speeds not so much.
Oh I see, I might have to take a look at the SD card once I can safely shut it down to make sure I got a proper one in there. 
I do get ~11 MB/s up/down from the Pi NAS, granted not the best I have ever seen, but I wouldn't think that would bottle neck the process? (Unless I'm missing something)
Reply
#11
(2019-12-02, 18:49)Son_Of_Diablo Wrote: ~11 MB/s
That's basically your 100Mb speed.
Reply
#12
(2019-12-02, 17:53)Son_Of_Diablo Wrote:
(2019-12-02, 17:37)Klojum Wrote: Exported nfo files are created by default next to their respective videos, as well as their fanart images.
I do regular exports via separate files myself, and I have yet to encounter a real problem with that method.
Yea I read that a few places, though no files were created... I'm going to redo that export when I'm done importing, this time with Debug Logging enabled to hopefully figure out that issue.  
Okay I just tried to do a new export and for some reason it managed to do it correctly this time...
I have no idea why it didn't work the first time I tried it, but oh well, looks like I will be able to do it this way in the future as it was WAY faster exporting to separate files than to a single file.

Just an extra note after the fact, since it took ~30seconds to a minute to export to separate files this try I'm guessing I had some network issues that resulted in every write request to timeout and that's why it took just about 12 hours for Kodi to try and export the last time I tried.. (That is the only explanation I can think of at least)
Reply

Logout Mark Read Team Forum Stats Members Help
Best way to update source locations0