[23] fix mappers

pull/782/head
meisnate12 3 years ago
parent edb752a403
commit 29ab86267b

@ -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_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 | | `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) | | `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) | | `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 ## 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. 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. 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 key (`Action/Adventure, Action & Adventure` in the example below) is what genres you want mapped to the value.
* The value(`Action/Adventure, Action & Adventure` in the example below) is what genres you want mapped to the key. * 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`. 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,36 +52,58 @@ library:
Movies: Movies:
operations: operations:
genre_mapper: genre_mapper:
Action: Action/Adventure, Action & Adventure "Action/Adventure": Action
Comedy: Romantic Comedy "Action & Adventure": Action
Romantic Comedy: Comedy
``` ```
you can also use a list: To just Remove a Genre without replacing it just set the Genre to nothing like this.
```yaml ```yaml
library: library:
Movies: Movies:
operations: operations:
genre_mapper: genre_mapper:
Action: "Action/Adventure": Action
- Action/Adventure "Action & Adventure": Action
- Action & Adventure Romantic Comedy:
Comedy: Romantic Comedy
``` ```
To just Remove a Genre without replacing it just set the Genre to nothing like this. 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 ```yaml
library: library:
Movies: Movies:
operations: operations:
genre_mapper: content_rating_mapper:
Action: Action/Adventure, Action & Adventure PG: Y-10
Romantic Comedy: "PG-13": Y-10
R: Y-17
``` ```
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`. 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 ## Metadata Backup

@ -730,30 +730,22 @@ class ConfigFile:
logger.error("Config Error: tmdb_collections blank using default settings") logger.error("Config Error: tmdb_collections blank using default settings")
if "genre_mapper" in lib["operations"]: if "genre_mapper" in lib["operations"]:
if lib["operations"]["genre_mapper"] and isinstance(lib["operations"]["genre_mapper"], dict): if lib["operations"]["genre_mapper"] and isinstance(lib["operations"]["genre_mapper"], dict):
params["genre_mapper"] = {} params["genre_mapper"] = lib["operations"]["genre_mapper"]
for new_genre, old_genres in lib["operations"]["genre_mapper"].items(): for old_genre, new_genre in lib["operations"]["genre_mapper"].items():
if old_genres is None: if old_genre == new_genre:
params["genre_mapper"][new_genre] = old_genres logger.error("Config Error: genres cannot be mapped to themselves")
else: else:
for old_genre in util.get_list(old_genres): params["genre_mapper"][old_genre] = new_genre if new_genre else None
if old_genre == new_genre:
logger.error("Config Error: genres cannot be mapped to themselves")
else:
params["genre_mapper"][old_genre] = new_genre
else: else:
logger.error("Config Error: genre_mapper is blank") logger.error("Config Error: genre_mapper is blank")
if "content_rating_mapper" in lib["operations"]: if "content_rating_mapper" in lib["operations"]:
if lib["operations"]["content_rating_mapper"] and isinstance(lib["operations"]["content_rating_mapper"], dict): if lib["operations"]["content_rating_mapper"] and isinstance(lib["operations"]["content_rating_mapper"], dict):
params["content_rating_mapper"] = {} params["content_rating_mapper"] = lib["operations"]["content_rating_mapper"]
for new_rating, old_ratings in lib["operations"]["content_rating_mapper"].items(): for old_content, new_content in lib["operations"]["content_rating_mapper"].items():
if old_ratings is None: if old_content == new_content:
params["content_rating_mapper"][new_rating] = old_ratings logger.error("Config Error: content rating cannot be mapped to themselves")
else: else:
for old_rating in util.get_list(old_ratings): params["content_rating_mapper"][old_content] = new_content if new_content else None
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
else: else:
logger.error("Config Error: content_rating_mapper is blank") logger.error("Config Error: content_rating_mapper is blank")
if "genre_collections" in lib["operations"]: if "genre_collections" in lib["operations"]:

Loading…
Cancel
Save