-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Posters are cropped #11
Comments
More details: Plex posters are in a 1:1.5 (2:3) aspect ratio (according to this forum post) and Youtube artwork is in 16:9. Is there a decent solution out there to morph a 16:9 ratio into a 2:3 and still look somewhat reasonable? (My guess is no, but i'm hoping there is someone a lot smarter than me out there. :P) The Episode artwork looks great, but beyond that it looks pretty bad. |
so 16:24 against 16:9:
Shall i use the channel id profile picture as poster ? wouldn't look good with multiple folders |
This is by far the most elegant solution however it might be quite the pain in the ass to do since there are so many channels. Edit: My brother may have come up with a solution. It's pretty greasy bit it may work. https://stackoverflow.com/questions/25488338/how-to-find-average-color-of-an-image-with-imagemagick
|
One can already use local media assets agent to load a poster from the local folder. |
Humm clever actually, need to use pillow most possibly as external library
|
Managed to import PIL into the agent as i found an agent using it: https://github.com/yoadster/com.plexapp.agents.brazzers/tree/master/Brazzers.bundle/Contents/Libraries/Shared/PIL Here is my WIP
Will need to find :
Any help welcome
|
ran into: ImportError: The _imaging C module is not installed |
Havent had time to mess with this yet, its been a busy week. I'll try to take a stab at it later tonight if I get time. Edit: |
Any progress on this, the suggestions sound awesome from what i've seen here, would be much better than what we have currently! :) |
Not really... I still need to play around with trying to get some libs loaded that works cross platform. I am wanting to figure something out, but the lack of documentation from plex makes it a bit unappealing... |
Couldn't find library that really works... copied PIL from another agent but could not make it work
|
I'll take a look at it either tomorrow or early next week and see what I can do, although I've never written anything with regards to plex before so should be interesting :) |
So I took a bit of a look into this and I couldn't find anyone who'd managed to get these libraries working within plex. My current idea which I thought i'd run by you before I did any work on it, is to make it optional to run an external service that will take arguments through a REST API to generate the posters. My idea would be that you could specify the URL for the service in the config for the youtube agent in the same way that you currently specify the API key. If you don't specify one it just defaults to what it does now. I'd be happy to write the API for this, would aim to provide it as a standalone app and docker container so people could run it for themselves as part of their plex setup. Let me know what you think @ZeroQI |
@zackpollard there is a transcoding ability in plex i got from dane22 code, need to check if we can handle black bars with it. So PIL and PILLOW are a no go... |
I think removing the black bars is a good step forwards, but based around what @djmixman said, I think it would be good to get something more advanced working that isn't just the thumbnail for the first video in the show. This could be more easily achieved using an external service, but as I said, this should be entirely optional if we did do it, so having a good fallback (i.e. no black bars) would be great too. |
the problem is that if fit vertically and miss a quarter of the image both sides horizontally |
I still think that would be better than having black bars, they look awful :P I don't think a library will be feasible for me to write personally, my knowledge of plex plugins, python dependencies etc is not good enough so I would have to invest a lot of time into it. However I am willing to write an external service if you would be willing to write the hook into your agent once i've finished writing the external service part. |
Just saw the edit to your comment regarding the pymaging library. A pure python library could work as it would eliminate the dependencies issue. Can it do all the things that we need to build that example poster that was sent in this issue? |
I truelly don't know but will try. Could find PIL library in other agent but it gave me errors. |
here is the picture trancoding code i mentionned
|
That's a cool idea, so that can be used to convert the first episodes image to the right aspect ratio and remove those black bars? When abouts can you get this implemented? (I'm going to look into doing the external service in a couple of days, just a bit busy currently) |
by resizing at width, 1.5 x width we could have no cropping
code to get resolution:
Am not good with library imports but seem like we need this web service... |
What would I need to change in the code to set the main TV poster to use the same image which is used for the cast poster? |
@ewan2395 Force the channel id in the series folder name |
i have used in latest code update now the channel picture as main poster and ep screenshot as secondary picture just in case |
Hi @ZeroQI, I decided to take a quick look at this issue. There are a lot of different/cool ideas in this thread, but I think the main complaint is the black bars, and most of us would be happy if they were gone, even if we lose some of the image on either side. As said @zackpollard said:
Fortunately, the black bars are easy to eliminate! The current code (here) looks for thumbnails under As example, see the thumbnails for this video. If you go with that solution, I'd suggest doing one more thing. Currently you're looking at the playlist info, which provides the thumbnail of the last-added video. But I think it would be better to use the thumbnail from the oldest video, which would not change. Fortunately, all of the playlist items are loaded anyway, so there is no extra API call. The final code would look like this (integrated into your existing code): Log.Info('[?] json_playlist_items')
try:
json_playlist_items = json_load( YOUTUBE_PLAYLIST_ITEMS.format(guid, Prefs['YouTube-Agent_youtube_api_key']) )
except Exception as e:
Log.Info('[!] json_playlist_items exception: {}, url: {}'.format(e, YOUTUBE_PLAYLIST_ITEMS.format(guid, 'personal_key')))
else:
Log.Info('[?] json_playlist_items: {}'.format(json_playlist_items.keys()))
first_video = sorted(Dict(json_playlist_items, 'items'), key=lambda i: Dict(i, 'contentDetails', 'videoPublishedAt'))[0]
thumb = Dict(first_video, 'snippet', 'thumbnails', 'maxres', 'url') or Dict(first_video, 'snippet', 'thumbnails', 'medium', 'url') or Dict(first_video, 'snippet', 'thumbnails', 'standard', 'url') or Dict(first_video, 'snippet', 'thumbnails', 'high', 'url') or Dict(first_video, 'snippet', 'thumbnails', 'default', 'url')
if thumb and thumb not in metadata.posters: Log('[ ] posters: {}'.format(thumb)); metadata.posters [thumb] = Proxy.Media(HTTP.Request(thumb).content, sort_order=1 if Prefs['media_poster_source']=='Episode' else 2)
else: Log('[X] posters: {}'.format(thumb)) What do you think? Feel free to use this code if you want, or I can open a PR. |
Genius! |
For #11: Use 16:9 thumbnail for playlist poster.
Indeed no black bars! Still cropped on the sides, BUT i love the simple approach to it... I was concerned about the difference between playlist details and playlist items screenshot but seem like all playlist posters are indeed item posters, like:
|
Yes, exactly! Now, why YouTube ever serves 4:3 thumbnails is a mystery! :-) |
for 4/3 ratio tablets and phone maybe :) |
https://github.com/suparngp/plex-personal-shows-agent.bundle/blob/master/Contents/Code/__init__.py The declaration looks to me the same...
Seem like the lack of contributes_to make it work for series???
Cannot test at the moment |
That just puts it into "TV Shows" layout, which results in a 3 layer deep interface digging through "shows", "seasons", then finally "episodes". If you try and view them by episode only they're also still in portrait. EDIT: I think I figured out a hacky workaround, if I add |
We need the source code of such agent so I can work out the differences but look like you might have found how to make it work You could try that in the code and will add to master code if it works
|
Can you update/elaborate on your workaround? Were you able to get the plugin to work with Personal Media/Other Videos on your end? |
Please test with the included snippet after the post your are quoting and report |
Tried testing with the code from previous commenter, no joy, unfortunately. |
since in channel mode the video screenshot is used, the ratio is wrong and when used as a poster it gets heavily cropped...
Anybody knows an image library i could load in the agent to edit the picture ?
any other method to avoid poster field picture cropping ?
External libraries?
The text was updated successfully, but these errors were encountered: