mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-24 21:43:07 +00:00
[38] Added total_runtime
as a special text overlay variable (#2089)
This commit is contained in:
parent
27a6c48b48
commit
edfb618269
7 changed files with 21 additions and 11 deletions
|
@ -11,6 +11,7 @@ Update setuptools requirement to 70.0.0
|
|||
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.
|
||||
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`
|
||||
Adds the `sort_by` attribute to `imdb_list`
|
||||
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
2.0.1-build37
|
||||
2.0.1-build38
|
||||
|
|
|
@ -10,6 +10,7 @@ external_templates:
|
|||
template_variables:
|
||||
default:
|
||||
text: "Runtime: "
|
||||
format: "<<runtimeH>>h <<runtimeM>>m"
|
||||
horizontal_align: right
|
||||
vertical_align: bottom
|
||||
conditionals:
|
||||
|
@ -32,7 +33,7 @@ external_templates:
|
|||
back_color: "#00000099"
|
||||
back_width: 600
|
||||
back_height: 105
|
||||
final_name: "text(<<text>><<runtimeH>>h <<runtimeM>>m)"
|
||||
final_name: "text(<<text>><<format>>)"
|
||||
|
||||
overlays:
|
||||
runtime_info:
|
||||
|
|
|
@ -57,9 +57,10 @@ work. Any value not specified will use its default value if it has one if not it
|
|||
|
||||
=== "File-Specific Template Variables"
|
||||
|
||||
| Variable | Description & Values |
|
||||
|:----------|:-----------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `text` | **Description:** Choose the text that appears prior to the runtime on the Overlay.<br>**Default:** `Runtime: `<br>**Values:** Any String |
|
||||
| Variable | Description & Values |
|
||||
|:---------|:-----------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `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"
|
||||
|
||||
|
|
|
@ -391,11 +391,12 @@ Each Special Text Variables has multiple modifiers that can be used to format th
|
|||
|
||||
##### Other Special Text
|
||||
|
||||
| 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` |
|
||||
| `<<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` |
|
||||
| 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` |
|
||||
| `<<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` |
|
||||
| `<<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` |
|
||||
|
||||
```yaml
|
||||
overlays:
|
||||
|
|
|
@ -25,6 +25,7 @@ types_for_var = {
|
|||
"movie_show_season_episode_artist_album": ["runtime", "user_rating", "title"],
|
||||
"movie_show_episode_album": ["critic_rating", "originally_available"],
|
||||
"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": [
|
||||
"original_title", "trakt_user_rating", "omdb_rating", "mdb_rating", "mdb_average_rating", "mdb_imdb_rating",
|
||||
|
@ -42,6 +43,7 @@ var_mods = {
|
|||
"bitrate": ["", "H", "L"],
|
||||
"originally_available": ["", "["],
|
||||
"runtime": ["", "H", "M"],
|
||||
"total_runtime": ["", "H", "M"],
|
||||
}
|
||||
for mod in float_vars:
|
||||
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 = [ep.duration for ep in sub_items if hasattr(ep, "duration") and ep.duration]
|
||||
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:
|
||||
if not hasattr(item, actual_attr) or getattr(item, actual_attr) is None:
|
||||
raise Failed(f"Overlay Warning: No {full_text} found")
|
||||
|
@ -406,7 +410,7 @@ class Overlays:
|
|||
final_value = actual_value.strftime(mod)
|
||||
else:
|
||||
final_value = actual_value.strftime("%Y-%m-%d")
|
||||
elif format_var == "runtime":
|
||||
elif format_var in ["runtime", "total_runtime"]:
|
||||
if mod == "H":
|
||||
final_value = int((actual_value / 60000) // 60)
|
||||
elif mod == "M":
|
||||
|
|
Loading…
Reference in a new issue