Jump to content

Python script: Emby MDBList Collection Creator


Recommended Posts

ZLuckyTraveler
Posted

This is very cool. 

@AmythingWould be possible for you to make a docker image for this application, so we can containerize and run via Docker?

Posted
9 hours ago, ZLuckyTraveler said:

This is very cool. 

@AmythingWould be possible for you to make a docker image for this application, so we can containerize and run via Docker?

It's not an application - it's a Python script ?

ZLuckyTraveler
Posted
7 hours ago, rbjtech said:

It's not an application - it's a Python script ?

Script, application, program, whatever it is isn’t really pertinent to the question being asked. It’s just semantics. 

Posted

@ZLuckyTraveler@neoKushan (on Github) added Docker image to the repository. More info in the Readme https://github.com/jonjonsson/Emby-MDBList-Collection-Creator/blob/main/README.md   Commit info https://github.com/jonjonsson/Emby-MDBList-Collection-Creator/pull/6#issuecomment-2464859572

@rbjtechKinda agree with you that it's complicating things :) But there is clearly some demand for it and easy enough to ignore if you don't want to use it. 

  • Like 2
Posted (edited)

Yup, I am working with @Amything to enable you to deploy this as a docker container instead of running it as a standalone script, it should be available soon under `ghcr.io/jonjonsson/emby-mdblist-collection-creator:latest` (Assuming there's no problems with the code I just submitted) :)

Edited by Kushan
  • Like 1
hthgihwaymonk
Posted

I think it was asked once before and responded with no, but figured I'd check again.
Does this script support including custom collection posters yet?

thanks

Posted
5 hours ago, hthgihwaymonk said:

Does this script support including custom collection posters yet?

No, the script does not do anything with the collection posters. The posters are a one time thing so you just have to put in the work 😅

hthgihwaymonk
Posted
47 minutes ago, Amything said:

No, the script does not do anything with the collection posters. The posters are a one time thing so you just have to put in the work 😅

Thanks, I appreciate the quick reply.
Posters are not a one time thing, at least for me. I like variety
But I have that automated already,  I was just curious if it was implemented here just to compare the code.
Thanks again 

Posted
51 minutes ago, hthgihwaymonk said:

I have that automated already

What are you using? I haven’t looked into that at all tbh. 

hthgihwaymonk
Posted
5 minutes ago, Amything said:

What are you using? I haven’t looked into that at all tbh. 

Just some python I wrote to make collections

hthgihwaymonk
Posted

What I've found is you have to add/update the poster after the collection has been initially created.
But I've not looked at that part of the code in almost a year, so there may be a better way

Posted
7 hours ago, hthgihwaymonk said:

What I've found is you have to add/update the poster after the collection has been initially created.
But I've not looked at that part of the code in almost a year, so there may be a better way

If you are happy to share the code, then maybe you or Amything could add as part of the script ?    As a user of the script myself, I'd be willing to spend a little time adding it.   I presume you could just put the image url in the config, and it simply extract it and use the emby api to push it post creating the collection as you say - should be fairly easy to do especially as you have a working example.

Posted

I'll take a look at collection posters today.  Shouldn't take too much time.

  • Like 1
hthgihwaymonk
Posted (edited)
7 hours ago, rbjtech said:

If you are happy to share the code, then maybe you or Amything could add as part of the script ?    As a user of the script myself, I'd be willing to spend a little time adding it.   I presume you could just put the image url in the config, and it simply extract it and use the emby api to push it post creating the collection as you say - should be fairly easy to do especially as you have a working example.


 

'Movies - Popular': {'sort': '_a1', 'poster': 'Trends/Movies - Popular.png', 'library_type': 'Movie', 'type': 'mdblist'},
'Movies - Alien': {'sort': '_f', 'poster': 'Collections/Alien Complete Collection.png', 'library_type': 'Movie', 'type': 'tmdb', 'collection_id': '8091'}

and then - 
 

# update poster
collection_poster = getattr(config, selected_collection)[collection_name]['poster']
with open(f'{collection_poster_pathj}/{collection_poster}', 'rb') as file:
    image_data = file.read()
image_data_base64 = base64.b64encode(image_data)
headers = {"X-Emby-Token": emby_api_key,
        "Content-Type": "image/jpeg"}
url = f"{emby_server_url}/Items/{itemID}/Images/Primary"
response = requests.post(url, headers=headers, data=image_data_base64)
if response.status_code == 204:
    print(f'Successfully updated Poster for Collection "{collection_name}"')
else:
    print(f'Error updating collection poster for  "{collection_name}": {response.text}')

That updates the poster

Edited by hthgihwaymonk
  • Thanks 2
Posted

@rbjtech@hthgihwaymonkI added poster support. Let me know what you think.

I couldn't figure out a way to get enough information on which poster was currently being used with the API. To prevent uploading the same poster over and over I'm storing which file is used in a local cfg file (stored in a "temp" directory). 

Example:

[Oscars 2024]
source = https://mdblist.com/lists/squint/the-96th-academy-awards
poster = https://plexcollectionposters.com/images/2019/01/31/oscars9a7c2bc47188f883.png

Can use local path or url. https://plexcollectionposters.com/ seems to be a good source. Know any others?

 

  • Thanks 1
Posted (edited)
12 hours ago, Amything said:

@rbjtech@hthgihwaymonkI added poster support. Let me know what you think.

I couldn't figure out a way to get enough information on which poster was currently being used with the API. To prevent uploading the same poster over and over I'm storing which file is used in a local cfg file (stored in a "temp" directory). 

Example:

[Oscars 2024]
source = https://mdblist.com/lists/squint/the-96th-academy-awards
poster = https://plexcollectionposters.com/images/2019/01/31/oscars9a7c2bc47188f883.png

Can use local path or url. https://plexcollectionposters.com/ seems to be a good source. Know any others?

 

Brilliant - thanks for adding this !

It's working great - I just tested with the above example.

It's a shame mdblist doesn't have metadata for a free image ;) as 'finding an image' per collection is a bit of a pita.  

edit - ah, no different to kometa, but that has the bonus of image assets as part of the package. Kometa (PMM)

But the mechanism to get them and inject them into emby is done - so good job ! 👍

 

image.thumb.png.c06d89c0e680bb589e111f9d5615f537.png

Edited by rbjtech
  • Like 1
Posted (edited)
On 11/11/2024 at 12:07 AM, Amything said:

@rbjtech@hthgihwaymonkI added poster support. Let me know what you think.

I couldn't figure out a way to get enough information on which poster was currently being used with the API. To prevent uploading the same poster over and over I'm storing which file is used in a local cfg file (stored in a "temp" directory). 

Example:

[Oscars 2024]
source = https://mdblist.com/lists/squint/the-96th-academy-awards
poster = https://plexcollectionposters.com/images/2019/01/31/oscars9a7c2bc47188f883.png

Can use local path or url. https://plexcollectionposters.com/ seems to be a good source. Know any others?

 

What's the syntax for local path? Mounted local directory into /app/posters in  the docker container.

services:
    emby-mdblist-collection-creator:
        image: ghcr.io/jonjonsson/emby-mdblist-collection-creator:latest
        container_name: emby-mdblist-collection-creator
        restart: unless-stopped
        volumes:
            - ./Docker/Data/emby-mdblist-collection-creator/config.cfg:/app/config.cfg
            - ./Docker/Data/emby-mdblist-collection-creator/posters:/app/posters

This is an example:

[- HBO Shows -]
Source = https://mdblist.com/lists/garycrawfordgc/hbo-shows
poster = /app/posters/hbo.png
Frequency = 100
update_items_sort_names = False

When exec into it, the poster file is shown, but not used when creating or updating a collection. Or isn't this not yet available in the container?

 

Second question: When I set hours_between_refresh = 6 in the container cfg file. It will pull every 6 hours the list queries and injects it into Emby?

 

Thanks again for this awesome project!

Edited by shorty1483
Posted
4 minutes ago, shorty1483 said:

Second question: When I set hours_between_refresh = 6 in the container cfg file. It will pull every 6 hours the list queries and injects it into Emby?

Personally, I set mine to 0 (don't wait for a refresh, just finish and exit) and then schedule it to run with the OS scheduler.     Much more control that way imo.

Posted
33 minutes ago, rbjtech said:

Personally, I set mine to 0 (don't wait for a refresh, just finish and exit) and then schedule it to run with the OS scheduler.     Much more control that way imo.

Yeah, did that to when on my Windows machine. But since the Docker Container runs anyway...

Posted
59 minutes ago, shorty1483 said:

When exec into it, the poster file is shown, but not used when creating or updating a collection. Or isn't this not yet available in the container?

What do you mean when you that the poster  is shown when you exec into it? If the readme says version 1.8 at the top you should be good. Is there no error produced? 

Quote

Second question: When I set hours_between_refresh = 6 in the container cfg file. It will pull every 6 hours the list queries and injects it into Emby?

Yep that is correct. It's an overkill for static or near static lists so you can use the frequency parameter in the config to skip over those. 

  • Like 1
Posted
18 hours ago, Amything said:

What do you mean when you that the poster  is shown when you exec into it? If the readme says version 1.8 at the top you should be good. Is there no error produced? 

I mean the volume with the selhosted poster images is correctly mounted into the container /app/posters path and I can see the poster file inside the container (hbo.png), but when setting it in config.cfg, it is not imported into Emby when the collection creator creates the collection. If the above path syntax in my config from previous post, I will check permissions.

 

Posted (edited)
On 10/11/2024 at 23:07, Amything said:

Can use local path or url. https://plexcollectionposters.com/ seems to be a good source. Know any others?

I found the original Kometa (previously PMM) images on github - It's a bit cheeky to use them, I'd like to get the OK from the author but they are open source .. ;)

Currently I've just cloned the repo and thus have all the images local that I reference. (1000's of them !)

btw - for Windows users in the config file it's :-

poster = D:\Kometa\seasonal\christmas.jpg

Note - no quotes, so no spaces will likely be allowed in the file path, nor file name unless python is space friendly.. ?

 

image.thumb.png.49d5717a88341a32f978d4080913b747.png

Edited by rbjtech
  • Like 2
Posted (edited)

It's starting to come together - the uniform images make it all look SOOOO much nicer (and easier to find stuff) .. 👍

Edited by rbjtech
hthgihwaymonk
Posted
3 hours ago, rbjtech said:

It's starting to come together - the uniform images make it all look SOOOO much nicer (and easier to find stuff) .. 👍

uniform images with collections is the only way to go, glad you got is going

  • Agree 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...