Jump to content

change media library path no need to rescan


Recommended Posts

Posted

I moved the video in the media library to another directory, and I changed the media library path in the background, but I need to rescan it to play it, because metadata and the media files are not in the same folder, and if I rescan the media library, it will cause metadata loss, what should I do?

Posted

Hi, why do you think it will cause metadata loss? What will you lose?

Happy2Play
Posted
11 hours ago, dzhl1201 said:

and I changed the media library path in the background

What did you change? 

But moving media that does not have metadata with media is all manual as all paths in the database have to be updated to maintain the current metadata/images.

Posted
6 hours ago, Luke said:

Hi, why do you think it will cause metadata loss? What will you lose?

Suppose the original path of the media library (TV) is /home/video1, and the metadata are stored in emby/metadata/library/, now I move the video in /home/video1 to /home/video2, I need to change the path of the media library (TV) to /home/video2. Because the video path recorded in the database is still /home/video1, I have to rescan the media library (TV) in order to update the media file path in the database. The rescan seems to delete the media file record under /home/video1 in the database first, and then add the media path in /home/video2, but since the metadata and media are not placed in a directory, the rescan cannot find the images, so I don't want to scan again, because there are already records in the database, I just need to update the media paths in the records, how do I update these records?

Translated with www.DeepL.com/Translator (free version)

Posted
7 hours ago, Happy2Play said:

What did you change? 

But moving media that does not have metadata with media is all manual as all paths in the database have to be updated to maintain the current metadata/images.

After moving the video and changing the media library path, I used python to change the MediaItems and MediaStreams2 PATH fields in library.db to the new media library path, and I can play the video and display the cover image, but if I rescan the database again, it causes the records to be lost, what's wrong with this?

Posted
6 minutes ago, dzhl1201 said:

Suppose the original path of the media library (TV) is /home/video1, and the metadata are stored in emby/metadata/library/, now I move the video in /home/video1 to /home/video2, I need to change the path of the media library (TV) to /home/video2. Because the video path recorded in the database is still /home/video1, I have to rescan the media library (TV) in order to update the media file path in the database. The rescan seems to delete the media file record under /home/video1 in the database first, and then add the media path in /home/video2, but since the metadata and media are not placed in a directory, the rescan cannot find the images, so I don't want to scan again, because there are already records in the database, I just need to update the media paths in the records, how do I update these records?

Translated with www.DeepL.com/Translator (free version)

After moving the video and changing the media library path, I used python to change the MediaItems and MediaStreams2 PATH fields in library.db to the new media library path, and I can play the video and display the cover image, but if I rescan the database again, it causes the records to be lost, what's wrong with this?

Happy2Play
Posted

Not sure as every time I have tested this I didn't have any issues.

Posted
51 minutes ago, Happy2Play said:

Not sure as every time I have tested this I didn't have any issues.

how do you test it?

Posted

HI, I think you probably just need to backup the .db files, make the changes, then start the server, no?

Posted
6 hours ago, Luke said:

HI, I think you probably just need to backup the .db files, make the changes, then start the server, no?

after  i modified  db,i start emby-server,it can play media,but if i try to rescan library,all the media which has been in db will be lost in db (not file lose in disk)

Posted
17 hours ago, dzhl1201 said:

after  i modified  db,i start emby-server,it can play media,but if i try to rescan library,all the media which has been in db will be lost in db (not file lose in disk)

OK sorry, I think some users have figured out tricks to accomplish this, but we don't really have a documented process for it. @Happy2Play may have some tips.

Happy2Play
Posted

@dzhl1201 I think this is more than just a path change here.

How are /home/video1 and /home/video2 assigned to libraries?

Only other variable I can think of would be parentid as each library folder will have a different parentid.  And this affects the itemlinks table also.

So Path in MediaItems/MediaStreams2 tables need updating along with parentid for each folder with correct parentid, then each item in the itemlinks need parentid updated.

In your case you need to know the parentid for /home/video1 and /home/video2.

That is if I am understanding everything correctly this could get complicated in the itemlinks table.

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