This is not user friendly at all.
Shouldnât have to go through all of this nonsense just to retain some metadata.
This is not meant to be friendly. Modifying the database is not meant for normal use. This is a very advanced topic and should not be done if you are not comfortable.
Can you explain exactly what you are trying to do? There may be an alternative method that is easier.
Worked like a charm. Many thanks for the queries. Did several changes the way described.
Since this is a âgeneral discussionâ post, not related to any specific platform, Iâd like to point out that using Linux you can just shut down plex, move your stuff to the new location and then symlink or mount the new location in the same path as the old location. This way no path changes.
Iâm in the process of updating my database using these instructions due to a move from Windows Server to unRAID (PMS inside a Docker). Yes I know this is risky and complicated but giving it a go to maintain all my played/unplayed status if I can.
I am on to the second of the SQLite updates and am only finding two items in âmetadata_itemsâ where the GUID contains âfile://â despite having 176 tv shows (many thousands of episodes) and ~900 films in the library. Does this sound at all right?
Also, further question⊠in the tables âmedia_streamsâ and âmedia_partsâ do I need to worry about the direction of the / \ in the paths?
As an example from âmedia_partsâ on of the âfileâ values was âF:\Videos\TV\White Collar\Season 01\White Collar 1x14 Out of the Box.aviâ but after the query became â/media/4/TV\White Collar\Season 01\White Collar 1x14 Out of the Box.aviâ
Will Plex / linux cope withe the remaining slashes being the wrong way round or do I need to update the rest? Can someone help me with the SQLite update query as Iâm a little bit of a novice at these.
Thanks
@DavidIrwin said:
I am on to the second of the SQLite updates and am only finding two items in âmetadata_itemsâ where the GUID contains âfile://â despite having 176 tv shows (many thousands of episodes) and ~900 films in the library. Does this sound at all right?
The only entries that should be like âfile://â are local movie extras, trailers, and music videos. 2 could definitely be possible.
@DavidIrwin said:
Also, further question⊠in the tables âmedia_streamsâ and âmedia_partsâ do I need to worry about the direction of the / \ in the paths?
Iâm not familiar with UnRaid but the direction needs to match what the OS wants.
Thank you.
David
I just wanted to say thanks to Jelwell and all on this thread for providing this information. I managed to migrate my Plex database to a new server and import all the metadata, movie posters etc from my old configuration without having to manually search for it all again!
I just used the Db Browser for SQL Lite to run the SQL commands provided in this thread with the correct paths. It worked straight away!
Thanks again Jelwell!
@jelwell said:
There are 4 edits youâll need to make (change pathing to appropriate values):
How exactly do you do these edits?
Iâm running âDB Browser for SQLiteâ now and Iâve tried to use the âExecute SQLâ tab to run the changes on my database, but I get:
no such module: fts4: UPDATE metadata_items
Any ideas?
Thanks!
Iâm not familiar with DB Browser, but try entering the entire line instead of splitting them up. Also, you need a semi-colon ; at the end.
I found DB Browser at http://sqlitebrowser.org/
Linked to by jelwell in this post: https://forums.plex.tv/discussion/comment/1080439/#Comment_1080439
Thanks, but it didnât help to enter it in one line, nor adding a semi-colon at the end. Stil says âno such moduleâ.
Not sure what Iâm doing wrongâŠ
Edit:
Aha! It works for the other queries than âmetadata_itemsâ.
Edit 2:
Works fine! Plex is now using my new paths as its media libraries. Seems I didnât have to do that âmetadata_itemsâ query in my case.
Thanks a lot for your help, guys!
That part affects movies that are unmatched. If all your stuff is matched, you wonât have a problem. If you have unmatched or home videos, these would still point to the old location.
Thanks a lot for this, Iâll drink a beer for you !
@jelwell said:
Ok, wow! That was surprisingly easy. Everything seems to be working GREAT!So just so itâs clear. Following my instructions will likely mess up your Library. But it worked wonders for me. AND it is SO easy. Easier than following the nuanced instructions in that article I linked above.
- Shutdown plex server
- Backup your data https://support.plex.tv/hc/en-us/articles/201539237
- Copy your content to the new location
- Edit your database. Find the location here: https://support.plex.tv/hc/en-us/articles/201100678-Repair-a-Corrupt-Database
There are 4 edits youâll need to make (change pathing to appropriate values):
UPDATE section_locations
SET root_path= replace(root_path, â/Users/jelwell/Sharedâ, â/Volumes/Moviesâ)
where root_path like â%/Users/jelwell/Shared%â
UPDATE metadata_items
SET guid= replace(guid, âfile:///Users/jelwell/Sharedâ, âfile:///Volumes/Moviesâ)
where guid like â%file:///Users/jelwell/Shared%â
UPDATE media_streams
SET url= replace(url, âfile:///Users/jelwell/Sharedâ, âfile:///Volumes/Moviesâ)
where url like â%file:///Users/jelwell/Shared%â
UPDATE media_parts
SET file= replace(file, â/Users/jelwell/Sharedâ, â/Volumes/Moviesâ)
where file like â%/Users/jelwell/Shared%â
5 Start up Plex Server
6 Verify that everything is working (test loading some of the copied files, note the location of that library changed in plex web settings)
7 Delete the old files.
8 Drink a beer for me.@MovieFan.Plex might be worth adding to your tool?
Thanks everyone, I canât believe how simple it is and how inaccurate that article is. Might be a good idea to just implement a move function in Plex WebâŠ
Joseph Elwell.
Thanks everyone for this thread, Josephâs process worked for me & the other discussion was also helpful (i.e. was wondering why I had no changes for metadata_items, which is also addressed in this thread). Like Joseph I had noticed the official Move-Media-Content-To-New-Location document threw away all my customized metadata, which wasnât going to fly - that was lots of work over time. Why Plex doesnât have an official way to do this migration is beyond me!
Hi All,
My Plex is set up in french cause my kids donât actually understand english. So i rename all movie title in French. Is there a way i can save those information to restore them because i need to change my computer. When my computer will be ready i could restore the information without renaming all the movie again ( took me 5 hours ). All my file are on a external HD, so it just to setup correctly the data in Plex.
Thx for your help
Hi All,
Is there a way to apply this for Nvidia Shield PMS ?
I believe that it is no longer required to do database modification for this. If you simply ensure that the right settings are configured (DO NOT enable âEmpty Trash Automatically after every scanâ) then go through the process:
- Copy media files to new location
- Edit library to reference new location
- Scan Library Files
- remove files from original location
- scan library files
- Check media in PMS - should show 2 media files against all media items with one showing as unavailable
- Empty trash - will clear âmissingâ media items from original location
- Edit library to no longer reference original location
I have done this a few times now to reorganise my media.
The issue is not that those steps wonât work. Those steps DO work, if you are matching your media using IMDB or another metadata source.
If you have any unique media, where it wonât ever match automatically, Plex does not know that the media in a new location matches to the media in the old location (where weâve likely spent many hours entering metadata manually). So even if you copy your folder of [unique] media to a new location, and add that new location to your Plex library, it wonât match them or indicate there are 2 copies.
The only current way to handle this kind of move is to manually edit the Plex database.
@Pterisaur said:
@DavidIrwinThe issue is not that those steps wonât work. Those steps DO work, if you are matching your media using IMDB or another metadata source.
If you have any unique media, where it wonât ever match automatically, Plex does not know that the media in a new location matches to the media in the old location (where weâve likely spent many hours entering metadata manually). So even if you copy your folder of [unique] media to a new location, and add that new location to your Plex library, it wonât match them or indicate there are 2 copies.
The only current way to handle this kind of move is to manually edit the Plex database.
I absolutely understand your problem now and yes I agree the only way to solve that would be to update the database. I donât envy you the pain and wish you luck.