Plex deletes the movie item when the filename was changed (upgraded), how can this be prevented?

Server Version#: 1.16.3.1402
OS: Ubuntu 18.04

I am using radarr to download movies and upgrade them to better quality if available and trigger a library scan after download

I use the quality tag in the filenames, so that means a movie like:

The Movie (2019)/the.movie.2019.1080p-webdl.mkv

will be upgraded to bluray with a new filename:

The Movie (2019)/the.movie.2019.1080p-bluray.mkv

the problem with plex is, that sometimes it will delete the movie from the plex library and re-add it as new to the recently added with a new item id

how can I prevent this?

what is really weird is, that it is not happening all the time, sometimes the id stays the same and plex updates the filename just fine
shouldn’t this be the default behavior, like if it’s a multi version movie? https://support.plex.tv/articles/200381043-multi-version-movies/
(although it differs from the official plex naming convention)

I’ve tried it with and without the automatic trash cleanup and it stays the same

  • the “Empty trash automatically after every scan” was disabled and
  • the file: “The Movie (2019)/the.movie.2019.1080p-webdl.mkv”
  • was upgraded with a new filename: “The Movie (2019)/the.movie.2019.1080p-bluray.mkv”
  • the library was scanned
  • I had 2 items of the same movie
    • one in recently added with a new id
    • the old one with the red trash bin icon

thanks

this is ‘normal’ behavior when auto trash cleanup is disabled, you have to manually ‘empty trash’.

I believe radarr deletes the original file before it moves the new one.

when auto empty trash is enabled, it depends on how quickly your server/plex process the deletion then addition, sometimes plex see the deletion and clear it before the whole new file gets put in place and scanned.

yes, that’s the normal behaviour and I am not complaining about the trash feature
but what is not normal (imho) is that I get a new library item with the exact same movie

yes radarr deletes the file prior to the move
but it triggers the plex library scan after the move
and plex is set to never automatically search any library

so the scan will definitely not happen before the new file is in the destination folder
I checked that
so even with auto empty trash enabled this should not happen imho

and I even get a new movie item if I add a second version of a movie manually to the same folder where the current file resides and I have to manually merge them

I changed the file path manually, with the following information: the media_parts table is where the media_item_id and the path to the the actual file is stored.
the media_item_id is linked in the media_items table with the metadata_items id which is the movie item you see in the dashboard

the only other thing I can think of is that you changed the metadata provider for those titles.

For example, if the movie was originally scanned with ‘plex movie’ but is now configured for ‘the movie db’, then the new movie will be detected as new with a new database id.

the really ironic part for me, is would PREFER the behavior of seeing upgraded content in recently added.

Or at least I wish there was a ‘recently modified’ hub.

1 Like

that is a very good hint indeed, I did change the provider once
that could explain a lot
I will test that

yes but, actually no
it would be fine if the ID would stay the same
but with a new ID it just f*cks up all the other services like tautulli, tracktarr, ombi, …
and for a lot of movies I have a bluray or web version with a 2.0 stereo german audio track
and I’ve set radarr to upgrade to 5.1 or 7.1 if available

but I don’t care to see that as newly added, cause, in reality, it is not
and someone might have already watched it and now it would be set to unwatched

re- watched/unwatched yes very good point, I would not want to mess up watched history/status, within plex or other apps.

I can suggest a workaround, but involves more work on your part.

In radarr you can specify a ‘recycle’ folder. When a movie is removed/upgraded, it gets moved to the recycle folder.

If you add the recycle folder to your movie library, plex will still see the old movie, and the new movie.

If the new movie shows up as new, you could try to re-match/combine with existing movie (to avoid the aforementioned status problems).

Then at some point you would need to manually delete/clear out the recycle folder, and empty plex trash.

yes, already thought about that and instead of triggering a scan within radarr, have a post proc. script to recover the file from trash, trigger a scan, remove the file, rescan

but that just feels so dirty^^ and there is no warranty that it would work, because:

unfortunately, that would not work
I already tried that manually
I’ve added another version of the same movie to the existing folder and got a new item in my library and I merged them afterwards
but that might also be related to the provider change (? don’t know, I will test that again)

I used the recycle method for a long time and it worked for me, but I haven’t had problems with them showing up as new or trying to rematch them.

main movie library

  • /media/movies
  • /media/movies-recycled

plex detects the move from movies to movies-recycled, then the movie shows as duplicates until I remove the one I no longer wanted.

try the ‘fix match’ on the ‘new’ movie, and see if you can get it to match by changing the metadata/agent provider.

as an aside, this is also how I keep 4k and non-4k movies unlinked, 4k library has a different agent setup.

Otherwise even with separate libraries, the 4k and 1080 movie would both show in the continue playing hub.

1 Like

you mean as two separate movies or with the little “2” for multiple versions in the top left corner?

makes sense
very helpfull
thank you

for me it was combining them as multiple versions with the “2” in the corner

I was doing this because sometimes I would get a crappy ‘upgrade’ and could quickly put the original back.

I’m just thinking: shouldn’t a complete metadata refresh of the whole library fix that?

it worked!!!

I originally added the library with plex movie as metadata agent and changed to themoviedb somewhere along the road

I just tested it again and fixed the match on the new movie with the plex movie agent and boom, it combined them and kept the old ID :slight_smile:

looks like this could even fix the upgrade issue and might also explain why it sometimes works (I guess for movies which where already added with themoviedb agent)

I will test that again but it looks very promising

thanks alot!!

re- I would expect refresh all metadata to work, but I would still shutdown plex, make a backup copy of both the database and the metadata folders (metadata can take a while to copy, zillions of small files/folders).

glad it seems to work out

ok, I was just asking because I already did that when I moved the server from FreeNAS to Ubuntu
I only moved the DB and refreshed all metadata
so either there was an issue or I need to configure something I’m not aware of or it does not work

yep it worked
the metadata agent was the troublemaker
I changed the librarys agent back to plex movie and it swapped the file and kept the ID
even with auto trash removal activated

awesome
finally… this was giving me headache already^^

thanks again for your help

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.