ZeroQI / Lambda.bundle

Local Media Export, a reverse Plex 'Local Media Assets' agent to export metadata locally
GNU General Public License v3.0
134 stars 18 forks source link

Grabs top movie poster when there are multiple with the same name #6

Closed Brandonb2014 closed 5 years ago

Brandonb2014 commented 5 years ago

First off I want to thank you for making such an amazing plug-in!

I was playing with it this morning and I think I ran into a small bug. I have three different Robin Hood movies: Robin Hood (1973) Robin Hood (2010) & Robin Hood (2018)

I refreshed the metadata for Robin Hood (2018), but it saved the Robin Hood (1973) poster and background images. The same thing happened when I refreshed the Robin Hood (2010) metadata. My guess is that it is just grabbing the top item returned when searching for Robin Hood? I tested Robin Hood: Prince of Thieves (1991) and it worked fine (confirming it is going based off the movie name)

If you need to view logs, let me know which log you need, I know there are a ton of them and I haven't really figured out which log is the relevant one.

Thanks again for this awesome plug-in! I WILL actually be donating to your donation link as soon as things aren't so tight.

Brandonb2014 commented 5 years ago

I'm no Python expert by any stretch, but I think I found where to fix the code, but I can't figure out how to do a pull request and push it. Lines 358 & 359 Changing from:

358 if media.title==video.get('title'):
359 Log.Info('title:                 {}'.format(video.get('title'))

To also check the year of the movie:

358 if media.title==video.get('title') and media.year == video.get('year'):
359 Log.Info('title:                 {} , year:     {}'.format(video.get('title'), video.get('year')))

I think that will work (assuming video.get('year') actually exists)

ZeroQI commented 5 years ago

Am glad you like it, but it is not very known nor used despite the fact i thought it was a great tool to import/export plex metadata... At the very least, no other like this exist...

This field 'year' exists for movies only (used line 377) so yes that's a correct fix

Brandonb2014 commented 5 years ago

Well it is great, just give it time to catch on.

I updated the plug-in this morning and sorry I think I broke it (in my defense, I couldn't test the code, that was just a guess) It looks like there is no year value: image

ZeroQI commented 5 years ago

Please try 'metadata.year' instead of 'media.year'.

Brandonb2014 commented 5 years ago

That didn't seem to work either. So I did do a little debugging and it looks like metadata.year doesn't have a value. image

What values are even available in media, video and metadata? I tried to print them out but couldn't get it to work.

Brandonb2014 commented 5 years ago

Ok, I was able to do some debugging and found that the media.id is equal to the video ratingKey. Which seems to be a unique ID in the XML for the movie. So after switching that if statement on line 358 to this: if media.id == video.get('ratingKey'): it has worked for every test I've given it. Which I would accept as closing out this issue.

ZeroQI commented 5 years ago

Thanks a lot for this fix. i have included it so it benefits all users

Kind regards, Benjamin

Brandonb2014 commented 5 years ago

No problem! Glad I could help