From a4315fe6428f462ade5390d645d1733a0eca5dcc Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Tue, 8 Aug 2023 16:16:53 -0400 Subject: [PATCH] [82] update ratings overlay with extra attribute --- VERSION | 2 +- defaults/overlays/ratings.yml | 11 ++++--- docs/defaults/overlays/ratings.md | 55 ++++++++++++++++--------------- docs/metadata/overlay.md | 6 ++-- modules/overlay.py | 6 ++-- modules/overlays.py | 4 +-- 6 files changed, 44 insertions(+), 40 deletions(-) diff --git a/VERSION b/VERSION index 2f20c50f..e6aff99b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.19.0-develop81 +1.19.0-develop82 diff --git a/defaults/overlays/ratings.yml b/defaults/overlays/ratings.yml index 0f0e21d0..9b0ebb1e 100644 --- a/defaults/overlays/ratings.yml +++ b/defaults/overlays/ratings.yml @@ -102,12 +102,15 @@ templates: rating<>_style: default: "" conditions: - - rating<>_image: [rt_popcorn, rt_tomato, tmdb] + - rating<>_image: [rt_popcorn, rt_tomato, tmdb, metacritic, mdb] value: "%" - - rating<>_image: [metacritic, mdb] - value: "0" - rating<>_image: [letterboxd] value: "/" + rating<>_extra: + default: "" + conditions: + - rating<>_image: [rt_popcorn, rt_tomato, tmdb] + value: "%" image_extra: default: "" conditions: @@ -451,7 +454,7 @@ templates: run_definition: <> ignore_blank_results: true overlay: - name: text(<<<>>>_rating<>_style>>>>) + name: text(<<<>>>_rating<>_style>>>><>_extra>>) file: <>_file>> url: <>_url>> git: <>_git>> diff --git a/docs/defaults/overlays/ratings.md b/docs/defaults/overlays/ratings.md index 05f6600c..6c51e9fa 100644 --- a/docs/defaults/overlays/ratings.md +++ b/docs/defaults/overlays/ratings.md @@ -84,32 +84,35 @@ All [Shared Overlay Variables](../overlay_variables) can be appended by `rating1 | `back_radius` | `30` | | `back_height` | `105` | -| Variable | Description & Values | -|:-----------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `rating1` | **Description:** Choose the rating to display in rating1.
**Values:** `critic`, `audience`, or `user` | -| `rating1_image` | **Description:** Choose the rating image to display in rating1.
**Values:** `anidb`, `imdb`, `letterboxd`, `tmdb`, `metacritic`, `rt_popcorn`, `rt_tomato`, `trakt`, `mal`, `mdb`, or `star` | -| `rating1_style` | **Description:** Choose the rating number style for rating1.
**Values:**
Ten Scale""8.7, 9.0
Ten Scale removing .0 "#"8.7, 9
Hundred Scale"0"87, 90
Hundred Scale with % "%"87%, 90%
Five Scale"/"8.6 rating in plex will show as 4.3 on the overlay
| -| `rating2` | **Description:** Choose the rating to display in rating2.
**Values:** `critic`, `audience`, or `user` | -| `rating2_image` | **Description:** Choose the rating image to display in rating2.
**Values:** `anidb`, `imdb`, `letterboxd`, `tmdb`, `metacritic`, `rt_popcorn`, `rt_tomato`, `trakt`, `mal`, `mdb`, or `star` | -| `rating2_style` | **Description:** Choose the rating number style for rating2.
**Values:**
Ten Scale""8.7, 9.0
Ten Scale removing .0 "#"8.7, 9
Hundred Scale"0"87, 90
Hundred Scale with % "%"87%, 90%
Five Scale"/"8.6 rating in plex will show as 4.3 on the overlay
| -| `rating3` | **Description:** Choose the rating to display in rating3.
**Values:** `critic`, `audience`, or `user` | -| `rating3_image` | **Description:** Choose the rating image to display in rating3.
**Values:** `anidb`, `imdb`, `letterboxd`, `tmdb`, `metacritic`, `rt_popcorn`, `rt_tomato`, `trakt`, `mal`, `mdb`, or `star` | -| `rating3_style` | **Description:** Choose the rating number style for rating3.
**Values:**
Ten Scale""8.7, 9.0
Ten Scale removing .0 "#"8.7, 9
Hundred Scale"0"87, 90
Hundred Scale with % "%"87%, 90%
Five Scale"/"8.6 rating in plex will show as 4.3 on the overlay
| -| `horizontal_position` | **Description:** Choose the horizontal position for the rating group.
**Default:** `left`
**Values:** `left`, `right`, or `center` | -| `vertical_position` | **Description:** Choose the vertical position for the rating group.
**Default:** `center`
**Values:** `top`, `bottom`, or `center` | -| `rating_alignment` | **Description:** Choose the display alignment for the rating group.
**Default:** `vertical`
**Values:** `horizontal`, or `vertical` | -| `minimum_rating` | **Description:** Minimum Rating to display
**Default:** 0.0
**Values:** Any Number | -| `fresh_rating` | **Description:** Determines when ratings are considered Fresh
**Default:** 6.0
**Values:** Any Number | -| `maximum_rating` | **Description:** Maximum Rating to display
**Default:** 10.0
**Values:** Any Number | -| `font`1 | **Description:** Choose the font for the Overlay.
**Default:** `fonts/Inter-Bold.ttf`
**Values:** Path to font file | -| `font_style`1 | **Description:** Font style for Variable Fonts.
**Values:** Variable Font Style | -| `font_size`1 | **Description:** Choose the font size for the Overlay.
**Default:** `63`
**Values:** Any Number greater then 0 | -| `font_color`1 | **Description:** Choose the font color for the Overlay.
**Default:** `#FFFFFF`
**Values:** Color Hex Code in format `#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA` | -| `stroke_width`1 | **Description:** Font Stroke Width for the Text Overlay.
**Values:** Any Number greater then 0 | -| `stroke_color`1 | **Description:** Font Stroke Color for the Text Overlay.
**Values:** Color Hex Code in format `#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA` | -| `addon_offset`1 | **Description:** Text Addon Image Offset from the text.
**Default:** `15`
**Values:** Any Number greater then 0 | -| `addon_position`1 | **Description:** Text Addon Image Alignment in relation to the text.
**Default:** `left`
**Values:** `left`, `right`, `top`, `bottom` | -| `builder_level` | **Description:** Choose the Overlay Level.
**Values:** `episode` | +| Variable | Description & Values | +|:-----------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `rating1` | **Description:** Choose the rating to display in rating1.
**Values:** `critic`, `audience`, or `user` | +| `rating1_image` | **Description:** Choose the rating image to display in rating1.
**Values:** `anidb`, `imdb`, `letterboxd`, `tmdb`, `metacritic`, `rt_popcorn`, `rt_tomato`, `trakt`, `mal`, `mdb`, or `star` | +| `rating1_style` | **Description:** Choose the rating number style for rating1.
**Values:**
Ten Scale""8.7, 9.0
Ten Scale removing .0 "#"8.7, 9
Hundred Scale"0"87, 90
Five Scale"/"8.6 rating in plex will show as 4.3 on the overlay
| +| `rating1_extra` | **Description:** Extra text after rating1.
**Default:** `%` for `rt_popcorn`, `rt_tomato`, `tmdb`.
**Values:** Any Value | +| `rating2` | **Description:** Choose the rating to display in rating2.
**Values:** `critic`, `audience`, or `user` | +| `rating2_image` | **Description:** Choose the rating image to display in rating2.
**Values:** `anidb`, `imdb`, `letterboxd`, `tmdb`, `metacritic`, `rt_popcorn`, `rt_tomato`, `trakt`, `mal`, `mdb`, or `star` | +| `rating2_style` | **Description:** Choose the rating number style for rating2.
**Values:**
Ten Scale""8.7, 9.0
Ten Scale removing .0 "#"8.7, 9
Hundred Scale"0"87, 90
Five Scale"/"8.6 rating in plex will show as 4.3 on the overlay
| +| `rating2_extra` | **Description:** Extra text after rating2.
**Default:** `%` for `rt_popcorn`, `rt_tomato`, `tmdb`.
**Values:** Any Value | +| `rating3` | **Description:** Choose the rating to display in rating3.
**Values:** `critic`, `audience`, or `user` | +| `rating3_image` | **Description:** Choose the rating image to display in rating3.
**Values:** `anidb`, `imdb`, `letterboxd`, `tmdb`, `metacritic`, `rt_popcorn`, `rt_tomato`, `trakt`, `mal`, `mdb`, or `star` | +| `rating3_style` | **Description:** Choose the rating number style for rating3.
**Values:**
Ten Scale""8.7, 9.0
Ten Scale removing .0 "#"8.7, 9
Hundred Scale"0"87, 90
Five Scale"/"8.6 rating in plex will show as 4.3 on the overlay
| +| `rating3_extra` | **Description:** Extra text after rating3.
**Default:** `%` for `rt_popcorn`, `rt_tomato`, `tmdb`.
**Values:** Any Value | +| `horizontal_position` | **Description:** Choose the horizontal position for the rating group.
**Default:** `left`
**Values:** `left`, `right`, or `center` | +| `vertical_position` | **Description:** Choose the vertical position for the rating group.
**Default:** `center`
**Values:** `top`, `bottom`, or `center` | +| `rating_alignment` | **Description:** Choose the display alignment for the rating group.
**Default:** `vertical`
**Values:** `horizontal`, or `vertical` | +| `minimum_rating` | **Description:** Minimum Rating to display
**Default:** 0.0
**Values:** Any Number | +| `fresh_rating` | **Description:** Determines when ratings are considered Fresh
**Default:** 6.0
**Values:** Any Number | +| `maximum_rating` | **Description:** Maximum Rating to display
**Default:** 10.0
**Values:** Any Number | +| `font`1 | **Description:** Choose the font for the Overlay.
**Default:** `fonts/Inter-Bold.ttf`
**Values:** Path to font file | +| `font_style`1 | **Description:** Font style for Variable Fonts.
**Values:** Variable Font Style | +| `font_size`1 | **Description:** Choose the font size for the Overlay.
**Default:** `63`
**Values:** Any Number greater then 0 | +| `font_color`1 | **Description:** Choose the font color for the Overlay.
**Default:** `#FFFFFF`
**Values:** Color Hex Code in format `#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA` | +| `stroke_width`1 | **Description:** Font Stroke Width for the Text Overlay.
**Values:** Any Number greater then 0 | +| `stroke_color`1 | **Description:** Font Stroke Color for the Text Overlay.
**Values:** Color Hex Code in format `#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA` | +| `addon_offset`1 | **Description:** Text Addon Image Offset from the text.
**Default:** `15`
**Values:** Any Number greater then 0 | +| `addon_position`1 | **Description:** Text Addon Image Alignment in relation to the text.
**Default:** `left`
**Values:** `left`, `right`, `top`, `bottom` | +| `builder_level` | **Description:** Choose the Overlay Level.
**Values:** `episode` | 1. These Variables can be appended by `rating1_`, `rating2_`, or `rating3_` to change that attribute on each rating individually. diff --git a/docs/metadata/overlay.md b/docs/metadata/overlay.md index 3883206d..9726dd44 100644 --- a/docs/metadata/overlay.md +++ b/docs/metadata/overlay.md @@ -201,9 +201,9 @@ There are multiple Special Text Variables that can be used when formatting the t | Special Text Variables & Mods | Movies | Shows | Seasons | Episodes | |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:| -| `<>`: audience rating (`8.7`, `9.0`)
`<>`: audience rating out of 100 (`87`, `90`)
`<>`: audience rating out of 100 ending with `%` (`87%`, `90%`)
`<>`: audience rating removing `.0` as needed (`8.7`, `9`)
`<>`: audience rating on a 5 point scale (`8.6` shows as `4.3`) | ✅ | ✅ | ❌ | ✅ | -| `<>`: critic rating (`8.7`, `9.0`)
`<>`: critic rating out of 100 (`87`, `90`)
`<>`: critic rating out of 100 ending with `%` (`87%`, `90%`)
`<>`: critic rating removing `.0` as needed (`8.7`, `9`)
`<>`: critic rating on a 5 point scale (`8.6` shows as `4.3`) | ✅ | ✅ | ❌ | ✅ | -| `<>`: user rating (`8.7`, `9.0`)
`<>`: user rating out of 100 (`87`, `90`)
`<>`: user rating out of 100 ending with `%` (`87%`, `90%`)
`<>`: user rating removing `.0` as needed (`8.7`, `9`)
`<>`: user rating on a 5 point scale (`8.6` shows as `4.3`) | ✅ | ✅ | ✅ | ✅ | +| `<>`: audience rating (`8.7`, `9.0`)
`<>`: audience rating out of 100 (`87`, `90`)
`<>`: audience rating removing `.0` as needed (`8.7`, `9`)
`<>`: audience rating on a 5 point scale (`8.6` shows as `4.3`) | ✅ | ✅ | ❌ | ✅ | +| `<>`: critic rating (`8.7`, `9.0`)
`<>`: critic rating out of 100 (`87`, `90`)
`<>`: critic rating removing `.0` as needed (`8.7`, `9`)
`<>`: critic rating on a 5 point scale (`8.6` shows as `4.3`) | ✅ | ✅ | ❌ | ✅ | +| `<>`: user rating (`8.7`, `9.0`)
`<>`: user rating out of 100 (`87`, `90`)
`<>`: user rating removing `.0` as needed (`8.7`, `9`)
`<>`: user rating on a 5 point scale (`8.6` shows as `4.3`) | ✅ | ✅ | ✅ | ✅ | | `<>`: Title of the Item<br>`<<titleU>>`: Uppercase Title of the Item<br>`<<titleL>>`Lowercase Title of the Item<br>`<<titleP>>`Proper Title of the Item | ✅ | ✅ | ✅ | ✅ | | `<<show_title>>`: Title of the Item's Show<br>`<<show_itleU>>`: Uppercase Title of the Item's Show<br>`<<show_titleL>>`Lowercase Title of the Item's Show<br>`<<show_titleP>>`Proper Title of the Item's Show | ❌ | ❌ | ✅ | ✅ | | `<<season_title>>`: Title of the Item's Season<br>`<<season_titleU>>`: Uppercase Title of the Item's Season<br>`<<season_titleL>>`Lowercase title of the Item's Season<br>`<<season_titleP>>`Proper title of the Item's Season | ❌ | ❌ | ❌ | ✅ | diff --git a/modules/overlay.py b/modules/overlay.py index 53acabc6..1c2a7243 100644 --- a/modules/overlay.py +++ b/modules/overlay.py @@ -34,9 +34,9 @@ var_mods = { "show_title": ["", "U", "L", "P"], "season_title": ["", "U", "L", "P"], "bitrate": ["", "H", "L"], - "user_rating": ["", "%", "#", "/", "0"], - "critic_rating": ["", "%", "#", "/", "0"], - "audience_rating": ["", "%", "#", "/", "0"], + "user_rating": ["", "%", "#", "/"], + "critic_rating": ["", "%", "#", "/"], + "audience_rating": ["", "%", "#", "/"], "originally_available": ["", "["], "runtime": ["", "H", "M"], "season_number": ["", "W", "WU", "WL", "0", "00"], diff --git a/modules/overlays.py b/modules/overlays.py index b3826aa9..4b0f90fd 100644 --- a/modules/overlays.py +++ b/modules/overlays.py @@ -259,13 +259,11 @@ class Overlays: else: final_value = int(actual_value / 60000) elif mod == "%": - final_value = f"{int(actual_value * 10)}%" + final_value = int(actual_value * 10) elif mod == "#": final_value = str(actual_value)[:-2] if str(actual_value).endswith(".0") else actual_value elif mod == "/": final_value = f"{float(actual_value) / 2:.1f}" - elif mod == "0" and format_var in ["audience_rating", "critic_rating", "user_rating"]: - final_value = int(actual_value * 10) elif mod == "W": final_value = num2words(int(actual_value)) elif mod == "WU":