[83] Adds Runtime for Shows, Seasons, Artists, and Albums

This commit is contained in:
meisnate12 2023-08-09 13:37:59 -04:00
parent 8d5e3fe387
commit a654092fff
11 changed files with 31 additions and 13 deletions

View file

@ -24,6 +24,7 @@ New [Network](https://metamanager.wiki/en/latest/defaults/overlays/network.html)
New Content Rating US [Movies](https://metamanager.wiki/en/latest/defaults/overlays/content_rating_us_movie.html)/[Shows](https://metamanager.wiki/en/latest/defaults/overlays/content_rating_us_show.html) and [Content Rating UK](https://metamanager.wiki/en/latest/defaults/overlays/content_rating_uk.html) Default Overlay.
Add `file_poster`, `file_poster_<<key>>`, `url_background`, `url_background_<<key>>`, `file_background`, `file_background_<<key>>`, `sort_prefix`, `sort_title`, and `name_mapping` as [Collection Variables](https://metamanager.wiki/en/latest/defaults/collection_variables.html).
Add new Separator Color Styles.
Closes #1461 Adds Runtime for Shows, Seasons, Artists, and Albums
Standardized overlay sizes for `- pmm: networks` and `- pmm: streaming`
Rebrand HBO Max to Max.
Add additional studios and networks
@ -32,8 +33,10 @@ Add Heritage Months to [Seasonal Defaults File](https://metamanager.wiki/en/late
# Bug Fixes
Fixes #1496 Fixes issue with IMDb Collections not building due to HTML structure changes.
Fixes #1445 Fixes FlixPatrol failed to parse error for most users.
Fixes #1457 Fixes issue with renaming assets
Fixes #1379 Fixes a Docstring.
Fixes #1478 Fixes issue with percent sign not appearing on some rating overlays.
Fixes #1480 Fixes albums not having locations
Fixes #1490 Fixes incorrect language code for Philippines in Languages Defaults file.
Fixes #1378 Fixes incorrect default value for starting attribute in "Year" collections.
Fixes #1379 #1380 #1472 Fixes various docs issues and typos

View file

@ -1 +1 @@
1.19.0-develop82
1.19.0-develop83

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -11,13 +11,22 @@ external_templates:
default:
style: yellow
conditionals:
final_style:
default: yellow
conditions:
- style: gray
value: gray
- style: black
value: black
- style: red
value: red
pmm:
conditions:
- file.exists: false
url.exists: false
git.exists: false
repo.exists: false
value: ribbon/<<style>>/<<key>>
value: ribbon/<<final_style>>/<<key>>
group: ribbon
horizontal_offset: 0
horizontal_align: right

View file

@ -49,12 +49,11 @@ All [Shared Overlay Variables](../overlay_variables) are available with the defa
| `horizontal_align` | `right` |
| `vertical_offset` | `0` |
| `vertical_align` | `bottom` |
| `style` | `yellow` |
| Variable | Description & Values |
|:-----------------------------|:-------------------------------------------------------------------------------------------------------------|
| `weight_<<key>>`<sup>1</sup> | **Description:** Controls the weight of the Overlay. Higher numbers have priority.<br>**Values:** Any Number |
| `style` | **Description:** Controls the color of the ribbon. <br>**Values:** `yellow, gray, black, red` |
| Variable | Description & Values |
|:-----------------------------|:------------------------------------------------------------------------------------------------------------------------|
| `weight_<<key>>`<sup>1</sup> | **Description:** Controls the weight of the Overlay. Higher numbers have priority.<br>**Values:** Any Number |
| `style` | **Description:** Controls the color of the ribbon. <br>**Default:** `yellow` <br>**Values:** `yellow, gray, black, red` |
1. Each default overlay has a `key` that when calling to effect a specific overlay you must replace `<<key>>` with when calling.

View file

@ -1,12 +1,12 @@
# Runtimes Overlay
The `runtimes` Default Overlay File is used to create an overlay on of the movie or episodes runtime for all items in your library.
The `runtimes` Default Overlay File is used to create an overlay of the movie runtime, episode runtime, or average episode runtime for all items in your library.
![](images/runtimes.png)
## Requirements & Recommendations
Supported Overlay Level: Movie, Show, Episode
Supported Overlay Level: Movie, Show, Season, Episode
## Config

View file

@ -361,7 +361,7 @@ spec:
### Templatizing your configuration
This example will (re)generate the IMBD list URL and include the current date as the end date for the `release_date` value.
This example will (re)generate the IMDb list URL and include the current date as the end date for the `release_date` value.
`https://www.imdb.com/search/title/?title_type=tv_series,tv_miniseries&release_date=1980-01-01,{{ now().strftime('%Y-%m-%d') }}`
`{{ now().strftime('%Y-%m-%d') }}` is the Jinja code, which when rendered will be replaced with the current date in

View file

@ -214,7 +214,7 @@ There are multiple Special Text Variables that can be used when formatting the t
| `<<season_number>>`: Season Number (`1`)<br>`<<season_numberW>>`: Season Number As Words (`One`)<br>`<<season_numberWU>>`: Season Number As Uppercase Words (`ONE`)<br>`<<season_numberWL>>`: Season Number As Lowercase 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_numberWU>>`: Episode Number As Uppercase Words (`One`)<br>`<<episode_numberWL>>`: Episode Number As Lowercase 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>`<<versionsWO>>`: Number of Versions of the Item As Uppercase Words (`ONE`)<br>`<<versionsWL>>`: 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`) | &#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; |
| `<<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.** | &#9989; | &#9989; | &#9989; | &#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; |

View file

@ -16,11 +16,11 @@ float_vars = ["audience_rating", "critic_rating", "user_rating"]
int_vars = ["runtime", "season_number", "episode_number", "episode_count", "versions"]
date_vars = ["originally_available"]
types_for_var = {
"movie_show_season_episode_artist_album": ["user_rating", "title"],
"movie_show_season_episode_artist_album": ["runtime", "user_rating", "title"],
"movie_show_episode_album": ["critic_rating", "originally_available"],
"movie_show_episode": ["audience_rating", "content_rating"],
"movie_show": ["original_title"],
"movie_episode": ["runtime", "versions", "bitrate"],
"movie_episode": ["versions", "bitrate"],
"season_episode": ["show_title", "season_number"],
"show_season": ["episode_count"],
"movie": ["edition"],

View file

@ -235,6 +235,13 @@ class Overlays:
actual_value = current
elif mod == "L" and current < actual_value:
actual_value = current
elif format_var == "runtime" and text_overlay.level in ["show", "season", "artist", "album"]:
if hasattr(item, "duration") and item.duration:
actual_value = item.duration
else:
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)
else:
if not hasattr(item, actual_attr) or getattr(item, actual_attr) is None:
raise Failed(f"Overlay Warning: No {full_text} found")