mynttt / UpdateTool

A tool to update the IMDB ratings for Plex libraries that contain movies/series and use the IMDB agent to receive ratings
GNU General Public License v3.0
250 stars 12 forks source link

Agent Changer #21

Closed camjac251 closed 4 years ago

camjac251 commented 4 years ago

I hope you don't mind feature requests. I've been trying to find a tool that would do this and have not been able to fix my library fully yet due to the various agent changes I made in the past, 2017-2018.

Force Rematch as an option to this script would be a huge time saver. There was this very useful feature being developed for Plex Web Tools when it was still active that would help a common problem with libraries. github.com/ukdtom/WebTools.bundle/issues/509 explains the feature a bit. I've noticed it too where even if I change around the order or enable sub-agents in the main one, then you'd have to force a rematch to get correct metadata. Simply refreshing would not work, and as of right now you must force rematch one by one, movies and tv shows, there is no way to batch force rematch or unmatch and match inside of plex.

WebTools has been the only thing I could find that tried to do it, however it's not a part of the UI and must be run over the API but there's no documentation and I couldn't get it working myself, although I can't read python very well so that's probably why. github.com/ukdtom/WebTools.bundle/blob/%23509/Contents/Code/changeagent.py

The problem is that when you change the library agent, all existing matched movies/tv shows will not change and remain the same even after refreshing the metadata in their agent. However in the sqlite db, each show has the agent its matched to and the id of the movie/show, so it can't be changed simply by replacing the agent name, it has to be rematched in plex to get the new //t02192 like id.

What do you think of this feature request?

mynttt commented 4 years ago

Sounds like a useful feature to fix broken libraries.

I could take a look at it. But I will need some clarifications on a few things first and I will also need your database to test this on a local Plex installation as there is no way for me to replicate the broken metadata you have.

The python script is pretty hard to read as not even all the variables are in English, it uses global variables and sometimes has some heavily indented sections. I would definitely not want to touch that.

From my understanding of your issue two things have to happen:

1.) Update the agent strings accordingly.

2.) Force a refresh for these items over the undocumented Plex web client API.

It does send a POST request when I tried it with my browser, so I guess after finding out which magic parameters are required it can be implemented.

If this feature works out as intended I would not include it in the imdb-docker implementation but create a new implementation that can be changed via an environment variable as this has nothing to do with the IMDB matching tool.

mynttt commented 4 years ago

If you want to send me your database you can do that per e-mail: marc@herschel.io

There is not any personal information within the database other than the actual libraries, library items and what has been watched.

I would defenitly need to have access to the tables metadata_items, metadata_item_settings and metadata_item_views.

mynttt commented 4 years ago

Alright I just tested this by creating a dummy library with one movie using the TMDB agent.

I then transferred the movie to the Plex Movie Agent that uses the IMDB rating by setting the items guid and changing the libraries' agent via the sqlite database.

Upon forcing a refresh of the item via the web interface all the metadata stayed intact and the rating changed from a star to the IMDB badge which confirms that Plex successfully executed the refreshment.

So the only thing left to research is how to replicate the POST request that triggers the refreshment. Once that is replicable it should be possible to define migrations and execute them on selected libraries.

These migrations are mainly about converting id's which the imdb-docker implementation does all the time.

So your request should be able to be implemented.

mynttt commented 4 years ago

Closed due to inactivity