jorenn92 / Maintainerr

Looks and smells like Overseerr, does the opposite. Maintenance tool for the Plex ecosystem
https://maintainerr.info
MIT License
754 stars 13 forks source link

When pulling the username from Plex, it's using the wrong field. #1230

Closed roadkingvrod closed 2 weeks ago

roadkingvrod commented 3 weeks ago

When I run the api call on Overseer (/api/v1/request) I see that the correct user name is shown in the field 'plexUsername', however immediatelly following it shows that "username":null which means that when I set up a rule to delete a movie watched by the user that requested it, it fails since null doesn't match the original username.

This is confirmed by testing the rule and it always returns null in the rule.

jorenn92 commented 2 weeks ago

The behavior depends on the 'userType' value of the media item. When the usertType is 2, Overseerr uses the 'username' field. If it's anything else, Overseerr uses the 'plexUsername' field. This value needs to be transformed to the correct Plex username.

When userType is not 2, Maintainerr will search through all the users in your Plex instance for a matching username. If no match is found, it will return null.

Could you verify that the value in plexUsername exactly matches one of your users usernames? Is there anything unusual about the user, such as a different display name?

jorenn92 commented 2 weeks ago

There was a mismatch when a Plex user used a 'display name'. I don't know when this changed, since it used to work with display names, but this should be handled in PR https://github.com/jorenn92/Maintainerr/pull/1231. If anyone could try it out with the main/develop image, that would be a great help!

roadkingvrod commented 2 weeks ago

For the admin account I can confirm that it is using plexUsername. I'll try with a non admin account.

jorenn92 commented 2 weeks ago

For the admin account I can confirm that it is using plexUsername. I'll try with a non admin account.

Are you able to try the "develop" image tag from Docker Hub or the "main" tag from GitHub? It would be helpful if you could confirm whether the fix is sufficient.

roadkingvrod commented 2 weeks ago

yes, i can do that tag. trying now.

roadkingvrod commented 2 weeks ago

I'm running:

Maintainerr Develop b6151c5

And the username is still pulling null. output of "Test Rule" below:

jorenn92 commented 2 weeks ago

It is successfully populating the ‘Overseerr - Requested by’ values this time, is it not?

roadkingvrod commented 2 weeks ago

It was before. What's always been missing is the firstValeuName: Plex 0 {list} Viewed by (username).
firstValue: []

The firstValue is always null so it never matches the Overseer Requested by. The Overseer Requested by was populated in the main release as well. I'm happy to post the test results side by side if that helps.

roadkingvrod commented 2 weeks ago

Just to provide as much info as possible:

I've created a simple rule saying if a specific user requests via Overseer and then watches via Plex, to put it in the collection:

mediaType: MOVIES rules:

jorenn92 commented 2 weeks ago

Oh, I see—I misunderstood your issue. The fix I applied was for the "Overseerr - requested by" rule, as more users were encountering problems with it.

Regarding the "Plex - viewed by" rule, it relies on data from the Plex item's watch history. Have you confirmed that the watch history is populated? You can check this in Plex Web.

Are you testing this with an item that has actually been watched? Keep in mind that this rule won't work if the item was simply marked as watched manually—this is a limitation on Plex's end, and unfortunately, there's nothing I can do to change that.

roadkingvrod commented 2 weeks ago

I didn't know about the limitation of watched manually. I'll try with another file that I can say for sure was watched and get back to you.

roadkingvrod commented 2 weeks ago

It appears to work when the movie is actually watched, vs marked read. Thanks for your help!

jorenn92 commented 2 weeks ago

It appears to work when the movie is actually watched, vs marked read. Thanks for your help!

No problem! I’m glad we figured it out.