[8] add overlay_filetype and overlay_quality settings

This commit is contained in:
meisnate12 2024-04-30 09:54:20 -04:00
parent d0511196f1
commit abe6e4c841
10 changed files with 98 additions and 32 deletions

View file

@ -1,26 +1,17 @@
# Plex Meta Manager is now rebranded as Kometa!
# Requirements Update (requirements will need to be reinstalled)
Updated arrapi requirement to 1.4.13
Updated PlexAPI requirement to 4.15.12
Updated setuptools requirement to 69.5.1
Updated tmdbapis requirement to 1.2.16
# Removed Features
# New Features
Add Page Topics Options to `imdb_search`
Add `lxml` Docker Version using an old lxml version that supports more cpus
Added `overlay_filetype` and `overlay_quality` settings to control the filetype and quality of overlay images.
# Updates
Add `use_all` template variable to default collections, which allows all collections to be disabled with one variable.
Let conditional `.not` and `.exists` work with default variables
Added `starting_only` template variable to the `mal` Collection Default.
# Defaults
# Bug Fixes
Fixes #1965 `download_url_assets` was causing `url_background` to upload as a poster
Fixes #1969 Ignore validating TPDb links
Catch bad ID data from Plex
Fixes `- git` file calls
Various other Minor Fixes

View file

@ -1 +1 @@
2.0.0-develop7
2.0.0-develop8

View file

@ -74,6 +74,8 @@ settings:
playlist_report: false
verify_ssl: true
custom_repo:
overlay_filetype: jpg
overlay_quality: 75
webhooks: # Can be individually specified per library as well
error:
version:

View file

@ -935,6 +935,31 @@ The available setting attributes which can be set at each level are outlined bel
- metadata
```
??? blank "`verify_ssl` - Turn SSL Verification on or off.<a class="headerlink" href="#verify-ssl" title="Permanent link"></a>"
<div id="verify-ssl" />Turn SSL Verification on or off.
???+ note
set to false if your log file shows any errors similar to "SSL: CERTIFICATE_VERIFY_FAILED"
<hr style="margin: 0px;">
**Attribute:** `verify_ssl`
**Levels with this Attribute:** Global
**Accepted Values:** `true` or `false`
**Default Value:** `true`
???+ example "Example"
```yaml
settings:
verify_ssl: false
```
??? blank "`custom_repo` - Used to set up the custom `repo` [file block type](files.md#location-types-and-paths).<a class="headerlink" href="#custom-repo" title="Permanent link"></a>"
<div id="custom-repo" />Specify where the `repo` attribute's base is when defining `collection_files`,
@ -962,29 +987,51 @@ 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 "`verify_ssl` - Turn SSL Verification on or off.<a class="headerlink" href="#verify-ssl" title="Permanent link"></a>"
??? blank "`overlay_filetype` - Used to control the filetype used with overlay images.<a class="headerlink" href="#overlay-filetype" title="Permanent link"></a>"
<div id="verify-ssl" />Turn SSL Verification on or off.
???+ note
set to false if your log file shows any errors similar to "SSL: CERTIFICATE_VERIFY_FAILED"
<div id="overlay-filetype" />Used to control the filetype used with overlay images.
<hr style="margin: 0px;">
**Attribute:** `verify_ssl`
**Attribute:** `overlay_filetype`
**Levels with this Attribute:** Global
**Levels with this Attribute:** Global/Library
**Accepted Values:** `true` or `false`
**Accepted Values:**
**Default Value:** `true`
<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>
</table>
**Default Value:** `jpg`
???+ example "Example"
```yaml
settings:
verify_ssl: false
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>"
<div id="overlay-quality" />Used to control the JPG quality used with overlay images.
<hr style="margin: 0px;">
**Attribute:** `overlay_quality`
**Levels with this Attribute:** Global/Library
**Accepted Values:** Any Integer 1-100
**Default Value:** `75`
???+ example "Example"
```yaml
settings:
overlay_quality: 95
```
## Default Values

View file

@ -53,7 +53,7 @@ work. Any value not specified will use its default value if it has one if not it
| `limit` | **Description:** Changes the Builder Limit for all collections in a Defaults file.<br>**Default:** `100`<br>**Values:** Number greater than 0 |
| `limit_<<key>>`<sup>1</sup> | **Description:** Changes the Builder Limit of the specified key's collection.<br>**Default:** `limit`<br>**Values:** Number greater than 0 |
| `sync_mode` | **Description:** Changes the Sync Mode for all collections in a Defaults file.<br>**Default:** `sync`<br>**Values:**<table class="clearTable"><tr><td>`sync`</td><td>Add and Remove Items based on Builders</td></tr><tr><td>`append`</td><td>Only Add Items based on Builders</td></tr></table> |
| `starting_only` | **Description** Changes the season collection to only use anime listed under the new section on [MAL Seasons](https://myanimelist.net/anime/season/)<br>**Default:** `False`<br>**Values:** `True` or `False` |
| `starting_only` | **Description:** Changes the season collection to only use anime listed under the new section on [MAL Seasons](https://myanimelist.net/anime/season/)<br>**Default:** `False`<br>**Values:** `True` or `False` |
| `sync_mode_<<key>>`<sup>1</sup> | **Description:** Changes the Sync Mode of the specified key's collection.<br>**Default:** `sync_mode`<br>**Values:**<table class="clearTable"><tr><td>`sync`</td><td>Add and Remove Items based on Builders</td></tr><tr><td>`append`</td><td>Only Add Items based on Builders</td></tr></table> |
| `collection_order` | **Description:** Changes the Collection Order for all collections in a Defaults file.<br>**Default:** `custom`<br>**Values:**<table class="clearTable"><tr><td>`release`</td><td>Order Collection by Release Dates</td></tr><tr><td>`alpha`</td><td>Order Collection Alphabetically</td></tr><tr><td>`custom`</td><td>Order Collection Via the Builder Order</td></tr><tr><td>[Any `plex_search` Sort Option](../../files/builders/plex.md#sort-options)</td><td>Order Collection by any `plex_search` Sort Option</td></tr></table> |
| `collection_order_<<key>>`<sup>1</sup> | **Description:** Changes the Collection Order of the specified key's collection.<br>**Default:** `collection_order`<br>**Values:**<table class="clearTable"><tr><td>`release`</td><td>Order Collection by Release Dates</td></tr><tr><td>`alpha`</td><td>Order Collection Alphabetically</td></tr><tr><td>`custom`</td><td>Order Collection Via the Builder Order</td></tr><tr><td>[Any `plex_search` Sort Option](../../files/builders/plex.md#sort-options)</td><td>Order Collection by any `plex_search` Sort Option</td></tr></table> |

View file

@ -895,6 +895,16 @@
"type": "string"
}
]
},
"overlay_filetype": {
"description": "Used to control the filetype used with overlay images.",
"enum": ["jpg", "png"]
},
"overlay_quality": {
"description": "Used to control the JPG quality used with overlay images.",
"type": "integer",
"minimum": 1,
"maximum": 100
}
},
"required": [

View file

@ -440,6 +440,8 @@ settings:
playlist_report: false
verify_ssl: true
custom_repo:
overlay_filetype: jpg
overlay_quality: jpg
webhooks: # Can be individually specified per library as well
error:
version:

View file

@ -41,6 +41,10 @@ run_order_options = {
"operations": "Represents Operations Updates"
}
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"
}
imdb_label_options = {
"remove": "Remove All IMDb Parental Labels",
"none": "Add IMDb Parental Labels for None, Mild, Moderate, or Severe",
@ -340,7 +344,7 @@ class ConfigFile:
if self.secrets:
check_next(self.data)
def check_for_attribute(data, attribute, parent=None, test_list=None, default=None, do_print=True, default_is_none=False, req_default=False, var_type="str", throw=False, save=True, int_min=0):
def check_for_attribute(data, attribute, parent=None, test_list=None, default=None, do_print=True, default_is_none=False, req_default=False, var_type="str", throw=False, save=True, int_min=0, int_max=None):
endline = ""
if parent is not None:
if data and parent in data:
@ -373,9 +377,10 @@ class ConfigFile:
if isinstance(data[attribute], bool): return data[attribute]
else: message = f"{text} must be either true or false"
elif var_type == "int":
if isinstance(data[attribute], bool): message = f"{text} must an integer >= {int_min}"
elif isinstance(data[attribute], int) and data[attribute] >= int_min: return data[attribute]
else: message = f"{text} must an integer >= {int_min}"
if isinstance(data[attribute], int) and data[attribute] >= int_min and (not int_max or data[attribute] <= int_max):
return data[attribute]
else:
message = f"{text} must an integer greater than or equal to {int_min}{f' and less than or equal to {int_max}'}"
elif var_type == "path":
if os.path.exists(os.path.abspath(data[attribute])): return data[attribute]
else: message = f"Path {os.path.abspath(data[attribute])} does not exist"
@ -472,6 +477,8 @@ class ConfigFile:
"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),
"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
@ -850,6 +857,8 @@ class ConfigFile:
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["delete_not_scheduled"], 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"]:

View file

@ -81,6 +81,8 @@ class Library(ABC):
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.assets_for_all = params["assets_for_all"]
self.assets_for_all_collections = False
self.delete_collections = params["delete_collections"]

View file

@ -507,8 +507,11 @@ class Overlays:
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, "temp.jpg")
new_poster.save(temp, exif=exif_tags)
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:
new_poster.save(temp, exif=exif_tags, quality=self.library.overlay_quality)
else:
new_poster.save(temp, exif=exif_tags)
self.library.upload_poster(item, temp)
self.library.edit_tags("label", item, add_tags=["Overlay"], do_print=False)
poster_compare = poster.compare if poster else item.thumb