mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 06:54:21 +00:00
[23] fix mappers
This commit is contained in:
parent
edb752a403
commit
29ab86267b
3 changed files with 52 additions and 37 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.16.1-develop22
|
||||
1.16.1-develop23
|
||||
|
|
|
@ -34,6 +34,7 @@ The available attributes for the operations attribute are as follows
|
|||
| `sonarr_add_all` | Adds every item in the library to Sonarr. The existing paths in plex will be used as the root folder of each item, if the paths in Plex are not the same as your Sonarr paths you can use the `plex_path` and `sonarr_path` [Sonarr](sonarr) details to convert the paths.<br>**Values:** `true` or `false` |
|
||||
| `sonarr_remove_by_tag` | Removes every item from Sonarr with the Tags given<br>**Values:** List or comma separated string of tags |
|
||||
| `genre_mapper` | Allows genres to be changed to other genres or be removed from every item in your library.<br>**Values:** [see below for usage](#genre-mapper) |
|
||||
| `content_rating_mapper` | Allows content ratings to be changed to other content ratings or be removed from every item in your library.<br>**Values:** [see below for usage](#content-rating-mapper) |
|
||||
| `metadata_backup` | Creates/Maintains a PMM [Metadata File](../metadata/metadata) with a full `metadata` mapping based on the library's items locked attributes.<br>**Values:** [see below for usage](#metadata-backup) |
|
||||
|
||||
## Genre Mapper
|
||||
|
@ -41,8 +42,8 @@ The available attributes for the operations attribute are as follows
|
|||
You can use the `genre_mapper` operation to map genres in your library.
|
||||
|
||||
Each attribute under `genre_mapper` is a separate mapping and has two parts.
|
||||
* The key (`Action` in the example below) is what the genres will end up as.
|
||||
* The value(`Action/Adventure, Action & Adventure` in the example below) is what genres you want mapped to the key.
|
||||
* The key (`Action/Adventure, Action & Adventure` in the example below) is what genres you want mapped to the value.
|
||||
* The value (`Action` in the example below) is what the genres will end up as.
|
||||
|
||||
So this example will change go through every item in your library and change the genre `Action/Adventure` or `Action & Adventure` to `Action` and `Romantic Comedy` to `Comedy`.
|
||||
|
||||
|
@ -51,21 +52,9 @@ library:
|
|||
Movies:
|
||||
operations:
|
||||
genre_mapper:
|
||||
Action: Action/Adventure, Action & Adventure
|
||||
Comedy: Romantic Comedy
|
||||
```
|
||||
|
||||
you can also use a list:
|
||||
|
||||
```yaml
|
||||
library:
|
||||
Movies:
|
||||
operations:
|
||||
genre_mapper:
|
||||
Action:
|
||||
- Action/Adventure
|
||||
- Action & Adventure
|
||||
Comedy: Romantic Comedy
|
||||
"Action/Adventure": Action
|
||||
"Action & Adventure": Action
|
||||
Romantic Comedy: Comedy
|
||||
```
|
||||
|
||||
To just Remove a Genre without replacing it just set the Genre to nothing like this.
|
||||
|
@ -75,12 +64,46 @@ library:
|
|||
Movies:
|
||||
operations:
|
||||
genre_mapper:
|
||||
Action: Action/Adventure, Action & Adventure
|
||||
"Action/Adventure": Action
|
||||
"Action & Adventure": Action
|
||||
Romantic Comedy:
|
||||
```
|
||||
|
||||
This example will change go through every item in your library and change the genre `Action/Adventure` or `Action & Adventure` to `Action` and remove every instance of the Genre `Romantic Comedy`.
|
||||
|
||||
## Content Rating Mapper
|
||||
|
||||
You can use the `content_rating_mapper` operation to map content ratings in your library.
|
||||
|
||||
Each attribute under `content_rating_mapper` is a separate mapping and has two parts.
|
||||
* The key (`PG`, `PG-13` in the example below) is what content ratings you want mapped to the value.
|
||||
* The value (`Y-10` in the example below) is what the content ratings will end up as.
|
||||
|
||||
So this example will change go through every item in your library and change the content rating `PG` or `PG-13` to `Y-10` and `R` to `Y-17`.
|
||||
|
||||
```yaml
|
||||
library:
|
||||
Movies:
|
||||
operations:
|
||||
content_rating_mapper:
|
||||
PG: Y-10
|
||||
"PG-13": Y-10
|
||||
R: Y-17
|
||||
```
|
||||
|
||||
To just Remove a content rating without replacing it just set the content rating to nothing like this.
|
||||
|
||||
```yaml
|
||||
library:
|
||||
Movies:
|
||||
operations:
|
||||
content_rating_mapper:
|
||||
PG: Y-10
|
||||
"PG-13": Y-10
|
||||
R:
|
||||
```
|
||||
|
||||
This example will change go through every item in your library and change the content rating `PG` or `PG-13` to `Y-10` and remove every instance of the content rating `R`.
|
||||
|
||||
## Metadata Backup
|
||||
|
||||
|
|
|
@ -730,30 +730,22 @@ class ConfigFile:
|
|||
logger.error("Config Error: tmdb_collections blank using default settings")
|
||||
if "genre_mapper" in lib["operations"]:
|
||||
if lib["operations"]["genre_mapper"] and isinstance(lib["operations"]["genre_mapper"], dict):
|
||||
params["genre_mapper"] = {}
|
||||
for new_genre, old_genres in lib["operations"]["genre_mapper"].items():
|
||||
if old_genres is None:
|
||||
params["genre_mapper"][new_genre] = old_genres
|
||||
params["genre_mapper"] = lib["operations"]["genre_mapper"]
|
||||
for old_genre, new_genre in lib["operations"]["genre_mapper"].items():
|
||||
if old_genre == new_genre:
|
||||
logger.error("Config Error: genres cannot be mapped to themselves")
|
||||
else:
|
||||
for old_genre in util.get_list(old_genres):
|
||||
if old_genre == new_genre:
|
||||
logger.error("Config Error: genres cannot be mapped to themselves")
|
||||
else:
|
||||
params["genre_mapper"][old_genre] = new_genre
|
||||
params["genre_mapper"][old_genre] = new_genre if new_genre else None
|
||||
else:
|
||||
logger.error("Config Error: genre_mapper is blank")
|
||||
if "content_rating_mapper" in lib["operations"]:
|
||||
if lib["operations"]["content_rating_mapper"] and isinstance(lib["operations"]["content_rating_mapper"], dict):
|
||||
params["content_rating_mapper"] = {}
|
||||
for new_rating, old_ratings in lib["operations"]["content_rating_mapper"].items():
|
||||
if old_ratings is None:
|
||||
params["content_rating_mapper"][new_rating] = old_ratings
|
||||
params["content_rating_mapper"] = lib["operations"]["content_rating_mapper"]
|
||||
for old_content, new_content in lib["operations"]["content_rating_mapper"].items():
|
||||
if old_content == new_content:
|
||||
logger.error("Config Error: content rating cannot be mapped to themselves")
|
||||
else:
|
||||
for old_rating in util.get_list(old_ratings):
|
||||
if old_rating == new_rating:
|
||||
logger.error("Config Error: Content Ratings cannot be mapped to themselves")
|
||||
else:
|
||||
params["content_rating_mapper"][old_rating] = new_rating
|
||||
params["content_rating_mapper"][old_content] = new_content if new_content else None
|
||||
else:
|
||||
logger.error("Config Error: content_rating_mapper is blank")
|
||||
if "genre_collections" in lib["operations"]:
|
||||
|
|
Loading…
Reference in a new issue