[9] #793 Fixed KeyError

This commit is contained in:
meisnate12 2022-03-18 23:06:51 -04:00
parent a7bf1e54ff
commit e5f0bea8d6
4 changed files with 32 additions and 31 deletions

View file

@ -1 +1 @@
1.16.2-develop8
1.16.2-develop9

View file

@ -23,10 +23,10 @@ radarr:
plex_path: /share/CACHEDEV1_DATA/Multimedia
```
| Attribute | Allowed Values | Default | Required |
|:-------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------:|:--------:|
| `url` | Radarr URL (Including URL Base if set).<br>**Example:** http://192.168.1.12:32788 | N/A | &#9989; |
| `token` | Radarr API Token. | N/A | &#9989; |
| Attribute | Allowed Values | Default | Required |
|:-------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------:|:--------:|
| `url` | Radarr URL (Including URL Base if set).<br>**Example:** http://192.168.1.12:32788 | N/A | &#9989; |
| `token` | Radarr API Token. | N/A | &#9989; |
| `add_missing` | Adds all missing movies found from all collections to Radarr.<br>Use the `radarr_add_missing` [Radarr Details](../metadata/details/arr.md#radarr-details) in the collection definition to add missing per collection.<br>**boolean:** true or false | false | &#10060; |
| `add_existing` | Adds all existing movies in collections to Radarr.<br>Use the `radarr_add_existing` [Radarr Details](../metadata/details/arr.md#radarr-details) in the collection definition to add existing per collection.<br>**boolean:** true or false | false | &#10060; |
| `root_folder_path` | Default Root Folder Path to use when adding new movies.<br>Use the `radarr_folder` [Radarr Details](../metadata/details/arr.md#radarr-details) in the collection definition to set the Root Folder per collection. | N/A | &#9989; |
@ -35,8 +35,8 @@ radarr:
| `quality_profile` | Default Quality Profile to use when adding new movies.<br>Use the `radarr_quality` [Radarr Details](../metadata/details/arr.md#radarr-details) in the collection definition to set the Quality Profile per collection. | N/A | &#10060; |
| `tag` | Default this list or comma-separated string of tags to use when adding new movies.<br>Use the `radarr_tag` [Radarr Details](../metadata/details/arr.md#radarr-details) in the collection definition to set the Tags per collection. | ` ` | &#10060; |
| `search` | Start search for missing movie when adding new movies.<br>Use the `radarr_search` [Radarr Details](../metadata/details/arr.md#radarr-details) in the collection definition to set the search value per collection.<br>**boolean:** true or false | false | &#10060; |
| `plex_path` | When using `add_existing` or `radarr_add_all` Convert this part of the path to `radarr_path`. | ` ` | &#10060; |
| `radarr_path` | When using `add_existing` or `radarr_add_all` Convert the `plex_path` part of the path to this. | ` ` | &#10060; |
| `plex_path` | When using `add_existing` or `radarr_add_all` Convert this part of the path to `radarr_path`. | ` ` | &#10060; |
| `radarr_path` | When using `add_existing` or `radarr_add_all` Convert the `plex_path` part of the path to this. | ` ` | &#10060; |
* The `token` can be found by going to `Radarr > Settings > General > Security > API Key`

View file

@ -26,10 +26,10 @@ sonarr:
plex_path: /share/CACHEDEV1_DATA/Multimedia
```
| Attribute | Allowed Values | Default | Required |
|:-------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------:|:--------:|
| `url` | Sonarr URL (Including URL Base if set).<br>**Example:** http://192.168.1.12:32788 | N/A | &#9989; |
| `token` | Sonarr API Token. | N/A | &#9989; |
| Attribute | Allowed Values | Default | Required |
|:-------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------:|:--------:|
| `url` | Sonarr URL (Including URL Base if set).<br>**Example:** http://192.168.1.12:32788 | N/A | &#9989; |
| `token` | Sonarr API Token. | N/A | &#9989; |
| `add_missing` | Adds all missing shows found from all collections to Sonarr.<br>Use the `sonarr_add_missing` [Sonarr Details](../metadata/details/arr.md#sonarr-details) in the collection definition to add missing per collection.<br>**boolean:** true or false | false | &#10060; |
| `add_existing` | Adds all existing shows in collections to Sonarr.<br>Use the `sonarr_add_existing` [Sonarr Details](../metadata/details/arr.md#sonarr-details) in the collection definition to add existing per collection.<br>**boolean:** true or false | false | &#10060; |
| `root_folder_path` | Default Root Folder Path to use when adding new shows.<br>Use the `sonarr_folder` [Sonarr Details](../metadata/details/arr.md#sonarr-details) in the collection definition to set the Root Folder per collection. | N/A | &#9989; |
@ -41,8 +41,8 @@ sonarr:
| `tag` | Default this list or comma-separated string of tags to use when adding new shows.<br>Use the `sonarr_tag` [Sonarr Details](../metadata/details/arr.md#sonarr-details) in the collection definition to set the tags per collection. | ` ` | &#10060; |
| `search` | Start search for missing episodes when adding new shows.<br>Use the `sonarr_search` [Sonarr Details](../metadata/details/arr.md#sonarr-details) in the collection definition to set the search value per collection.<br>**boolean:** true or false | false | &#10060; |
| `cutoff_search` | Start search for cutoff unmet episodes when adding new shows.<br>Use the `sonarr_cutoff_search` [Sonarr Details](../metadata/details/arr.md#sonarr-details) in the collection definition to set the cutoff search value per collection.<br>**boolean:** true or false | false | &#10060; |
| `plex_path` | When using `add_existing` or `sonarr_add_all` Convert this part of the path to `sonarr_path`. | ` ` | &#10060; |
| `sonarr_path` | When using `add_existing` or `sonarr_add_all` Convert the `plex_path` part of the path to this. | ` ` | &#10060; |
| `plex_path` | When using `add_existing` or `sonarr_add_all` Convert this part of the path to `sonarr_path`. | ` ` | &#10060; |
| `sonarr_path` | When using `add_existing` or `sonarr_add_all` Convert the `plex_path` part of the path to this. | ` ` | &#10060; |
* The `token` can be found by going to `Sonarr > Settings > General > Security > API Key`

View file

@ -694,24 +694,25 @@ class MetadataFile(DataFile):
if self.library.edit_item(item, mapping_name, self.library.type, edits):
updated = True
advance_edits = {}
prefs = [p.id for p in item.preferences()]
for advance_edit in util.advance_tags_to_edit[self.library.type]:
if advance_edit in methods:
if advance_edit in ["metadata_language", "use_original_title"] and self.library.agent not in plex.new_plex_agents:
logger.error(f"Metadata Error: {advance_edit} attribute only works for with the New Plex Movie Agent and New Plex TV Agent")
elif meta[methods[advance_edit]]:
key, options = plex.item_advance_keys[f"item_{advance_edit}"]
method_data = str(meta[methods[advance_edit]]).lower()
if method_data not in options:
logger.error(f"Metadata Error: {meta[methods[advance_edit]]} {advance_edit} attribute invalid")
elif key in prefs and getattr(item, key) != options[method_data]:
advance_edits[key] = options[method_data]
logger.info(f"Detail: {advance_edit} updated to {method_data}")
else:
logger.error(f"Metadata Error: {advance_edit} attribute is blank")
if self.library.edit_item(item, mapping_name, self.library.type, advance_edits, advanced=True):
updated = True
if self.library.type in util.advance_tags_to_edit:
advance_edits = {}
prefs = [p.id for p in item.preferences()]
for advance_edit in util.advance_tags_to_edit[self.library.type]:
if advance_edit in methods:
if advance_edit in ["metadata_language", "use_original_title"] and self.library.agent not in plex.new_plex_agents:
logger.error(f"Metadata Error: {advance_edit} attribute only works for with the New Plex Movie Agent and New Plex TV Agent")
elif meta[methods[advance_edit]]:
key, options = plex.item_advance_keys[f"item_{advance_edit}"]
method_data = str(meta[methods[advance_edit]]).lower()
if method_data not in options:
logger.error(f"Metadata Error: {meta[methods[advance_edit]]} {advance_edit} attribute invalid")
elif key in prefs and getattr(item, key) != options[method_data]:
advance_edits[key] = options[method_data]
logger.info(f"Detail: {advance_edit} updated to {method_data}")
else:
logger.error(f"Metadata Error: {advance_edit} attribute is blank")
if self.library.edit_item(item, mapping_name, self.library.type, advance_edits, advanced=True):
updated = True
for tag_edit in util.tags_to_edit[self.library.type]:
if self.edit_tags(tag_edit, item, meta, methods, extra=genres if tag_edit == "genre" else None):