[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
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
- 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:
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
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
- 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:
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/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
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:
metadata_path:
- git: PMM/<file1> # separator is disabled
template_varables:
template_variables:
use_separator: false
- git: PMM/<file2> # separator is enabled by default
- git: PMM/<file3> # separator is disabled
template_varables:
template_variables:
use_separator: false
```
@ -444,6 +478,7 @@ libraries:
- git: PMM/overlays/imdb_top_250
- git: PMM/overlays/mc_must_see
- git: PMM/overlays/rt_cert_fresh
- git: PMM/overlays/commonsense_selection
- git: PMM/overlays/ratings
template_variables:
rating1: critic
@ -531,6 +566,13 @@ libraries:
- git: PMM/overlays/rt_cert_fresh
template_variables:
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
template_variables:
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
collections:
My Watch Watchlist:
imdb_warchlist: ur64054558
imdb_watchlist: ur64054558
collection_order: custom
sync_mode: sync
```
```yaml
collections:
My Friends Watchlists:
imdb_warchlist: ur64054558, ur12345678
imdb_watchlist: ur64054558, ur12345678
collection_order: custom
sync_mode: sync
```
```yaml
collections:
My Friends Watchlists:
imdb_warchlist:
imdb_watchlist:
- ur64054558
- ur12345678
collection_order: custom

View file

@ -176,10 +176,10 @@ 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:
| 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; |
| `<<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; |
| `<<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; |
|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:|
| `<<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`)<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`)<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; |
| `<<show_title>>`: Title of the Item's Show | &#10060; | &#10060; | &#9989; | &#9989; |
| `<<season_title>>`: Title of the Item's Season | &#10060; | &#10060; | &#10060; | &#9989; |

View file

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

View file

@ -28,9 +28,9 @@ var_mods = {
"original_title": [""],
"show_title": [""],
"season_title": [""],
"user_rating": ["", "%", "#"],
"critic_rating": ["", "%", "#"],
"audience_rating": ["", "%", "#"],
"user_rating": ["", "%", "#", "/"],
"critic_rating": ["", "%", "#", "/"],
"audience_rating": ["", "%", "#", "/"],
"originally_available": ["", "["],
"runtime": ["", "H", "M"],
"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"):
mod = "00"
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]
format_var = format_var[:-1]
elif f"<<{format_var}>>" in full_text:
@ -253,6 +253,8 @@ class Overlays:
final_value = f"{int(actual_value):02}"
elif mod == "00":
final_value = f"{int(actual_value):03}"
elif mod == "/":
final_value = f"{int(actual_value) / 2:.2f}"
else:
final_value = actual_value
if sub_value:

View file

@ -764,11 +764,23 @@ def run_playlists(config):
if "plex" in method:
ids = []
for pl_library in builder.libraries:
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:
ids = []
for pl_library in builder.libraries:
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:
ids = builder.gather_ids(method, value)