[21] versions and bitrate overlay special text

pull/1024/head
meisnate12 2 years ago
parent 4922651b5f
commit bc0da63607

@ -1 +1 @@
1.17.3-develop20 1.17.3-develop21

@ -188,7 +188,9 @@ There are multiple Special Text Variables that can be used when formatting the t
| `<<episode_count>>`: Number of Episodes (`1`)<br>`<<episode_countW>>`: Number of Episodes As Words (`One`)<br>`<<episode_count0>>`: Number of Episodes With 10s Padding (`01`)<br>`<<episode_count00>>`: Number of Episodes With 100s Padding (`001`) | &#10060; | &#9989; | &#9989; | &#10060; | | `<<episode_count>>`: Number of Episodes (`1`)<br>`<<episode_countW>>`: Number of Episodes As Words (`One`)<br>`<<episode_count0>>`: Number of Episodes With 10s Padding (`01`)<br>`<<episode_count00>>`: Number of Episodes With 100s Padding (`001`) | &#10060; | &#9989; | &#9989; | &#10060; |
| `<<season_number>>`: Season Number (`1`)<br>`<<season_numberW>>`: Season Number As Words (`One`)<br>`<<season_number0>>`: Season Number With 10s Padding (`01`)<br>`<<season_number00>>`: Season Number With 100s Padding (`001`) | &#10060; | &#10060; | &#9989; | &#9989; | | `<<season_number>>`: Season Number (`1`)<br>`<<season_numberW>>`: Season Number As Words (`One`)<br>`<<season_number0>>`: Season Number With 10s Padding (`01`)<br>`<<season_number00>>`: Season Number With 100s Padding (`001`) | &#10060; | &#10060; | &#9989; | &#9989; |
| `<<episode_number>>`: Episode Number (`1`)<br>`<<episode_numberW>>`: Episode Number As Words (`One`)<br>`<<episode_number0>>`: Episode Number With 10s Padding (`01`)<br>`<<episode_number00>>`: Episode Number With 100s Padding (`001`) | &#10060; | &#10060; | &#10060; | &#9989; | | `<<episode_number>>`: Episode Number (`1`)<br>`<<episode_numberW>>`: Episode Number As Words (`One`)<br>`<<episode_number0>>`: Episode Number With 10s Padding (`01`)<br>`<<episode_number00>>`: Episode Number With 100s Padding (`001`) | &#10060; | &#10060; | &#10060; | &#9989; |
| `<<versions>>`: Number of Versions of the Item (`1`)<br>`<<versionsW>>`: Number of Versions of the Item As Words (`One`)<br>`<<versions0>>`: Number of Versions of the Item With 10s Padding (`01`)<br>`<<versions00>>`: Number of Versions of the Item With 100s Padding (`001`) | &#10060; | &#9989; | &#9989; | &#9989; |
| `<<runtime>>`: Complete Runtime of the Item in minutes (`150`)<br>`<<runtimeH>>`: Hours in runtime of the Item (`2`)<br>`<<runtimeM>>`: Minutes remaining in the hour in the runtime of the Item (`30`) | &#9989; | &#10060; | &#10060; | &#9989; | | `<<runtime>>`: Complete Runtime of the Item in minutes (`150`)<br>`<<runtimeH>>`: Hours in runtime of the Item (`2`)<br>`<<runtimeM>>`: Minutes remaining in the hour in the runtime of the Item (`30`) | &#9989; | &#10060; | &#10060; | &#9989; |
| `<<bitrate>>`: Bitrate of the first media file for an item.<br>`<<bitrateH>>`: Bitrate of the media file with the highest bitrate<br>`<<bitrateL>>`: Bitrate of the media file with the lowest bitrate | &#9989; | &#10060; | &#10060; | &#9989; |
| `<<originally_available>>`: Original Available Date of the Item<br>`<<originally_available[FORMAT]>>`: Original Available Date of the Item in the given format. [Format Options](https://strftime.org/) | &#9989; | &#9989; | &#10060; | &#9989; | | `<<originally_available>>`: Original Available Date of the Item<br>`<<originally_available[FORMAT]>>`: Original Available Date of the Item in the given format. [Format Options](https://strftime.org/) | &#9989; | &#9989; | &#10060; | &#9989; |
Note: You can use the `mass_audience_rating_update` or `mass_critic_rating_update` [Library Operation](../config/operations) to update your plex ratings to various services like `tmdb`, `imdb`, `mdb`, `metacritic`, `letterboxd` and many more. Note: You can use the `mass_audience_rating_update` or `mass_critic_rating_update` [Library Operation](../config/operations) to update your plex ratings to various services like `tmdb`, `imdb`, `mdb`, `metacritic`, `letterboxd` and many more.

@ -10,14 +10,14 @@ portrait_dim = (1000, 1500)
landscape_dim = (1920, 1080) landscape_dim = (1920, 1080)
old_special_text = [f"{a}{s}" for a in ["audience_rating", "critic_rating", "user_rating"] for s in ["", "0", "%", "#"]] old_special_text = [f"{a}{s}" for a in ["audience_rating", "critic_rating", "user_rating"] for s in ["", "0", "%", "#"]]
float_vars = ["audience_rating", "critic_rating", "user_rating"] float_vars = ["audience_rating", "critic_rating", "user_rating"]
int_vars = ["runtime", "season_number", "episode_number", "episode_count"] int_vars = ["runtime", "season_number", "episode_number", "episode_count", "versions"]
date_vars = ["originally_available"] date_vars = ["originally_available"]
types_for_var = { types_for_var = {
"movie_show_season_episode_artist_album": ["user_rating", "title"], "movie_show_season_episode_artist_album": ["user_rating", "title"],
"movie_show_episode_album": ["critic_rating", "originally_available"], "movie_show_episode_album": ["critic_rating", "originally_available"],
"movie_show_episode": ["audience_rating", "content_rating"], "movie_show_episode": ["audience_rating", "content_rating"],
"movie_show": ["original_title"], "movie_show": ["original_title"],
"movie_episode": ["runtime"], "movie_episode": ["runtime", "versions", "bitrate"],
"season_episode": ["show_title", "season_number"], "season_episode": ["show_title", "season_number"],
"show_season": ["episode_count"], "show_season": ["episode_count"],
"episode": ["season_title", "episode_number"] "episode": ["season_title", "episode_number"]
@ -28,6 +28,7 @@ var_mods = {
"original_title": ["", "U", "L", "P"], "original_title": ["", "U", "L", "P"],
"show_title": ["", "U", "L", "P"], "show_title": ["", "U", "L", "P"],
"season_title": ["", "U", "L", "P"], "season_title": ["", "U", "L", "P"],
"bitrate": ["", "H", "L"],
"user_rating": ["", "%", "#", "/"], "user_rating": ["", "%", "#", "/"],
"critic_rating": ["", "%", "#", "/"], "critic_rating": ["", "%", "#", "/"],
"audience_rating": ["", "%", "#", "/"], "audience_rating": ["", "%", "#", "/"],
@ -36,6 +37,7 @@ var_mods = {
"season_number": ["", "W", "0", "00"], "season_number": ["", "W", "0", "00"],
"episode_number": ["", "W", "0", "00"], "episode_number": ["", "W", "0", "00"],
"episode_count": ["", "W", "0", "00"], "episode_count": ["", "W", "0", "00"],
"versions": ["", "W", "0", "00"],
} }
single_mods = list(set([m for a, ms in var_mods.items() for m in ms if len(m) == 1])) single_mods = list(set([m for a, ms in var_mods.items() for m in ms if len(m) == 1]))
double_mods = list(set([m for a, ms in var_mods.items() for m in ms if len(m) == 2])) double_mods = list(set([m for a, ms in var_mods.items() for m in ms if len(m) == 2]))

@ -223,9 +223,24 @@ class Overlays:
actual_attr = plex.attribute_translation[format_var] actual_attr = plex.attribute_translation[format_var]
else: else:
actual_attr = format_var actual_attr = format_var
if format_var == "bitrate":
actual_value = None
for media in item.media:
current = int(media.bitrate)
if actual_value is None:
actual_value = current
if mod == "":
break
elif mod == "H" and current > actual_value:
actual_value = current
elif mod == "L" and current < actual_value:
actual_value = current
else:
if not hasattr(item, actual_attr) or getattr(item, actual_attr) is None: if not hasattr(item, actual_attr) or getattr(item, actual_attr) is None:
raise Failed(f"Overlay Warning: No {full_text} found") raise Failed(f"Overlay Warning: No {full_text} found")
actual_value = getattr(item, actual_attr) actual_value = getattr(item, actual_attr)
if format_var == "versions":
actual_value = len(actual_value)
if self.config.Cache: if self.config.Cache:
cache_store = actual_value.strftime("%Y-%m-%d") if format_var in overlay.date_vars else actual_value cache_store = actual_value.strftime("%Y-%m-%d") if format_var in overlay.date_vars else actual_value
self.config.Cache.update_overlay_special_text(item.ratingKey, format_var, cache_store) self.config.Cache.update_overlay_special_text(item.ratingKey, format_var, cache_store)

@ -153,7 +153,8 @@ attribute_translation = {
"original_title": "originalTitle", "original_title": "originalTitle",
"runtime": "duration", "runtime": "duration",
"season_title": "parentTitle", "season_title": "parentTitle",
"episode_count": "leafCount" "episode_count": "leafCount",
"versions": "media"
} }
method_alias = { method_alias = {
"actors": "actor", "role": "actor", "roles": "actor", "actors": "actor", "role": "actor", "roles": "actor",

Loading…
Cancel
Save