Jump to content

How to merge two existing media folders?


Recommended Posts

Posted (edited)

Hi,

My movie library previously consisted of two folders which were two NFS shares from two NASes. Now I've retired one NAS, and its movies were moved to the other NAS, making it a single folder.

How can I keep the metadata (movie posters that I've set manually) of the old NAS? I've updated the MediaItems, MediaStreams2 and ItemExtradata tables of /var/lib/emby/data/library.db, which seems to work well (metadata is correct and I can play the movies), but a library scan seems to destroy everything (I've also updated options.xml in the /var/lib/emby/root/default folder).

Are the GUIDs that the metadata is using re-calculated based on the file path each time the library is scanned? How can I fix this so I don't have to manually update 1000+ movie posters again?

Thanks in advance!

Edited by freezy
Happy2Play
Posted
8 minutes ago, freezy said:

Hi,

My movie collection previously consisted of two folders which were two NFS shares from two NASes. Now I've retired one NAS, and its movies were moved to the other NAS, making it a single folder.

How can I keep the metadata (movie posters that I've set manually) of the old NAS? I've updated the MediaItems, MediaStreams2 and ItemExtradata tables of /var/lib/emby/data/library.db, which seems to work well (metadata is correct and I can play the movies), but a library scan seems to destroy everything (I've also updated options.xml in the /var/lib/emby/root/default folder).

Are the GUIDs that the metadata is using re-calculated based on the file path each time the library is scanned? How can I fix this so I don't have to manually update 1000+ movie posters again?

Thanks in advance!

What db updates did you do?

 

Posted

I've updated the following fields:

  • MediaItems.Path
  • MediaItems.Images
  • MediaItems.data
  • MediaStreams2.Path
  • ItemExtradata.Value

The queries looked something like this:

UPDATE MediaItems SET Path = replace(Path, '<old-path>', '<new-path>') WHERE Path LIKE '<old-path>%';

 

Posted

For completeness, here are all the queries:

UPDATE MediaItems SET Path = replace(Path, '/old/path', '/new/path') WHERE Path LIKE '/old/path%';
UPDATE MediaItems SET Images = replace(Images, '/old/path', '/new/path') WHERE Images LIKE '%/old/path%';
UPDATE MediaItems SET data = replace(data, '/old/path', '/new/path') WHERE data LIKE '%/old/path%' AND ParentId IS NOT NULL;
UPDATE MediaStreams2 SET Path = replace(Path, '/old/path', '/new/path') WHERE Path LIKE '/old/path%';
UPDATE MediaItems SET data = replace(data, '"/old/path","/new/path"', '"/new/path"') WHERE Id = 59984;
UPDATE ItemExtradata SET Value = replace(Value, '"/old/path"', '"/new/path"') WHERE ItemId = 55797;
UPDATE ItemExtradata SET Value = replace(Value, ',{"Path":"/old/path","NetworkPath":"smb://xxx:xxx@192.168.0.6/old/path"}', '') WHERE ItemId = 55797;

 

Happy2Play
Posted

Look correct.  Seem it has been hit or miss on this working for some and not others.

Are all your images saved with media?

 

Posted

The images are in the /var/lib/emby/metadata/library folder, if that's the question.

My plan B is to loop through the items in question and copy the images from the metadata folder to the media folder and have a fresh scan pick them up like that. But if I can avoid that, I'd be happier.

Happy2Play
Posted

There is really no way to move /metadata/library/xx/xxxxxxxxx folders from server to server as you have no idea how they are mapped unless you are going line by line per movie and assuming they don't collide on the new server.

So Emby has to get new images for every movie that is moved as they don't exist on that server in /metadata.

Posted (edited)

Well there might be a misunderstanding then: there is only one server. The metadata already exists on that server, it's just that a good part of the media paths have changed. What I don't understand is how Emby determines whether it needs to re-scan a folder, since all the moved folders seem to be rescanned, even though the paths in the DB correspond to the physical paths of the media.

Edited by freezy

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