[15] add / rating mod

This commit is contained in:
meisnate12 2022-09-08 12:07:15 -04:00
parent bb4c5e2265
commit 11a325bc20
13 changed files with 84 additions and 28 deletions

View file

@ -1 +1 @@
1.17.3-develop14 1.17.3-develop15

View file

@ -80,6 +80,9 @@ libraries:
- git: PMM/overlays/mc_must_see # NOT SHOWN, however would apply the "MetaCritic Must See" sash in the bottom right - git: PMM/overlays/mc_must_see # NOT SHOWN, however would apply the "MetaCritic Must See" sash in the bottom right
template_variables: # Bottom right sash is used by more than one overlay so a weight for priority is applied template_variables: # Bottom right sash is used by more than one overlay so a weight for priority is applied
weight: 10 # Weight of 10 applies if more than 1 sash is applied in bottom right weight: 10 # Weight of 10 applies if more than 1 sash is applied in bottom right
- git: PMM/overlays/commonsense_selection # NOT SHOWN, however would apply the "Commonsense Selected Families" sash in the bottom right
template_variables: # Bottom right sash is used by more than one overlay so a weight for priority is applied
weight: 5 # Weight of 5 applies if more than 1 sash is applied in bottom right
operations: operations:
mass_user_rating_update: mdb_tomatoes # 5 This operation will update the user rating in plex with Rotten Tomatoes ratings information mass_user_rating_update: mdb_tomatoes # 5 This operation will update the user rating in plex with Rotten Tomatoes ratings information
@ -132,6 +135,9 @@ libraries:
- git: PMM/overlays/mc_must_see # NOT SHOWN, however would apply the "MetaCritic Must See" sash in the bottom right - git: PMM/overlays/mc_must_see # NOT SHOWN, however would apply the "MetaCritic Must See" sash in the bottom right
template_variables: # Bottom right sash is used by more than one overlay so a weight for priority is applied template_variables: # Bottom right sash is used by more than one overlay so a weight for priority is applied
weight: 10 # Weight of 10 applies if more than 1 sash is applied in bottom right weight: 10 # Weight of 10 applies if more than 1 sash is applied in bottom right
- git: PMM/overlays/commonsense_selection # NOT SHOWN, however would apply the "Commonsense Selected Families" sash in the bottom right
template_variables: # Bottom right sash is used by more than one overlay so a weight for priority is applied
weight: 5 # Weight of 5 applies if more than 1 sash is applied in bottom right
operations: operations:
mass_user_rating_update: mdb_tomatoes # 4 This operation will update the user rating in plex with Rotten Tomatoes ratings information mass_user_rating_update: mdb_tomatoes # 4 This operation will update the user rating in plex with Rotten Tomatoes ratings information
@ -278,6 +284,34 @@ This is the default PMM collection ordering:
| `PMM/movie/producer.yml` | collection_section: 19 | | `PMM/movie/producer.yml` | collection_section: 19 |
| `PMM/movie/writer.yml` | collection_section: 20 | | `PMM/movie/writer.yml` | collection_section: 20 |
## Ratings Overlays
By default for Movies in Plex, the `Ratings Source` dropdown (`#3`) below, can come from Rotten Tomatoes (and includes Critic Ratings and Audience Ratings) or IMDb (Audience Ratings). This only changes the tiny icons displayed and where Plex will retrieve the ratings from upon initial scan and import of the media metadata.
**Plex Meta Manager can insert up to three ratings of your choice into the three spots regardless of what you choose in the `Advanced` tab of that Plex library**
![](ratings_source.png)
Plex has three available spots in the Plex DB to store ratings and thus Plex Meta Manager can be used to insert ratings sources of your choice into those spots. They are known as the User Rating (`#1`), Critic Rating (`#2`), and Audience Rating (`#3`).
**Note that the little icons cannot be changed and that the numbers next to the little icons are reflected in the poster ratings overlay**
![](ratings_spot.png)
To be able to insert the ratings you want, Plex Meta Manager operations need to be defined. In this example below, User ratings (`#1`) are being filled with Rotten Tomatoes Critics Ratings. Critic ratings (`#2`) are filled with IMDb, and Audience ratings (`#3`) are filled with TMDb.
**mass_*_rating_update** sources can be found here: [operations](../../config/operations)
![](ratings_operations.png)
Finally, to show the ratings on the poster, the following was added to the `overlay_path` section in the `config.yml` file to post Rotten Tomatoes Critics Ratings in (`#1`), IMDb ratings in (`#2`), and TMDb ratings in (`#3`)
![](ratings_overlay_path.png)
## Customizing Configs ## Customizing Configs
Configs can be customized using the `template_variables` attribute when calling the file. These `template_variables` will be given to every template call in the file which allows them to affect how that file runs. Configs can be customized using the `template_variables` attribute when calling the file. These `template_variables` will be given to every template call in the file which allows them to affect how that file runs.
@ -381,11 +415,11 @@ libraries:
LIBRARYNAME: LIBRARYNAME:
metadata_path: metadata_path:
- git: PMM/<file1> # separator is disabled - git: PMM/<file1> # separator is disabled
template_varables: template_variables:
use_separator: false use_separator: false
- git: PMM/<file2> # separator is enabled by default - git: PMM/<file2> # separator is enabled by default
- git: PMM/<file3> # separator is disabled - git: PMM/<file3> # separator is disabled
template_varables: template_variables:
use_separator: false use_separator: false
``` ```
@ -444,6 +478,7 @@ libraries:
- git: PMM/overlays/imdb_top_250 - git: PMM/overlays/imdb_top_250
- git: PMM/overlays/mc_must_see - git: PMM/overlays/mc_must_see
- git: PMM/overlays/rt_cert_fresh - git: PMM/overlays/rt_cert_fresh
- git: PMM/overlays/commonsense_selection
- git: PMM/overlays/ratings - git: PMM/overlays/ratings
template_variables: template_variables:
rating1: critic rating1: critic
@ -531,6 +566,13 @@ libraries:
- git: PMM/overlays/rt_cert_fresh - git: PMM/overlays/rt_cert_fresh
template_variables: template_variables:
overlay_level: season overlay_level: season
- git: PMM/overlays/commonsense_selection
- git: PMM/overlays/commonsense_selection
template_variables:
overlay_level: episode
- git: PMM/overlays/commonsense_selection
template_variables:
overlay_level: season
- git: PMM/overlays/ratings - git: PMM/overlays/ratings
template_variables: template_variables:
rating2: audience rating2: audience

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 441 KiB

After

Width:  |  Height:  |  Size: 446 KiB

View file

@ -132,21 +132,21 @@ The `sync_mode: sync` and `collection_order: custom` Details are recommended sin
```yaml ```yaml
collections: collections:
My Watch Watchlist: My Watch Watchlist:
imdb_warchlist: ur64054558 imdb_watchlist: ur64054558
collection_order: custom collection_order: custom
sync_mode: sync sync_mode: sync
``` ```
```yaml ```yaml
collections: collections:
My Friends Watchlists: My Friends Watchlists:
imdb_warchlist: ur64054558, ur12345678 imdb_watchlist: ur64054558, ur12345678
collection_order: custom collection_order: custom
sync_mode: sync sync_mode: sync
``` ```
```yaml ```yaml
collections: collections:
My Friends Watchlists: My Friends Watchlists:
imdb_warchlist: imdb_watchlist:
- ur64054558 - ur64054558
- ur12345678 - ur12345678
collection_order: custom collection_order: custom

View file

@ -175,21 +175,21 @@ You can use the item's metadata to determine the text by adding Special Text Var
There are multiple Special Text Variables that can be used when formatting the text. The variables are defined like so `<<name>>` and some can have modifiers like so `<<name$>>` where `$` is the modifier. The available options are: There are multiple Special Text Variables that can be used when formatting the text. The variables are defined like so `<<name>>` and some can have modifiers like so `<<name$>>` where `$` is the modifier. The available options are:
| Special Text Variables & Mods | Movies | Shows | Seasons | Episodes | | 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`) | &#9989; | &#9989; | &#10060; | &#9989; | | `<<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`) | &#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`) | &#9989; | &#9989; | &#9989; | &#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; |
| `<<title>>`: Title of the Item | &#9989; | &#9989; | &#9989; | &#9989; | | `<<title>>`: Title of the Item | &#9989; | &#9989; | &#9989; | &#9989; |
| `<<show_title>>`: Title of the Item's Show | &#10060; | &#10060; | &#9989; | &#9989; | | `<<show_title>>`: Title of the Item's Show | &#10060; | &#10060; | &#9989; | &#9989; |
| `<<season_title>>`: Title of the Item's Season | &#10060; | &#10060; | &#10060; | &#9989; | | `<<season_title>>`: Title of the Item's Season | &#10060; | &#10060; | &#10060; | &#9989; |
| `<<original_title>>`: Original Title of the Item | &#9989; | &#9989; | &#10060; | &#10060; | | `<<original_title>>`: Original Title of the Item | &#9989; | &#9989; | &#10060; | &#10060; |
| `<<content_rating>>`: Content Rating of the Item | &#9989; | &#9989; | &#10060; | &#9989; | | `<<content_rating>>`: Content Rating of the Item | &#9989; | &#9989; | &#10060; | &#9989; |
| `<<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; |
| `<<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; |
| `<<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.

View file

@ -14,6 +14,7 @@ class Letterboxd:
def _parse_page(self, list_url, language): def _parse_page(self, list_url, language):
if "ajax" not in list_url: if "ajax" not in list_url:
list_url = list_url.replace("https://letterboxd.com/films", "https://letterboxd.com/films/ajax") list_url = list_url.replace("https://letterboxd.com/films", "https://letterboxd.com/films/ajax")
logger.trace(f"URL: {list_url}")
response = self.config.get_html(list_url, headers=util.header(language)) response = self.config.get_html(list_url, headers=util.header(language))
letterboxd_ids = response.xpath("//li[contains(@class, 'poster-container') or contains(@class, 'film-detail')]/div/@data-film-id") letterboxd_ids = response.xpath("//li[contains(@class, 'poster-container') or contains(@class, 'film-detail')]/div/@data-film-id")
items = [] items = []
@ -32,7 +33,6 @@ class Letterboxd:
return items, next_url return items, next_url
def _parse_list(self, list_url, limit, language): def _parse_list(self, list_url, limit, language):
logger.trace(f"URL: {list_url}")
items, next_url = self._parse_page(list_url, language) items, next_url = self._parse_page(list_url, language)
while len(next_url) > 0: while len(next_url) > 0:
time.sleep(2) time.sleep(2)

View file

@ -28,9 +28,9 @@ var_mods = {
"original_title": [""], "original_title": [""],
"show_title": [""], "show_title": [""],
"season_title": [""], "season_title": [""],
"user_rating": ["", "%", "#"], "user_rating": ["", "%", "#", "/"],
"critic_rating": ["", "%", "#"], "critic_rating": ["", "%", "#", "/"],
"audience_rating": ["", "%", "#"], "audience_rating": ["", "%", "#", "/"],
"originally_available": ["", "["], "originally_available": ["", "["],
"runtime": ["", "H", "M"], "runtime": ["", "H", "M"],
"season_number": ["", "W", "0", "00"], "season_number": ["", "W", "0", "00"],

View file

@ -210,7 +210,7 @@ class Overlays:
elif f"<<{format_var}>>" in full_text and format_var.endswith("00"): elif f"<<{format_var}>>" in full_text and format_var.endswith("00"):
mod = "00" mod = "00"
format_var = format_var[:-2] format_var = format_var[:-2]
elif f"<<{format_var}>>" in full_text and format_var.endswith(("%", "#", "H", "M", "0")): elif f"<<{format_var}>>" in full_text and format_var.endswith(("%", "#", "H", "M", "0", "/")):
mod = format_var[-1] mod = format_var[-1]
format_var = format_var[:-1] format_var = format_var[:-1]
elif f"<<{format_var}>>" in full_text: elif f"<<{format_var}>>" in full_text:
@ -253,6 +253,8 @@ class Overlays:
final_value = f"{int(actual_value):02}" final_value = f"{int(actual_value):02}"
elif mod == "00": elif mod == "00":
final_value = f"{int(actual_value):03}" final_value = f"{int(actual_value):03}"
elif mod == "/":
final_value = f"{int(actual_value) / 2:.2f}"
else: else:
final_value = actual_value final_value = actual_value
if sub_value: if sub_value:

View file

@ -764,11 +764,23 @@ def run_playlists(config):
if "plex" in method: if "plex" in method:
ids = [] ids = []
for pl_library in builder.libraries: for pl_library in builder.libraries:
ids.extend(pl_library.get_rating_keys(method, value)) try:
ids.extend(pl_library.get_rating_keys(method, value))
except Failed as e:
if builder.validate_builders:
raise
else:
logger.error(e)
elif "tautulli" in method: elif "tautulli" in method:
ids = [] ids = []
for pl_library in builder.libraries: for pl_library in builder.libraries:
ids.extend(pl_library.Tautulli.get_rating_keys(value, True)) try:
ids.extend(pl_library.Tautulli.get_rating_keys(value, True))
except Failed as e:
if builder.validate_builders:
raise
else:
logger.error(e)
else: else:
ids = builder.gather_ids(method, value) ids = builder.gather_ids(method, value)