mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-21 12:03:09 +00:00
add webp support for overlays
This commit is contained in:
parent
0c13d88dde
commit
26127aa79d
9 changed files with 63 additions and 43 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -18,6 +18,7 @@ config/overlays/*/
|
|||
config/overlays/temp.jpeg
|
||||
config/overlays/temp.jpg
|
||||
config/overlays/temp.png
|
||||
config/overlays/temp.webp
|
||||
!config/*.template
|
||||
build/
|
||||
develop-eggs/
|
||||
|
|
|
@ -3,18 +3,17 @@
|
|||
# Removed Features
|
||||
|
||||
# New Features
|
||||
Added `overlay_filetype` and `overlay_quality` settings to control the filetype and quality of overlay images.
|
||||
Added `overlay_filetype` and `overlay_quality` settings to control the filetype and quality of overlay images. Users can select from JPG, PNG and WEBP.
|
||||
|
||||
# Updates
|
||||
|
||||
# Defaults
|
||||
Added `starting_only` template variable to the `mal` Collection Default.
|
||||
Changed streaming defaults to use names as their keys vs their TMDb IDs as keys
|
||||
Fixed `amazon` ID in `streaming` when region is `CA`
|
||||
|
||||
# Bug Fixes
|
||||
Catch bad ID data from Plex
|
||||
Fixes `- git` file calls
|
||||
|
||||
Various other Minor Fixes
|
||||
|
||||
Closed legacy issues on GitHub
|
||||
Various other Minor Fixes
|
|
@ -26,27 +26,33 @@ templates:
|
|||
conditions:
|
||||
- originals_only: false
|
||||
value: <<limit>>
|
||||
discover_with:
|
||||
conditions:
|
||||
- originals_only: false
|
||||
value: <<tmdb_key>>
|
||||
discover_region:
|
||||
conditions:
|
||||
- originals_only: false
|
||||
value: <<region>>
|
||||
final_tmdb_key:
|
||||
default: <<tmdb_key>>
|
||||
conditions:
|
||||
- region: CA
|
||||
tmdb_key: [9]
|
||||
value: 119
|
||||
discover_with:
|
||||
conditions:
|
||||
- originals_only: false
|
||||
value: <<final_tmdb_key>>
|
||||
allowed_streaming:
|
||||
conditions:
|
||||
- originals_only: true
|
||||
tmdb_key: ["103", "1759", "151", "230", "283", "510", "39", "37", "188"]
|
||||
tmdb_key: [103, 1759, 151, 230, 283, 510, 39, 37, 188]
|
||||
value: False
|
||||
- region.not: GB
|
||||
tmdb_key: ["103", "151", "39"]
|
||||
tmdb_key: [103, 151, 39]
|
||||
value: False
|
||||
- region.not: CA
|
||||
tmdb_key: ["230"]
|
||||
tmdb_key: [230]
|
||||
value: False
|
||||
- region: CA
|
||||
tmdb_key: ["1899", "37"]
|
||||
tmdb_key: [1899, 37]
|
||||
value: False
|
||||
|
||||
default:
|
||||
|
|
|
@ -75,24 +75,30 @@ templates:
|
|||
discover_with:
|
||||
conditions:
|
||||
- originals_only: false
|
||||
value: <<tmdb_key>>
|
||||
value: <<final_tmdb_key>>
|
||||
discover_region:
|
||||
conditions:
|
||||
- originals_only: false
|
||||
value: <<region>>
|
||||
final_tmdb_key:
|
||||
default: <<tmdb_key>>
|
||||
conditions:
|
||||
- region: CA
|
||||
tmdb_key: [9]
|
||||
value: 119
|
||||
allowed_streaming:
|
||||
conditions:
|
||||
- originals_only: true
|
||||
tmdb_key: ["103", "1759", "151", "230", "283", "510", "39", "37", "188"]
|
||||
tmdb_key: [103, 1759, 151, 230, 283, 510, 39, 37, 188]
|
||||
value: False
|
||||
- region.not: GB
|
||||
tmdb_key: ["103", "151", "39"]
|
||||
tmdb_key: [103, 151, 39]
|
||||
value: False
|
||||
- region.not: CA
|
||||
tmdb_key: ["230"]
|
||||
tmdb_key: [230]
|
||||
value: False
|
||||
- region: CA
|
||||
tmdb_key: ["1899", "37"]
|
||||
tmdb_key: [1899, 37]
|
||||
value: False
|
||||
mdblist_list: https://mdblist.com/lists/k0meta/<<key>>-<<originals>>
|
||||
tmdb_discover:
|
||||
|
@ -103,73 +109,73 @@ templates:
|
|||
overlays:
|
||||
|
||||
Netflix:
|
||||
variables: {key: netflix, tmdb_key: "8", weight: 160}
|
||||
variables: {key: netflix, tmdb_key: 8, weight: 160}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
||||
Prime:
|
||||
variables: {key: amazon, tmdb_key: "9", weight: 150}
|
||||
variables: {key: amazon, tmdb_key: 9, weight: 150}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
||||
Disney:
|
||||
variables: {key: disney, tmdb_key: "337", weight: 140}
|
||||
variables: {key: disney, tmdb_key: 337, weight: 140}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
||||
Max:
|
||||
variables: {key: max, tmdb_key: "1899", weight: 130}
|
||||
variables: {key: max, tmdb_key: 1899, weight: 130}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
||||
Crunchyroll:
|
||||
variables: {key: crunchyroll, tmdb_key: "283", weight: 120, allowed_libraries: show}
|
||||
variables: {key: crunchyroll, tmdb_key: 283, weight: 120, allowed_libraries: show}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
||||
YouTube:
|
||||
variables: {key: youtube, tmdb_key: "188", weight: 110}
|
||||
variables: {key: youtube, tmdb_key: 188, weight: 110}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
||||
Hulu:
|
||||
variables: {key: hulu, tmdb_key: "15", weight: 100}
|
||||
variables: {key: hulu, tmdb_key: 15, weight: 100}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
||||
Paramount:
|
||||
variables: {key: paramount, tmdb_key: "531", weight: 90}
|
||||
variables: {key: paramount, tmdb_key: 531, weight: 90}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
||||
AppleTV:
|
||||
variables: {key: appletv, tmdb_key: "350", weight: 80}
|
||||
variables: {key: appletv, tmdb_key: 350, weight: 80}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
||||
Peacock:
|
||||
variables: {key: peacock, tmdb_key: "387", weight: 70}
|
||||
variables: {key: peacock, tmdb_key: 387, weight: 70}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
||||
Showtime:
|
||||
variables: {key: showtime, tmdb_key: "37", weight: 60}
|
||||
variables: {key: showtime, tmdb_key: 37, weight: 60}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
||||
discovery+:
|
||||
variables: {key: discovery, tmdb_key: "510", weight: 58, allowed_libraries: show}
|
||||
variables: {key: discovery, tmdb_key: 510, weight: 58, allowed_libraries: show}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
||||
Crave:
|
||||
variables: {key: crave, tmdb_key: "230", weight: 55}
|
||||
variables: {key: crave, tmdb_key: 230, weight: 55}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
||||
NOW:
|
||||
variables: {key: now, tmdb_key: "39", weight: 50}
|
||||
variables: {key: now, tmdb_key: 39, weight: 50}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
||||
All 4:
|
||||
variables: {key: all4, tmdb_key: "103", weight: 40}
|
||||
variables: {key: all4, tmdb_key: 103, weight: 40}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
||||
britbox:
|
||||
variables: {key: britbox, tmdb_key: "151", weight: 30}
|
||||
variables: {key: britbox, tmdb_key: 151, weight: 30}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
||||
BET+:
|
||||
variables: {key: bet, tmdb_key: "1759", weight: 20}
|
||||
variables: {key: bet, tmdb_key: 1759, weight: 20}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
||||
hayu:
|
||||
variables: {key: hayu, tmdb_key: "223", weight: 10, allowed_libraries: show}
|
||||
variables: {key: hayu, tmdb_key: 223, weight: 10, allowed_libraries: show}
|
||||
template: [name: standard, name: mdb_streaming]
|
||||
|
|
|
@ -1002,20 +1002,22 @@ The available setting attributes which can be set at each level are outlined bel
|
|||
<table class="clearTable">
|
||||
<tr><td>`jpg`</td><td>Use JPG files for saving Overlays</td></tr>
|
||||
<tr><td>`png`</td><td>Use PNG files for saving Overlays</td></tr>
|
||||
<tr><td>`webp`</td><td>Use WEBP files for saving Overlays</td></tr>
|
||||
</table>
|
||||
|
||||
**Default Value:** `jpg`
|
||||
|
||||
???+ example "Example"
|
||||
|
||||
```yaml
|
||||
```yaml
|
||||
settings:
|
||||
overlay_filetype: png
|
||||
```
|
||||
|
||||
??? blank "`overlay_quality` - Used to control the JPG quality used with overlay images.<a class="headerlink" href="#overlay-quality" title="Permanent link">¶</a>"
|
||||
??? blank "`overlay_quality` - Used to control the JPG or WEBP quality used with overlay images.<a class="headerlink" href="#overlay-quality" title="Permanent link">¶</a>"
|
||||
|
||||
<div id="overlay-quality" />Used to control the JPG quality used with overlay images.
|
||||
<div id="overlay-quality" />Used to control the JPG or WEBP quality used with overlay images.
|
||||
|
||||
<hr style="margin: 0px;">
|
||||
|
||||
|
|
|
@ -898,10 +898,10 @@
|
|||
},
|
||||
"overlay_filetype": {
|
||||
"description": "Used to control the filetype used with overlay images.",
|
||||
"enum": ["jpg", "png"]
|
||||
"enum": ["jpg", "png", "webp"]
|
||||
},
|
||||
"overlay_quality": {
|
||||
"description": "Used to control the JPG quality used with overlay images.",
|
||||
"description": "Used to control the JPG or WEBP quality used with overlay images.",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 100
|
||||
|
|
|
@ -43,7 +43,8 @@ run_order_options = {
|
|||
sync_modes = {"append": "Only Add Items to the Collection or Playlist", "sync": "Add & Remove Items from the Collection or Playlist"}
|
||||
filetype_list = {
|
||||
"jpg": "Use JPG files for saving Overlays",
|
||||
"png": "Use PNG files for saving Overlays"
|
||||
"png": "Use PNG files for saving Overlays",
|
||||
"webp": "Use WEBP files for saving Overlays"
|
||||
}
|
||||
imdb_label_options = {
|
||||
"remove": "Remove All IMDb Parental Labels",
|
||||
|
|
|
@ -61,7 +61,8 @@ class Overlays:
|
|||
logger.ghost(f"Restoring: {i}/{len(remove_overlays)} {item_title}")
|
||||
self.remove_overlay(item, item_title, "Overlay", [
|
||||
os.path.join(self.library.overlay_backup, f"{item.ratingKey}.png"),
|
||||
os.path.join(self.library.overlay_backup, f"{item.ratingKey}.jpg")
|
||||
os.path.join(self.library.overlay_backup, f"{item.ratingKey}.jpg"),
|
||||
os.path.join(self.library.overlay_backup, f"{item.ratingKey}.webp")
|
||||
])
|
||||
logger.exorcise()
|
||||
else:
|
||||
|
@ -176,11 +177,15 @@ class Overlays:
|
|||
os.remove(os.path.join(self.library.overlay_backup, f"{item.ratingKey}.png"))
|
||||
if os.path.exists(os.path.join(self.library.overlay_backup, f"{item.ratingKey}.jpg")):
|
||||
os.remove(os.path.join(self.library.overlay_backup, f"{item.ratingKey}.jpg"))
|
||||
if os.path.exists(os.path.join(self.library.overlay_backup, f"{item.ratingKey}.webp")):
|
||||
os.remove(os.path.join(self.library.overlay_backup, f"{item.ratingKey}.webp"))
|
||||
elif has_overlay:
|
||||
if os.path.exists(os.path.join(self.library.overlay_backup, f"{item.ratingKey}.png")):
|
||||
has_original = os.path.join(self.library.overlay_backup, f"{item.ratingKey}.png")
|
||||
elif os.path.exists(os.path.join(self.library.overlay_backup, f"{item.ratingKey}.jpg")):
|
||||
has_original = os.path.join(self.library.overlay_backup, f"{item.ratingKey}.jpg")
|
||||
elif os.path.exists(os.path.join(self.library.overlay_backup, f"{item.ratingKey}.webp")):
|
||||
has_original = os.path.join(self.library.overlay_backup, f"{item.ratingKey}.webp")
|
||||
if self.library.reset_overlays:
|
||||
reset_list = self.library.reset_overlays
|
||||
elif has_original is None and not self.library.reset_overlays:
|
||||
|
@ -508,7 +513,7 @@ class Overlays:
|
|||
overlay_box = current_overlay.get_coordinates((canvas_width, canvas_height), box=current_overlay.image.size, new_cords=cord)
|
||||
new_poster.paste(current_overlay.image, overlay_box, current_overlay.image)
|
||||
temp = os.path.join(self.library.overlay_folder, f"temp.{self.library.overlay_filetype}")
|
||||
if self.library.overlay_filetype == "jpg" and self.library.overlay_quality:
|
||||
if self.library.overlay_quality and self.library.overlay_filetype in ["jpg", "webp"]:
|
||||
new_poster.save(temp, exif=exif_tags, quality=self.library.overlay_quality)
|
||||
else:
|
||||
new_poster.save(temp, exif=exif_tags)
|
||||
|
|
|
@ -1350,7 +1350,7 @@ class Plex(Library):
|
|||
elif self.show_missing_assets:
|
||||
logger.warning(f"Asset Warning: No poster or background found in the assets folder '{item_dir}'")
|
||||
else:
|
||||
logger.warning(f"Asset Warning: {name} has an Overlay and will be updated when overlays are run")
|
||||
logger.info(f"Item: {name} has an Overlay and will be updated when overlays are run")
|
||||
except Failed as e:
|
||||
if self.show_missing_assets:
|
||||
logger.warning(e)
|
||||
|
|
Loading…
Reference in a new issue