Skip to content

Commit

Permalink
Merge branch 'overlayquality' into nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
YozoraXCII committed May 1, 2024
2 parents 860e194 + ef3073b commit 799a17d
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Removed Features

# New Features
Added `overlay_filetype` and `overlay_quality` settings to control the filetype and quality of overlay images. Users can select from JPG, PNG and WEBP.
Added `overlay_artwork_filetype` and `overlay_artwork_quality` settings to control the filetype and quality of overlay images. Users can select from JPG, PNG and WEBP.

# Updates

Expand Down
4 changes: 2 additions & 2 deletions config/config.yml.template
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ settings:
playlist_report: false
verify_ssl: true
custom_repo:
overlay_filetype: jpg
overlay_quality: 75
overlay_artwork_filetype: jpg
overlay_artwork_quality: 75
webhooks: # Can be individually specified per library as well
error:
version:
Expand Down
12 changes: 6 additions & 6 deletions docs/config/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -987,13 +987,13 @@ The available setting attributes which can be set at each level are outlined bel
custom_repo: https://github.com/Kometa-Team/Community-Configs/tree/master/meisnate12
```

??? blank "`overlay_filetype` - Used to control the filetype used with overlay images.<a class="headerlink" href="#overlay-filetype" title="Permanent link">¶</a>"
??? blank "`overlay_artwork_filetype` - Used to control the filetype used with overlay images.<a class="headerlink" href="#overlay-filetype" title="Permanent link">¶</a>"

<div id="overlay-filetype" />Used to control the filetype used with overlay images.

<hr style="margin: 0px;">

**Attribute:** `overlay_filetype`
**Attribute:** `overlay_artwork_filetype`

**Levels with this Attribute:** Global/Library

Expand All @@ -1012,16 +1012,16 @@ The available setting attributes which can be set at each level are outlined bel
```yaml
```yaml
settings:
overlay_filetype: png
overlay_artwork_filetype: png
```

??? 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>"
??? blank "`overlay_artwork_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 or WEBP quality used with overlay images.

<hr style="margin: 0px;">

**Attribute:** `overlay_quality`
**Attribute:** `overlay_artwork_quality`

**Levels with this Attribute:** Global/Library

Expand All @@ -1033,7 +1033,7 @@ The available setting attributes which can be set at each level are outlined bel
```yaml
settings:
overlay_quality: 95
overlay_artwork_quality: 95
```

## Default Values
Expand Down
4 changes: 2 additions & 2 deletions json-schema/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -896,11 +896,11 @@
}
]
},
"overlay_filetype": {
"overlay_artwork_filetype": {
"description": "Used to control the filetype used with overlay images.",
"enum": ["jpg", "png", "webp"]
},
"overlay_quality": {
"overlay_artwork_quality": {
"description": "Used to control the JPG or WEBP quality used with overlay images.",
"type": "integer",
"minimum": 1,
Expand Down
4 changes: 2 additions & 2 deletions json-schema/prototype_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,8 @@ settings:
playlist_report: false
verify_ssl: true
custom_repo:
overlay_filetype: jpg
overlay_quality: jpg
overlay_artwork_filetype: jpg
overlay_artwork_quality: jpg
webhooks: # Can be individually specified per library as well
error:
version:
Expand Down
8 changes: 4 additions & 4 deletions modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ def check_for_attribute(data, attribute, parent=None, test_list=None, default=No
"playlist_report": check_for_attribute(self.data, "playlist_report", parent="settings", var_type="bool", default=True),
"verify_ssl": check_for_attribute(self.data, "verify_ssl", parent="settings", var_type="bool", default=True),
"custom_repo": check_for_attribute(self.data, "custom_repo", parent="settings", default_is_none=True),
"overlay_filetype": check_for_attribute(self.data, "overlay_filetype", parent="settings", test_list=filetype_list, default="jpg"),
"overlay_quality": check_for_attribute(self.data, "overlay_quality", parent="settings", var_type="int", default_is_none=True, int_min=1, int_max=100),
"overlay_artwork_filetype": check_for_attribute(self.data, "overlay_artwork_filetype", parent="settings", test_list=filetype_list, default="jpg"),
"overlay_artwork_quality": check_for_attribute(self.data, "overlay_artwork_quality", parent="settings", var_type="int", default_is_none=True, int_min=1, int_max=100),
"assets_for_all": check_for_attribute(self.data, "assets_for_all", parent="settings", var_type="bool", default=False, save=False, do_print=False)
}
self.custom_repo = None
Expand Down Expand Up @@ -858,8 +858,8 @@ def check_for_attribute(data, attribute, parent=None, test_list=None, default=No
params["ignore_ids"].extend([i for i in self.general["ignore_ids"] if i not in params["ignore_ids"]])
params["ignore_imdb_ids"] = check_for_attribute(lib, "ignore_imdb_ids", parent="settings", var_type="lower_list", default_is_none=True, do_print=False, save=False)
params["ignore_imdb_ids"].extend([i for i in self.general["ignore_imdb_ids"] if i not in params["ignore_imdb_ids"]])
params["overlay_filetype"] = check_for_attribute(lib, "overlay_filetype", parent="settings", test_list=filetype_list, default=self.general["overlay_filetype"], do_print=False, save=False)
params["overlay_quality"] = check_for_attribute(lib, "overlay_quality", parent="settings", var_type="int", default=self.general["overlay_quality"], default_is_none=True, int_min=1, int_max=100, do_print=False, save=False)
params["overlay_artwork_filetype"] = check_for_attribute(lib, "overlay_artwork_filetype", parent="settings", test_list=filetype_list, default=self.general["overlay_artwork_filetype"], do_print=False, save=False)
params["overlay_artwork_quality"] = check_for_attribute(lib, "overlay_artwork_quality", parent="settings", var_type="int", default=self.general["overlay_artwork_quality"], default_is_none=True, int_min=1, int_max=100, do_print=False, save=False)
params["changes_webhooks"] = check_for_attribute(lib, "changes", parent="webhooks", var_type="list", default=self.webhooks["changes"], do_print=False, save=False, default_is_none=True)
params["report_path"] = None
if lib and "report_path" in lib and lib["report_path"]:
Expand Down
4 changes: 2 additions & 2 deletions modules/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ def __init__(self, config, params):
self.only_filter_missing = params["only_filter_missing"]
self.ignore_ids = params["ignore_ids"]
self.ignore_imdb_ids = params["ignore_imdb_ids"]
self.overlay_quality = params["overlay_quality"]
self.overlay_filetype = params["overlay_filetype"]
self.overlay_artwork_quality = params["overlay_artwork_quality"]
self.overlay_artwork_filetype = params["overlay_artwork_filetype"]
self.assets_for_all = params["assets_for_all"]
self.assets_for_all_collections = False
self.delete_collections = params["delete_collections"]
Expand Down
6 changes: 3 additions & 3 deletions modules/overlays.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,9 @@ def get_text(text_overlay):
else:
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_quality and self.library.overlay_filetype in ["jpg", "webp"]:
new_poster.save(temp, exif=exif_tags, quality=self.library.overlay_quality)
temp = os.path.join(self.library.overlay_folder, f"temp.{self.library.overlay_artwork_filetype}")
if self.library.overlay_artwork_quality and self.library.overlay_artwork_filetype in ["jpg", "webp"]:
new_poster.save(temp, exif=exif_tags, quality=self.library.overlay_artwork_quality)
else:
new_poster.save(temp, exif=exif_tags)
self.library.upload_poster(item, temp)
Expand Down

0 comments on commit 799a17d

Please sign in to comment.