[38] Added `total_runtime` as a special text overlay variable (#2089)

pull/2097/head
meisnate12 6 months ago committed by GitHub Action
parent 27a6c48b48
commit edfb618269

@ -11,6 +11,7 @@ Update setuptools requirement to 70.0.0
Checks requirement versions to print a message if one needs to be updated Checks requirement versions to print a message if one needs to be updated
Added the `mass_added_at_update` operation to mass set the Added At field of Movies and Shows. Added the `mass_added_at_update` operation to mass set the Added At field of Movies and Shows.
Add automated Anime Aggregations for AniDB matching Add automated Anime Aggregations for AniDB matching
Added `total_runtime` as a special text overlay variable.
Added `top_tamil`, `top_telugu`, `top_malayalam`, `trending_india`, `trending_tamil`, and `trending_telugu` as options for `imdb_chart` Added `top_tamil`, `top_telugu`, `top_malayalam`, `trending_india`, `trending_tamil`, and `trending_telugu` as options for `imdb_chart`
Adds the `sort_by` attribute to `imdb_list` Adds the `sort_by` attribute to `imdb_list`

@ -1 +1 @@
2.0.1-build37 2.0.1-build38

@ -10,6 +10,7 @@ external_templates:
template_variables: template_variables:
default: default:
text: "Runtime: " text: "Runtime: "
format: "<<runtimeH>>h <<runtimeM>>m"
horizontal_align: right horizontal_align: right
vertical_align: bottom vertical_align: bottom
conditionals: conditionals:
@ -32,7 +33,7 @@ external_templates:
back_color: "#00000099" back_color: "#00000099"
back_width: 600 back_width: 600
back_height: 105 back_height: 105
final_name: "text(<<text>><<runtimeH>>h <<runtimeM>>m)" final_name: "text(<<text>><<format>>)"
overlays: overlays:
runtime_info: runtime_info:

@ -58,8 +58,9 @@ work. Any value not specified will use its default value if it has one if not it
=== "File-Specific Template Variables" === "File-Specific Template Variables"
| Variable | Description & Values | | Variable | Description & Values |
|:----------|:-----------------------------------------------------------------------------------------------------------------------------------------| |:---------|:-----------------------------------------------------------------------------------------------------------------------------------------|
| `text` | **Description:** Choose the text that appears prior to the runtime on the Overlay.<br>**Default:** `Runtime: `<br>**Values:** Any String | | `text` | **Description:** Choose the text that appears prior to the runtime on the Overlay.<br>**Default:** `Runtime: `<br>**Values:** Any String |
| `format` | **Description:** Choose the format of the the displayed runtime.<br>**Default:** `<<runtimeH>>h <<runtimeM>>m`<br>**Values:** Any String |
=== "Overlay Template Variables" === "Overlay Template Variables"

@ -392,8 +392,9 @@ Each Special Text Variables has multiple modifiers that can be used to format th
##### Other Special Text ##### Other Special Text
| Special Text Variables & Mods | Item Types | | Special Text Variables & Mods | Item Types |
|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------| |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------|
| `<<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`)<br>**Show and Season use average Episode Runtime.** | `Movies`, `Shows`, `Seasons`, or `Episodes` | | `<<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`)<br>**Show and Season use average Episode Runtime.** | `Movies`, `Shows`, `Seasons`, or `Episodes` |
| `<<total_runtime>>`: Complete combined Runtime of all Episodes/Tracks of the Item in minutes (`150`)<br>`<<runtimeH>>`: Hours in total runtime of the Item (`2`)<br>`<<runtimeM>>`: Minutes remaining in the hour in the runtime of the Item (`30`) | `Shows`, `Seasons`, `Artists`, or `Albums` |
| `<<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 | `Movies` or `Episodes` | | `<<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 | `Movies` or `Episodes` |
| `<<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/) | `Movies`, `Shows`, or `Episodes` | | `<<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/) | `Movies`, `Shows`, or `Episodes` |

@ -25,6 +25,7 @@ types_for_var = {
"movie_show_season_episode_artist_album": ["runtime", "user_rating", "title"], "movie_show_season_episode_artist_album": ["runtime", "user_rating", "title"],
"movie_show_episode_album": ["critic_rating", "originally_available"], "movie_show_episode_album": ["critic_rating", "originally_available"],
"movie_show_season_episode": ["tmdb_rating"], "movie_show_season_episode": ["tmdb_rating"],
"show_season_artist_album": ["total_runtime"],
"movie_show_episode": ["audience_rating", "content_rating", "tmdb_rating", "imdb_rating"], "movie_show_episode": ["audience_rating", "content_rating", "tmdb_rating", "imdb_rating"],
"movie_show": [ "movie_show": [
"original_title", "trakt_user_rating", "omdb_rating", "mdb_rating", "mdb_average_rating", "mdb_imdb_rating", "original_title", "trakt_user_rating", "omdb_rating", "mdb_rating", "mdb_average_rating", "mdb_imdb_rating",
@ -42,6 +43,7 @@ var_mods = {
"bitrate": ["", "H", "L"], "bitrate": ["", "H", "L"],
"originally_available": ["", "["], "originally_available": ["", "["],
"runtime": ["", "H", "M"], "runtime": ["", "H", "M"],
"total_runtime": ["", "H", "M"],
} }
for mod in float_vars: for mod in float_vars:
var_mods[mod] = ["", "%", "#", "/"] var_mods[mod] = ["", "%", "#", "/"]

@ -390,6 +390,10 @@ class Overlays:
sub_items = item.episodes() if text_overlay.level in ["show", "season"] else item.tracks() sub_items = item.episodes() if text_overlay.level in ["show", "season"] else item.tracks()
sub_items = [ep.duration for ep in sub_items if hasattr(ep, "duration") and ep.duration] sub_items = [ep.duration for ep in sub_items if hasattr(ep, "duration") and ep.duration]
actual_value = sum(sub_items) / len(sub_items) actual_value = sum(sub_items) / len(sub_items)
elif format_var == "total_runtime":
sub_items = item.episodes() if text_overlay.level in ["show", "season"] else item.tracks()
sub_items = [ep.duration for ep in sub_items if hasattr(ep, "duration") and ep.duration]
actual_value = sum(sub_items)
else: 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")
@ -406,7 +410,7 @@ class Overlays:
final_value = actual_value.strftime(mod) final_value = actual_value.strftime(mod)
else: else:
final_value = actual_value.strftime("%Y-%m-%d") final_value = actual_value.strftime("%Y-%m-%d")
elif format_var == "runtime": elif format_var in ["runtime", "total_runtime"]:
if mod == "H": if mod == "H":
final_value = int((actual_value / 60000) // 60) final_value = int((actual_value / 60000) // 60)
elif mod == "M": elif mod == "M":

Loading…
Cancel
Save