Jump to content

Relocate Media Library Metadata


TheArchivist

Recommended Posts

TheArchivist

I recently had a scenario where I had my Media and the Emby Server (portable) on the same drive.

 

I relocated the Emby Server (portable) to a new drive.  It correctly targeted the new location for ProgramData (../ProgramData) without configuration.  However, the existing libraries (Movies, TV Shows) still had their metadata configured for the old location. 

 

The only solution to fix this was to remove the libraries and recreate them.  This takes a considerable amount of time and bandwidth.

 

Please add the ability to relocate a library's metadata location, or detect that the ProgramData location has changed.

 

I imagine this feature would be good for both the Portable and Standard server implementations.

 

 

P.S. - Emby is a great product and I am a proud monthly supporter!

Edited by TheArchivist
Link to comment
Share on other sites

TheArchivist

I did try to manually edit the Library (right click in Web UI -> Edit Metadata) but the location was read only.  I did a search in the library DB using a SQL Lite Browser and noticed all the paths too.

 

Is there a recommended set of steps for the Emby library setup?

 

Also great news on the macro feature for future releases!

 


Have you explored the settings under Emby library setup?

 

Thanks!

Link to comment
Share on other sites

 

 

Is there a recommended set of steps for the Emby library setup?

Well for most, it's just specify your folder paths and that's about it.

 

The setting i'm referring to is in library setup -> the advanced tab

Link to comment
Share on other sites

TheArchivist

Well for most, it's just specify your folder paths and that's about it.

 

The setting i'm referring to is in library setup -> the advanced tab

 

Ahh, ok - yes, I did update that path after I moved things (and did a restart) but for the library's metadata it was still look in the old location (likely due to the hard paths in the SqlLite DB).  I also checked the metadata manager to see if it allowed for updating the path (aside from right-click from the home page where the libraries are listed) -- same thing (property was read only).

 

I'm going to fiddle around with the Beta and see how swapping goes -- will be a great feature to have when that branch hits the mainline.

Link to comment
Share on other sites

  • 3 months later...
SenatorIvy

Hello!

 

Is there any update to this? The metadata path is read-only in the metadata manager.  If I could just change the old path to the new path I put my files in I wouldn't have to rescan the entirety of my libraries and re-find/select posters/etc etc etc.

Can we edit these paths for our libraries with an external tool or something? Where are they stored?

Link to comment
Share on other sites

SenatorIvy

There's a library for Metadata? I never noticed. What folder do I add so that it will know the rest? Just emby\programdata?

Link to comment
Share on other sites

Happy2Play

Hello!

 

Is there any update to this? The metadata path is read-only in the metadata manager.  If I could just change the old path to the new path I put my files in I wouldn't have to rescan the entirety of my libraries and re-find/select posters/etc etc etc.

Can we edit these paths for our libraries with an external tool or something? Where are they stored?

 

 

I am a little confused as those paths are the folders you have listed when you setup the Library.

 

But if I understand this correctly you would have to manually update the paths in library.db with a database tool. 

 

Link to comment
Share on other sites

SenatorIvy

I mean, I never set up the metadata library. That's apparently something Emby does on its own?  I can change the library paths for media, but I don't store metadata with my media.

 

For the actual programdata\metadata folders I don't understand why Emby would hardcode an absolute path?  I'm running the standalone/portable version.  it should reference it's running directory\programdata, so that wherever it's moved to it can just pick up and go without having to re-scan every library and rebuild metadata.

Link to comment
Share on other sites

Happy2Play

I mean, I never set up the metadata library. That's apparently something Emby does on its own?  I can change the library paths for media, but I don't store metadata with my media.

 

For the actual programdata\metadata folders I don't understand why Emby would hardcode an absolute path?  I'm running the standalone/portable version.  it should reference it's running directory\programdata, so that wherever it's moved to it can just pick up and go without having to re-scan every library and rebuild metadata.

 

Assuming you have a installation after this update, yes you can move the installation as you please.

 

https://github.com/MediaBrowser/Emby/issues/3217

 

If you have a older installation then you could look at the "%MetadataPath%" solutions provided in this topic. there is a "%AppDataPath%" token added for playlists and collections that are not discussed in that topic also.

Link to comment
Share on other sites

SenatorIvy

Luke: I'll check that out shortly and let you know what I find. I never noticed a Metadata library in my server management previously, and the existing one doesn't have a path in it for some reason.

Link to comment
Share on other sites

SenatorIvy

I added the programdata path to that empty metadata library, and manually changed the paths to my library's content folders in library management.  This has queued a rescan of the entire library, which is not what I was looking for it to do, as I've got a ton of Kung Fu movies that have all been properly named/arted that the original scrape doesn't find. :(

 

I backed up the library.db and programdata directory before I started as well, as I don't want to lose all the work I've done on metadata just because some drive letters changed.  It would be nice to have an option for relative paths in libraries, so that I could just put my mount points folder in the emby folder, that way when I move things around it always knows to look in \\?\Emby\programdata for metadata stuff, and then \\?\Emby\junctions for library stuff.  I do a full wipe & reinstall of my system every time a service pack comes out for Windows, so having to worry about metadata loss every 6 months is poo

 

EDIT: Update: it definitely did not use the existing metadata in the folder I pointed it to, as all of the titles that I had edited for things such as "special edition", "director's cut", "special assembly cut", etc are all gone.

Edited by SenatorIvy
Link to comment
Share on other sites

SenatorIvy

I wiped & reinstalled the entirety of my pc, and in the process changed 12 hdds from:

E, F, G, H, I, J, K, L, M, N, O, P

 

to mount points in the folder C:\!Mounts, where I have the following:

 

Emby   <-The drive where I kept Emby on the previous system, which contains all of my metadata that I worked on.  EDIT: this used to be mounted in D:\!OPS\Emby

Slot01 <- Used to be the E drive

Slot02 <- Used to be the F drive

Slot03 <- Used to be the G drive

...

Slot12 <- Used to be the P drive

--

So for example there is a Library in Emby that I have called 4K.  In this library is a file we'll call 4kMovie1.mkv.  Emby's metadata library is seemingly chiefly concerned with where this file is on-disk, instead of what library it's in.  This is fine if I could just tell Emby that "everything you knew that was in "D:\!OPS\Emby\MediaJunctions\[insert library path here]"  is now in "C:\!Mounts\Emby\MediaJunctions\[insert library path here]""  but I can't, as the metadata path is read-only in the metadata manager, so when I go into library management and change my 4k library (which has 1 folder in it) from:

 

D:\!OPS\Emby\MediaJunctions\4K

 

to

 

C:\!Mounts\Emby\MediaJunctions\4K

 

Emby thinks this is a new path with new content that it needs to start from scratch on and scan & scrape for, instead of just looking into its own db and saying "oh I know what 4KMovie1.mkv is; I've got all the info for that in my collection already, so I'll just use that."

 

I'm on the portable/standalone installation because I wanted it to be as system agnostic as possible so when I wipe my PC I don't have to worry about losing my Emby setup, and I don't save metadata into media folders because I tried doing that when I first got into Emby and when I created new Libraries based on the folders that contained metadata, it still called out to the internet to scrape anyway so I figured if it was gonna ignore its own work I might as well keep my folders easier to manage and let Emby keep metadata in whatever hidden dir it wanted to keep it in normally.

 

I even tried doing UPDATE TypedBaseItems SET Path = REPLACE(Path,'D:\!OPS\','C:\!Mounts\') WHERE Path LIKE 'D:\!OPS\%'; on Library.db, in the hopes that Emby wouldn't know that anything had been changed and would just load up and go like normal, but no luck.  Before I edited the library locations to change the paths from original to new ones it at least had all the shows/movies/etc with the images I like & titles I set.  Now it's in the middle of scanning and recreating all of that metadata and putting me back to square 1. :(

Edited by SenatorIvy
Link to comment
Share on other sites

Right ok. If you move a library then currently a new full scan is unavoidable but it's something we can look at a accommodating in the future. Thanks.

  • Like 1
Link to comment
Share on other sites

SenatorIvy

After the scan finished for the new paths for the libraries (could I have just edited those in the PathInfos of the individual options.xml's of each library in the root\default folder without queuing Emby into a rescan?)  I took the original library.db and edited it in Navicat with the following:

 

UPDATE TypedBaseItems SET Path = REPLACE(Path,'D:\!OPS\','C:\!Mounts\') WHERE Path LIKE 'D:\!OPS\%';

 

This swapped out every path in TypedBaseItems with the proper one.  I also found there to be some old path entries in mediastreams, so I changed those to the proper one too.

 

Now everything loads with the proper titles and plays (so it knows what they're called and can find the files linked as well, 99% of the way there!) however the images for metadata are still broken and I'm seemingly unable to find where the path to these are stored?  For example I get this when I click on a title and then goto view image on its broken poster image:

 

Could not find a part of the path 'D:\!OPS\Emby\programdata\metadata\library\c4\c4c42e32ad2c691c09fd71dfdb6381dd\poster.jpg'.

 

Now if I search for that file (c4c42e32ad2c691c09fd71dfdb6381dd\poster.jpg) it exists, however it's in the new, updated path.  Where are the image paths stored so that I can edit those too?

 

For some reason even though I recreated the libraries and am on the latest emby, when the system rescanned everything it still referenced hard-coded paths to the files in the db instead of using %metadatapath% and %programdatapath%.  Is this expected?  If not just wanted to mention it in case there's a weird bug on creation goin around.

 

Thanks for the help so far, I'm almost to the point I need to be to be back up and running fully, it seems. :)

 

 

EDIT: I was looking for another "Path" column in a separate DB, but apparently it's Images in the TypedBaseItems.  When I replaced the D:\!OPS there with C:\!Mounts, all of my stuff came back without rescanning.  I'm not certain how this whole fiasco started, as all of my libraries are linked to Junctions, not paths, so how Emby knew to resolve the junctions to paths instead of just pointing to Emby\MediaJunctions\[librarytitlehere] seems odd?  I specifically put mount points in a folder for Emby so that if I had to change where a drive was/folder was/etc I could always keep the library the same & not have to rescan, simply by pointing the junction from its original location to the updated location.  Considering the path may change by the folder contents dont, this seemed like the easiest way.  Is Emby somehow resolving these junctions into their full original paths?

 

I do now see some %metadatapath% entries in the db, but there are still lots of hardcoded paths in there.

Edited by SenatorIvy
Link to comment
Share on other sites

If you care about customizing metadata, we highly recommend saving that metadata with the media.  None of this would have been a problem if that were the case.

  • Like 1
Link to comment
Share on other sites

SenatorIvy

I tried saving metadata with the media before and it didn't make the libraries/content any more portable.  Even though there was existing metadata in a media folder, when the installation I had going at the time thought the location was new, it rescanned it and overwrote the existing metadata.

 

I'm not against the occasional hassle, and figuring out the ins-n-outs of something by trial and error when it comes up isn't beyond the scope of acceptable or anything.  Just trying to put together the best way to migrate an existing install regardless of setup method, and also trying to orchestrate folders so Emby doesn't ever have to worry about direct paths.  I had all of my library in what Emby would see as the same folder, just had to change the start of its path from the old directory to the new.  if there was an %EmbyRoot% variable we could set in the settings that would solve the entire issue as well.

 

I'm gonna backup this existing install and see how a new clean one writes, just in case there's been weird legacy concerns that it upholds when it finds them in an existing fashion in the db. :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...