Skip to content

Commit

Permalink
now handle based on collections
Browse files Browse the repository at this point in the history
  • Loading branch information
Aneurin Price committed Dec 8, 2022
1 parent fdd62c3 commit fb2017d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 23 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Requires:
`python3 main.py`
# Function

This script is designed to add bluray, 4k and 4k hdr banners onto movie posters in plex. I doubt many people will want this, but it's of mild interest ot me.
This script is designed to add bluray and 4k banners onto movie posters in plex. I doubt many people will want this, but it's of mild interest ot me.

## How it works

- This script uses the plex API to search for 1080p, 4k and 4kHDR content
- This script uses the plex API to search for 1080p and 4k content in a given library + collection
- The CURRENT poster being used in plex is then download
- The corresponding bluray header is applied
- The newly generated poster can then be uploaded automagically to plex (This is configurable)
Expand All @@ -36,16 +36,15 @@ PlexToken: "AnExampleToken" (https://support.plex.tv/articles/204059436-finding
PlexMoviesLibrary: "Blurays" (The library containing all of your Blurays, Script is not clever enough to know if the file is actually bluray or not, it will apply to any eligable movies in the library)
HandleHDR: True (4k HDR content will be given the `assets/HDR.png` header. Setting to false will ignore this and all 4k content will be given the `assets/UHD.png` header)
UploadPoster: False (Replace the current poster associated with the given movie in plex)
KeepPoster: True (Keep the generated posters in the `output` directory. This is useful to check content before uploading)
BlurayCollection: "Blurays" (The Plex collection in the provided library that contains your Blurays)
```

# FAQ

- How can I exclude non-bluray movies in my Library? This tool is not clever, It will assume that everything in the configured library is a Bluray and there is currently not a way to exclude files
- How do I choose which poster is used for the new art? MOGNO will use whatever poster is currently in plex. Setting the desired image
- Can I use this for TV Shows? Not yet. I do intend to add support for TV shows as I have a large number of TV Shows on bluray. It is more complex due to the existence of the `Season` entities with thier own posters
- I am seeing timeouts when performing the poster operations? This can happen when trying to run this against a host not on your network , for best results please make sure you are on the same LAN and use the servers IP address
Binary file removed assets/HDR.png
Binary file not shown.
Binary file modified assets/after.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#PlexMoviesLibrary: "Movies"

#HandleHDR: True

#UploadPoster: False

#KeepPoster: True

#BlurayCollection: "Blurays"
22 changes: 6 additions & 16 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from plexapi.server import PlexServer
import plexapi
import os
import requests
import shutil
Expand Down Expand Up @@ -26,8 +27,8 @@ def AddBanner (movie, category, Poster):


def UploadPoster (movie, Poster):
movie.uploadPoster(filepath='./output/' + Poster)

movie.uploadPoster(filepath='./output/' + Poster)
print(Poster + " Uploaded")
def TidyUp (movie, Poster):
if not (config['KeepPoster']):
os.remove('output/' + Poster)
Expand All @@ -42,23 +43,12 @@ def RunMain (movie, category):
print("Completed " + movie.title)






config, plex = LoadConfig()
movies = plex.library.section(config['PlexMoviesLibrary'])


if config['HandleHDR']:
for movie in movies.search(resolution="4k", hdr=False):
RunMain(movie, "UHD")
for movie in movies.search(resolution="4k", hdr=True):
RunMain(movie, "HDR")

if not config['HandleHDR']:
for movie in movies.search(resolution="4k"):
RunMain(movie, "UHD")
for movie in movies.search(collection=config['BlurayCollection'], resolution="4k"):
RunMain(movie, "UHD")

for movie in movies.search(resolution="1080p"):
for movie in movies.search(collection=config['BlurayCollection'], resolution="1080p"):
RunMain(movie, "Bluray")

0 comments on commit fb2017d

Please sign in to comment.