[80] fix rating overlays

This commit is contained in:
meisnate12 2023-08-08 14:15:03 -04:00
parent 7826eeff46
commit d122a6af66
7 changed files with 42 additions and 38 deletions

View file

@ -1 +1 @@
1.19.0-develop79
1.19.0-develop80

View file

@ -106,6 +106,8 @@ templates:
value: "%"
- rating<<rating_num>>_image: [metacritic, mdb]
value: "0"
- rating<<rating_num>>_image: [letterboxd]
value: "/"
image_extra:
default: ""
conditions:
@ -449,7 +451,7 @@ templates:
run_definition: <<run_this>>
ignore_blank_results: true
overlay:
name: text(<<rating<<rating_num>>>>_rating<<rating<<rating_num>>_style>>)
name: text(<<<<rating<<rating_num>>>>_rating<<rating<<rating_num>>_style>>>>)
file: <<rating<<rating_num>>_file>>
url: <<rating<<rating_num>>_url>>
git: <<rating<<rating_num>>_git>>

View file

@ -84,32 +84,32 @@ 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.<br>**Values:** `critic`, `audience`, or `user` |
| `rating1_image` | **Description:** Choose the rating image to display in rating1.<br>**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.<br>**Values:** <table><tr><td>Ten Scale</td><td><code>""</code></td><td><code>8.7</code>, <code>9.0</code></td></tr><tr><td>Ten Scale removing <code>.0</code></td><td><code>"#"</code></td><td><code>8.7</code>, <code>9</code></td></tr><tr><td>Hundred Scale</td><td><code>"%"</code></td><td><code>87</code>, <code>90</code></td></tr><tr><td>Five Scale</td><td><code>"/"</code></td><td><code>8.6</code> rating in plex will show as <code>4.3</code> on the overlay</td></tr></table> |
| `rating2` | **Description:** Choose the rating to display in rating2.<br>**Values:** `critic`, `audience`, or `user` |
| `rating2_image` | **Description:** Choose the rating image to display in rating2.<br>**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.<br>**Values:** <table><tr><td>Ten Scale</td><td><code>""</code></td><td><code>8.7</code>, <code>9.0</code></td></tr><tr><td>Ten Scale removing <code>.0</code></td><td><code>"#"</code></td><td><code>8.7</code>, <code>9</code></td></tr><tr><td>Hundred Scale</td><td><code>"%"</code></td><td><code>87</code>, <code>90</code></td></tr><tr><td>Five Scale</td><td><code>"/"</code></td><td><code>8.6</code> rating in plex will show as <code>4.3</code> on the overlay</td></tr></table> |
| `rating3` | **Description:** Choose the rating to display in rating3.<br>**Values:** `critic`, `audience`, or `user` |
| `rating3_image` | **Description:** Choose the rating image to display in rating3.<br>**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.<br>**Values:** <table><tr><td>Ten Scale</td><td><code>""</code></td><td><code>8.7</code>, <code>9.0</code></td></tr><tr><td>Ten Scale removing <code>.0</code></td><td><code>"#"</code></td><td><code>8.7</code>, <code>9</code></td></tr><tr><td>Hundred Scale</td><td><code>"%"</code></td><td><code>87</code>, <code>90</code></td></tr><tr><td>Five Scale</td><td><code>"/"</code></td><td><code>8.6</code> rating in plex will show as <code>4.3</code> on the overlay</td></tr></table> |
| `horizontal_position` | **Description:** Choose the horizontal position for the rating group.<br>**Default:** `left`<br>**Values:** `left`, `right`, or `center` |
| `vertical_position` | **Description:** Choose the vertical position for the rating group.<br>**Default:** `center`<br>**Values:** `top`, `bottom`, or `center` |
| `rating_alignment` | **Description:** Choose the display alignment for the rating group.<br>**Default:** `vertical`<br>**Values:** `horizontal`, or `vertical` |
| `minimum_rating` | **Description:** Minimum Rating to display<br>**Default:** 0.0<br>**Values:** Any Number |
| `fresh_rating` | **Description:** Determines when ratings are considered Fresh<br>**Default:** 6.0<br>**Values:** Any Number |
| `maximum_rating` | **Description:** Maximum Rating to display<br>**Default:** 10.0<br>**Values:** Any Number |
| `font`<sup>1</sup> | **Description:** Choose the font for the Overlay.<br>**Default:** `fonts/Inter-Bold.ttf`<br>**Values:** Path to font file |
| `font_style`<sup>1</sup> | **Description:** Font style for Variable Fonts.<br>**Values:** Variable Font Style |
| `font_size`<sup>1</sup> | **Description:** Choose the font size for the Overlay.<br>**Default:** `63`<br>**Values:** Any Number greater then 0 |
| `font_color`<sup>1</sup> | **Description:** Choose the font color for the Overlay.<br>**Default:** `#FFFFFF`<br>**Values:** Color Hex Code in format `#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA` |
| `stroke_width`<sup>1</sup> | **Description:** Font Stroke Width for the Text Overlay.<br>**Values:** Any Number greater then 0 |
| `stroke_color`<sup>1</sup> | **Description:** Font Stroke Color for the Text Overlay.<br>**Values:** Color Hex Code in format `#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA` |
| `addon_offset`<sup>1</sup> | **Description:** Text Addon Image Offset from the text.<br>**Default:** `15`<br>**Values:** Any Number greater then 0 |
| `addon_position`<sup>1</sup> | **Description:** Text Addon Image Alignment in relation to the text.<br>**Default:** `left`<br>**Values:** `left`, `right`, `top`, `bottom` |
| `builder_level` | **Description:** Choose the Overlay Level.<br>**Values:** `episode` |
| Variable | Description & Values |
|:-----------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `rating1` | **Description:** Choose the rating to display in rating1.<br>**Values:** `critic`, `audience`, or `user` |
| `rating1_image` | **Description:** Choose the rating image to display in rating1.<br>**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.<br>**Values:** <table class="clearTable"><tr><td>Ten Scale</td><td><code>""</code></td><td><code>8.7</code>, <code>9.0</code></td></tr><tr><td>Ten Scale removing <code>.0</code> </td><td><code>"#"</code></td><td><code>8.7</code>, <code>9</code></td></tr><tr><td>Hundred Scale</td><td><code>"0"</code></td><td><code>87</code>, <code>90</code></td></tr><tr><td>Hundred Scale with <code>%</code> </td><td><code>"%"</code></td><td><code>87%</code>, <code>90%</code></td></tr><tr><td>Five Scale</td><td><code>"/"</code></td><td><code>8.6</code> rating in plex will show as <code>4.3</code> on the overlay</td></tr></table> |
| `rating2` | **Description:** Choose the rating to display in rating2.<br>**Values:** `critic`, `audience`, or `user` |
| `rating2_image` | **Description:** Choose the rating image to display in rating2.<br>**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.<br>**Values:** <table class="clearTable"><tr><td>Ten Scale</td><td><code>""</code></td><td><code>8.7</code>, <code>9.0</code></td></tr><tr><td>Ten Scale removing <code>.0</code> </td><td><code>"#"</code></td><td><code>8.7</code>, <code>9</code></td></tr><tr><td>Hundred Scale</td><td><code>"0"</code></td><td><code>87</code>, <code>90</code></td></tr><tr><td>Hundred Scale with <code>%</code> </td><td><code>"%"</code></td><td><code>87%</code>, <code>90%</code></td></tr><tr><td>Five Scale</td><td><code>"/"</code></td><td><code>8.6</code> rating in plex will show as <code>4.3</code> on the overlay</td></tr></table> |
| `rating3` | **Description:** Choose the rating to display in rating3.<br>**Values:** `critic`, `audience`, or `user` |
| `rating3_image` | **Description:** Choose the rating image to display in rating3.<br>**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.<br>**Values:** <table class="clearTable"><tr><td>Ten Scale</td><td><code>""</code></td><td><code>8.7</code>, <code>9.0</code></td></tr><tr><td>Ten Scale removing <code>.0</code> </td><td><code>"#"</code></td><td><code>8.7</code>, <code>9</code></td></tr><tr><td>Hundred Scale</td><td><code>"0"</code></td><td><code>87</code>, <code>90</code></td></tr><tr><td>Hundred Scale with <code>%</code> </td><td><code>"%"</code></td><td><code>87%</code>, <code>90%</code></td></tr><tr><td>Five Scale</td><td><code>"/"</code></td><td><code>8.6</code> rating in plex will show as <code>4.3</code> on the overlay</td></tr></table> |
| `horizontal_position` | **Description:** Choose the horizontal position for the rating group.<br>**Default:** `left`<br>**Values:** `left`, `right`, or `center` |
| `vertical_position` | **Description:** Choose the vertical position for the rating group.<br>**Default:** `center`<br>**Values:** `top`, `bottom`, or `center` |
| `rating_alignment` | **Description:** Choose the display alignment for the rating group.<br>**Default:** `vertical`<br>**Values:** `horizontal`, or `vertical` |
| `minimum_rating` | **Description:** Minimum Rating to display<br>**Default:** 0.0<br>**Values:** Any Number |
| `fresh_rating` | **Description:** Determines when ratings are considered Fresh<br>**Default:** 6.0<br>**Values:** Any Number |
| `maximum_rating` | **Description:** Maximum Rating to display<br>**Default:** 10.0<br>**Values:** Any Number |
| `font`<sup>1</sup> | **Description:** Choose the font for the Overlay.<br>**Default:** `fonts/Inter-Bold.ttf`<br>**Values:** Path to font file |
| `font_style`<sup>1</sup> | **Description:** Font style for Variable Fonts.<br>**Values:** Variable Font Style |
| `font_size`<sup>1</sup> | **Description:** Choose the font size for the Overlay.<br>**Default:** `63`<br>**Values:** Any Number greater then 0 |
| `font_color`<sup>1</sup> | **Description:** Choose the font color for the Overlay.<br>**Default:** `#FFFFFF`<br>**Values:** Color Hex Code in format `#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA` |
| `stroke_width`<sup>1</sup> | **Description:** Font Stroke Width for the Text Overlay.<br>**Values:** Any Number greater then 0 |
| `stroke_color`<sup>1</sup> | **Description:** Font Stroke Color for the Text Overlay.<br>**Values:** Color Hex Code in format `#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA` |
| `addon_offset`<sup>1</sup> | **Description:** Text Addon Image Offset from the text.<br>**Default:** `15`<br>**Values:** Any Number greater then 0 |
| `addon_position`<sup>1</sup> | **Description:** Text Addon Image Alignment in relation to the text.<br>**Default:** `left`<br>**Values:** `left`, `right`, `top`, `bottom` |
| `builder_level` | **Description:** Choose the Overlay Level.<br>**Values:** `episode` |
1. These Variables can be appended by `rating1_`, `rating2_`, or `rating3_` to change that attribute on each rating individually.

View file

@ -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>>`: audience rating (`8.7`, `9.0`)<br>`<<audience_rating%>>`: audience rating out of 100 (`87`, `90`)<br>`<<audience_rating#>>`: audience rating removing `.0` as needed (`8.7`, `9`)<br>`<<audience_rating/>>`: audience rating on a 5 point scale (`8.6` shows as `4.3`) | &#9989; | &#9989; | &#10060; | &#9989; |
| `<<critic_rating>>`: critic rating (`8.7`, `9.0`)<br>`<<critic_rating%>>`: critic rating out of 100 (`87`, `90`)<br>`<<critic_rating#>>`: critic rating removing `.0` as needed (`8.7`, `9`)<br>`<<critic_rating/>>`: critic rating on a 5 point scale (`8.6` shows as `4.3`) | &#9989; | &#9989; | &#10060; | &#9989; |
| `<<user_rating>>`: user rating (`8.7`, `9.0`)<br>`<<user_rating%>>`: user rating out of 100 (`87`, `90`)<br>`<<user_rating#>>`: user rating removing `.0` as needed (`8.7`, `9`)<br>`<<user_rating/>>`: user rating on a 5 point scale (`8.6` shows as `4.3`) | &#9989; | &#9989; | &#9989; | &#9989; |
| `<<audience_rating>>`: audience rating (`8.7`, `9.0`)<br>`<<audience_rating0>>`: audience rating out of 100 (`87`, `90`)<br>`<<audience_rating%>>`: audience rating out of 100 ending with `%` (`87%`, `90%`)<br>`<<audience_rating#>>`: audience rating removing `.0` as needed (`8.7`, `9`)<br>`<<audience_rating/>>`: audience rating on a 5 point scale (`8.6` shows as `4.3`) | &#9989; | &#9989; | &#10060; | &#9989; |
| `<<critic_rating>>`: critic rating (`8.7`, `9.0`)<br>`<<critic_rating0>>`: critic rating out of 100 (`87`, `90`)<br>`<<critic_rating%>>`: critic rating out of 100 ending with `%` (`87%`, `90%`)<br>`<<critic_rating#>>`: critic rating removing `.0` as needed (`8.7`, `9`)<br>`<<critic_rating/>>`: critic rating on a 5 point scale (`8.6` shows as `4.3`) | &#9989; | &#9989; | &#10060; | &#9989; |
| `<<user_rating>>`: user rating (`8.7`, `9.0`)<br>`<<user_rating0>>`: user rating out of 100 (`87`, `90`)<br>`<<user_rating%>>`: user rating out of 100 ending with `%` (`87%`, `90%`)<br>`<<user_rating#>>`: user rating removing `.0` as needed (`8.7`, `9`)<br>`<<user_rating/>>`: user rating on a 5 point scale (`8.6` shows as `4.3`) | &#9989; | &#9989; | &#9989; | &#9989; |
| `<<title>>`: 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 | &#9989; | &#9989; | &#9989; | &#9989; |
| `<<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 | &#10060; | &#10060; | &#9989; | &#9989; |
| `<<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 | &#10060; | &#10060; | &#10060; | &#9989; |

View file

@ -34,9 +34,9 @@ var_mods = {
"show_title": ["", "U", "L", "P"],
"season_title": ["", "U", "L", "P"],
"bitrate": ["", "H", "L"],
"user_rating": ["", "%", "#", "/"],
"critic_rating": ["", "%", "#", "/"],
"audience_rating": ["", "%", "#", "/"],
"user_rating": ["", "%", "#", "/", "0"],
"critic_rating": ["", "%", "#", "/", "0"],
"audience_rating": ["", "%", "#", "/", "0"],
"originally_available": ["", "["],
"runtime": ["", "H", "M"],
"season_number": ["", "W", "WU", "WL", "0", "00"],

View file

@ -259,9 +259,13 @@ class Overlays:
else:
final_value = int(actual_value / 60000)
elif mod == "%":
final_value = int(actual_value * 10)
final_value = f"{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":
@ -272,8 +276,6 @@ class Overlays:
final_value = f"{int(actual_value):02}"
elif mod == "00":
final_value = f"{int(actual_value):03}"
elif mod == "/":
final_value = f"{float(actual_value) / 2:.1f}"
elif mod == "U":
final_value = str(actual_value).upper()
elif mod == "L":

View file

@ -4,7 +4,7 @@ lxml==4.9.3
num2words==0.5.12
pathvalidate==3.1.0
pillow==10.0.0
PlexAPI==4.14.0
PlexAPI==4.15.0
psutil==5.9.5
python-dotenv==1.0.0
requests==2.31.0