Jump to content

Batch Saving of Metadata?


bijon

Recommended Posts

I'm in a bit of a pickle.  I migrated my Emby install from one Ubuntu container to another.  I didn't do any selective folder migration I just moved the entire /var/lib/emby folder over after installing Emby on the destination.  The container was setup exactly the same with the same hostname and IP.  That all seems to have worked well. 

 

I have the Emby for Kodi plugin and when I fired up Kodi I had a message about needing to update a ton of items.  I thought that was odd since I assumed by doing the migration the way I did, no one would know that anything had changed.  I let Kodi update and after it was done I had dupes of everything with the duplicates showing "default" metadata (at least movie posters and fanart).  I assumed the Kodi database was confused so I did a reset of the Kodi database and let it resync with Emby.  This may have been the wrong thing to do but it's been a long time since I've had to do anything with Kodi or the plugin.

 

Somewhere in there something went wrong and I think Kodi wrote all the "default" metadata to my .nfo files stored in my media folders.  Emby started sucking in all that metadata and screwing up all my custom changes. 

 

I've restored the backup of my emby folder from before the migration and turned off the "Scan Media Library" task before it tried to run.  I think this leaves me with my custom metadata intact in Emby's cache (or something?).  If I manually save the metadata for an item it looks like it is updating the .nfo file with the correct information.

 

So before I figure out what made Kodi (or something else?) overwrite all my .nfo files, I want to restore the cached metadata to all the .nfo files.  My question is: is there a way I can save myself from manually clicking on every individual thing I have and hitting save to get it to write the metadata out?

Link to comment
Share on other sites

Well now I don't think it's a Kodi issue.  Every Refresh Metadata option seems to be doing what Replace All Metadata does: downloading new images and changing titles.

 

If I restore from my Emby backup then go into Metadata Manager and click on an item and click Save, it will change the .nfo to what it was before I tried the migration (this is what I want).  But even if I only use "Scan for new and updated files" it will completely replace the metadata to something from some provider.  I had previously been using "Scan for new and updated files" to get the library to pick up on files I had added while keeping the metadata changes I had made for any existing item.

 

So immediately after I restore the backup, Emby shows me everything with my custom metadata changes regardless of what is in the .nfo files.  I assume this is because Emby has its own cache.  If I go to Metadata Manager and select an item and hit Save (without changing anything) it will overwrite the .nfo file with the correct metadata from the Emby cache.  At this point everything seems to be as it should: Emby is showing me the right metadata, I can play the file, the .nfo has the same metadata that Emby is showing. 

 

But it seems like any time there is a refresh (including the Scan for new and updated files) Emby forgets that it already knows what everything is and grabs new data for everything.  This is happening even when I uncheck all Movie Metadata Downloaders from the Library.  If I lock the item before a refresh, it seems like titles aren't changed but existing images are deleted and the poster is replaced with a screengrab from the video file.

 

All paths are identical to the original system.  Same Emby version (4.0.1.0).  Same ubuntu version.  I'm really confused.

Edited by bijon
Link to comment
Share on other sites

I'm beginning to wonder if Emby supports migrating custom metadata.  I'm reading through these instructions again: 

 

https://github.com/MediaBrowser/Wiki/wiki/Backup

 

There is a blurb saying that the only folder in the /metadata folder worth backing up is the /People folder.  However my images are stored in the /library folder which the instructions specifically say isn't needed.  Not sure where the titles are stored aside from the .nfo files.

Link to comment
Share on other sites

Well I hacked together a fix.  Luckily I have backups of all my media folders so I wrote a program to copy over all the .nfo's from the backups and set them to read-only.  Then I let Emby refresh and since the .nfo's are all read only the only thing it could screw up is the artwork.  After it was done replacing all the artwork I overwrote the /var/lib/emby/metadata folder with my backup which contains the correct artwork.  Did a couple of refreshes to make sure the artwork stuck then turned off read-only for all the .nfo's.  Did a couple refreshes after that to make sure things stuck and now it seems like Emby is no longer trying to change all my metadata.

 

Would love to hear from someone on what the correct way to do this is.  Am I the only one who has ever tried to migrate Emby with custom metadata?

Link to comment
Share on other sites

 

 

Am I the only one who has ever tried to migrate Emby with custom metadata?

 

We have not yet really worked out a process for this, because the entries under the metadata folder are based on database id's, and those id's will change from one installation to the next.

 

The general rule of thumb is, if you anticipate having this type of requirement, then you will want to enable saving of metadata into local media folders so that it always stays with your media files.

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...