[20] #763 add content_rating to dynamic collecitons

This commit is contained in:
meisnate12 2022-03-11 10:33:22 -05:00
parent 4a33e9fcf4
commit 653d949f0e
3 changed files with 72 additions and 9 deletions

View file

@ -1 +1 @@
1.16.0-develop19
1.16.0-develop20

View file

@ -119,6 +119,7 @@ Depending on the `type` of dynamic collection, `data` is used to specify the opt
| [`writer`](#writer) | Create a collection for each writer found in the library | ✅ | ✅ | ❌ | ❌ | ❌ |
| [`producer`](#producer) | Create a collection for each producer found in the library | ✅ | ✅ | ❌ | ❌ | ❌ |
| [`genre`](#genre) | Create a collection for each genre found in the library | ❌ | ✅ | ✅ | ✅ | ✅ |
| [`content_rating`](#content-rating) | Create a collection for each content rating found in the library | ❌ | ✅ | ✅ | ❌ | ✅ |
| [`year`](#year) | Create a collection for each year found in the library | ❌ | ✅ | ✅ | ❌ | ❌ |
| [`decade`](#decade) | Create a collection for each decade found in the library | ❌ | ✅ | ❌ | ❌ | ❌ |
| [`country`](#country) | Create a collection for each country found in the library | ❌ | ✅ | ❌ | ✅ | ✅ |
@ -913,6 +914,67 @@ dynamic_collections:
template: genre collection
```
### Content Rating
Create a collection for each content rating found in the library.
<table class="dualTable colwidths-auto align-default table">
<tr>
<th><code>type</code> Option</th>
<td><code>content_rating</code></td>
</tr>
<tr>
<th><code>data</code> Value</th>
<td>Not Used</td>
</tr>
<tr>
<th>Keys</th>
<td>Content Rating</td>
</tr>
<tr>
<th>Key Names</th>
<td>Content Rating</td>
</tr>
<tr>
<th>Default <code>title_format</code></th>
<td><code>Top &lt;&lt;title&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td>
</tr>
<tr>
<th>Default Template</th>
<td>
```yaml
default_template:
smart_filter:
limit: 50
sort_by: critic_rating.desc
any:
content_rating: <<content_rating>>
```
</td>
</tr>
</table>
#### Example:
* Create dynamic collections based on each content rating found in the library (TV and Movies)
* Amend the template to increase the limit from 50 to 100
```yaml
templates:
content rating collection:
smart_filter:
limit: 100
sort_by: critic_rating.desc
all:
content_rating: <<content_rating>>
dynamic_collections:
Content Ratings: # mapping name does not matter just needs to be unique
type: content_rating
template: content rating collection
```
### Year
Create a collection for each year found in the library.

View file

@ -11,18 +11,17 @@ logger = util.logger
github_base = "https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager-Configs/master/"
all_auto = ["genre"]
ms_auto = ["actor", "year", "original_language", "tmdb_popular_people", "trakt_user_lists", "trakt_liked_lists", "trakt_people_list"]
ms_auto = [
"actor", "year", "content_rating", "original_language", "tmdb_popular_people",
"trakt_user_lists", "trakt_liked_lists", "trakt_people_list"
]
auto = {
"Movie": ["tmdb_collection", "decade", "country", "director", "producer", "writer"] + all_auto + ms_auto,
"Show": ["network", "origin_country"] + all_auto + ms_auto,
"Artist": ["mood", "style", "country"] + all_auto,
"Video": ["country"] + all_auto
"Video": ["country", "content_rating"] + all_auto
}
default_templates = {
"actor": {"tmdb_person": f"<<actor>>", "plex_search": {"all": {"actor": "tmdb"}}},
"director": {"tmdb_person": f"<<director>>", "plex_search": {"all": {"director": "tmdb"}}},
"producer": {"tmdb_person": f"<<producer>>", "plex_search": {"all": {"producer": "tmdb"}}},
"writer": {"tmdb_person": f"<<writer>>", "plex_search": {"all": {"writer": "tmdb"}}},
"original_language": {"plex_all": True, "filters": {"original_language": "<<original_language>>"}},
"origin_country": {"plex_all": True, "filters": {"origin_country": "<<origin_country>>"}},
"tmdb_collection": {"tmdb_collection_details": "<<tmdb_collection>>"},
@ -280,8 +279,9 @@ class MetadataFile(DataFile):
for ck, cv in check_dict.items():
if ck not in exclude and cv not in exclude:
auto_list[ck] = cv
if auto_type in ["genre", "mood", "style", "country", "network", "year", "decade"]:
auto_list = {i.title: i.title for i in library.get_tags(auto_type) if i.title not in exclude}
if auto_type in ["genre", "mood", "style", "country", "network", "year", "decade", "content_rating"]:
search_tag = "contentRating" if auto_type == "content_rating" else auto_type
auto_list = {i.title: i.title for i in library.get_tags(search_tag) if i.title not in exclude}
if library.is_music:
default_template = {"smart_filter": {"limit": 50, "sort_by": "plays.desc", "any": {f"artist_{auto_type}": f"<<{auto_type}>>"}}}
default_title_format = "Most Played <<key_name>> <<library_type>>s"
@ -365,6 +365,7 @@ class MetadataFile(DataFile):
person_count += 1
except TMDbNotFound:
logger.error(f"TMDb Error: Actor {role['name']} Not Found")
default_template = {"tmdb_person": f"<<{auto_type}>>", "plex_search": {"all": {auto_type: "tmdb"}}},
elif auto_type == "trakt_user_lists":
dynamic_data = util.parse("Config", "data", dynamic, parent=map_name, methods=methods, datatype="list")
for option in dynamic_data: