[44] update advance preferences

pull/1949/head
meisnate12 8 months ago
parent a92ee5de67
commit 3af4af8f5a

@ -23,6 +23,7 @@ Mass Update operations now can be given a list of sources to fall back on when o
`plex` attributes `clean_bundles`, `empty_trash`, and `optimize` can now take any schedule options to be run only when desired.
Allows users to use the Admin username when specifying playlist users. Thanks @benbou8231!
Allows `verify_ssl` to be set specifically for plex. Thanks @FestiveKyle!
Updated Plex Item Advance Preferences
# Defaults

@ -1 +1 @@
1.20.0-develop43
1.20.0-develop44

@ -27,11 +27,15 @@ All the following attributes update various details of the metadata for every it
| `item_tmdb_season_titles` | **Description:** Changes the season titles of every show in the collection to match TMDb<br>**Default:** `false`<br>**Values:** `true` or `false` |
| `item_episode_sorting`<sup>1</sup> | **Description:** Changes the episode sorting of every show in the collection<br>**Values:**<table class="clearTable"><tr><td>`default`</td><td>Library default</td></tr><tr><td>`oldest`</td><td>Oldest first</td></tr><tr><td>`newest`</td><td>Newest first</td></tr></table> |
| `item_keep_episodes`<sup>1</sup> | **Description:** Changes the keep episodes of every show in the collection<br>**Values:**<table class="clearTable"><tr><td>`all`</td><td>All episodes</td></tr><tr><td>`5_latest`</td><td>5 latest episodes</td></tr><tr><td>`3_latest`</td><td>3 latest episodes</td></tr><tr><td>`latest`</td><td>Latest episodes</td></tr><tr><td>`past_3`</td><td>Episodes added in the past 3 days</td></tr><tr><td>`past_7`</td><td>Episodes added in the past 7 days</td></tr><tr><td>`past_30`</td><td>Episodes added in the past 30 days</td></tr></table> |
| `item_delete_episodes`<sup>1</sup> | **Description:** Changes the delete episodes of every show in the collection<br>**Values:**<table class="clearTable"><tr><td>`never`</td><td>Never</td></tr><tr><td>`day`</td><td>After a day</td></tr><tr><td>`week`</td><td>After a week</td></tr><tr><td>`refresh`</td><td>On next refresh</td></tr></table> |
| `item_delete_episodes`<sup>1</sup> | **Description:** Changes the delete episodes of every show in the collection<br>**Values:**<table class="clearTable"><tr><td>`never`</td><td>Never</td></tr><tr><td>`day`</td><td>After a day</td></tr><tr><td>`week`</td><td>After a week</td></tr><tr><td>`month`</td><td>After a month</td></tr><tr><td>`refresh`</td><td>On next refresh</td></tr></table> |
| `item_season_display`<sup>1</sup> | **Description:** Changes the season display of every show in the collection<br>**Values:**<table class="clearTable"><tr><td>`default`</td><td>Library default</td></tr><tr><td>`show`</td><td>Show</td></tr><tr><td>`hide`</td><td>Hide</td></tr></table> |
| `item_episode_ordering`<sup>1</sup> | **Description:** Changes the episode ordering of every show in the collection<br>**Values:**<table class="clearTable"><tr><td>`default`</td><td>Library default</td></tr><tr><td>`tmdb_aired`</td><td>The Movie Database (Aired)</td></tr><tr><td>`tvdb_aired`</td><td>TheTVDb (Aired)</td></tr><tr><td>`tvdb_dvd`</td><td>TheTVDb (DVD)</td></tr><tr><td>`tvdb_absolute`</td><td>TheTVDb (Absolute)</td></tr></table> |
| `item_metadata_language`<sup>2</sup> | **Description:** Changes the metadata language of every movie/show in the collection<br>**Values:** `default`, `ar-SA`, `ca-ES`, `cs-CZ`, `da-DK`, `de-DE`, `el-GR`, `en-AU`, `en-CA`, `en-GB`, `en-US`, `es-ES`, `es-MX`, `et-EE`, `fa-IR`, `fi-FI`, `fr-CA`, `fr-FR`, `he-IL`, `hi-IN`, `hu-HU`, `id-ID`, `it-IT`, `ja-JP`, `ko-KR`, `lt-LT`, `lv-LV`, `nb-NO`, `nl-NL`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sv-SE`, `th-TH`, `tr-TR`, `uk-UA`, `vi-VN`, `zh-CN`, `zh-HK`, `zh-TW` |
| `item_use_original_title`<sup>2</sup> | **Description:** Changes the use original title of every movie/show in the collection<br>**Values:**<table class="clearTable"><tr><td>`default`</td><td>Library default</td></tr><tr><td>`no`</td><td>No</td></tr><tr><td>`yes`</td><td>Yes</td></tr></table> |
| `item_credits_detection`<sup>2</sup> | **Description:** Changes the enable credits detection of every movie/show in the collection<br>**Values:**<table class="clearTable"><tr><td>`default`</td><td>Library default</td></tr><tr><td>`disabled`</td><td>Disabled</td></tr></table> |
| `item_audio_language`<sup>2</sup> | **Description:** Changes the preferred audio language of every movie/show in the collection<br>**Values:** `default`, `en`, `ar-SA`, `ca-ES`, `cs-CZ`, `da-DK`, `de-DE`, `el-GR`, `en-AU`, `en-CA`, `en-GB`, `en-US`, `es-ES`, `es-MX`, `et-EE`, `fa-IR`, `fi-FI`, `fr-CA`, `fr-FR`, `he-IL`, `hi-IN`, `hu-HU`, `id-ID`, `it-IT`, `ja-JP`, `ko-KR`, `lt-LT`, `lv-LV`, `nb-NO`, `nl-NL`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sv-SE`, `th-TH`, `tr-TR`, `uk-UA`, `vi-VN`, `zh-CN`, `zh-HK`, `zh-TW` |
| `item_subtitle_language`<sup>2</sup> | **Description:** Changes the preferred subtitle language of every movie/show in the collection<br>**Values:** `default`, `en`, `ar-SA`, `ca-ES`, `cs-CZ`, `da-DK`, `de-DE`, `el-GR`, `en-AU`, `en-CA`, `en-GB`, `en-US`, `es-ES`, `es-MX`, `et-EE`, `fa-IR`, `fi-FI`, `fr-CA`, `fr-FR`, `he-IL`, `hi-IN`, `hu-HU`, `id-ID`, `it-IT`, `ja-JP`, `ko-KR`, `lt-LT`, `lv-LV`, `nb-NO`, `nl-NL`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sv-SE`, `th-TH`, `tr-TR`, `uk-UA`, `vi-VN`, `zh-CN`, `zh-HK`, `zh-TW` |
| `item_subtitle_mode`<sup>2</sup> | **Description:** Changes the auto-select subtitle mode of every movie/show in the collection<br>**Values:**<table class="clearTable"><tr><td>`default`</td><td>Account default</td></tr><tr><td>`manual`</td><td>Manually selected</td></tr><tr><td>`foreign`</td><td>Shown with foreign audio</td></tr><tr><td>`always`</td><td>Always enabled</td></tr></table> |
<sup>1</sup> Only works with TV Show Libraries

@ -465,16 +465,17 @@ You can add `.sync` to any tag attribute to sync all tags vs just appending the
| <div style="width:200px">Attribute</div> | Allowed Values | <div style="width:110px">Item Types</div> |
|:-----------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------|
| `metadata_language`<sup>1</sup> | `default`, `ar-SA`, `ca-ES`, `cs-CZ`, `da-DK`, `de-DE`, `el-GR`, `en-AU`, `en-CA`, `en-GB`, `en-US`, `es-ES`, `es-MX`, `et-EE`, `fa-IR`, `fi-FI`, `fr-CA`, `fr-FR`, `he-IL`, `hi-IN`, `hu-HU`, `id-ID`, `it-IT`, `ja-JP`, `ko-KR`, `lt-LT`, `lv-LV`, `nb-NO`, `nl-NL`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sv-SE`, `th-TH`, `tr-TR`, `uk-UA`, `vi-VN`, `zh-CN`, `zh-HK`, `zh-TW` | `Movies` |
| `use_original_title`<sup>1</sup> | `default`: Library default<br>`no`: No<br>`yes`: Yes | `Movies` |
| `episode_sorting` | <table class="clearTable"><tbody><tr><td>`default`</td><td>Library default</td></tr><tr><td>`oldest`</td><td>Oldest first</td></tr><tr><td>`newest`</td><td>Newest first</td></tr></tbody></table> | `Shows` |
| `keep_episodes` | <table class="clearTable"><tbody><tr><td>`all`</td><td>All episodes</td></tr><tr><td>`5_latest`</td><td>5 latest episodes</td></tr><tr><td>`3_latest`</td><td>3 latest episodes</td></tr><tr><td>`latest`</td><td>Latest episodes</td></tr><tr><td>`past_3`</td><td>Episodes added in the past 3 days</td></tr><tr><td>`past_7`</td><td>Episodes added in the past 7 days</td></tr><tr><td>`past_30`</td><td>Episodes added in the past 30 days</td></tr></tbody></table> | `Shows` |
| `delete_episodes` | <table class="clearTable"><tbody><tr><td>`never`</td><td>Never</td></tr><tr><td>`day`</td><td>After a day</td></tr><tr><td>`week`</td><td>After a week</td></tr><tr><td>`refresh`</td><td>On next refresh</td></tr></tbody></table> | `Shows` |
| `season_display` | <table class="clearTable"><tbody><tr><td>`default`</td><td>Library default</td></tr><tr><td>`show`</td><td>Show</td></tr><tr><td>`hide`</td><td>Hide</td></tr></tbody></table> | `Shows` |
| `episode_ordering` | <table class="clearTable"><tbody><tr><td>`default`</td><td>Library default</td></tr><tr><td>`tmdb_aired`</td><td>The Movie Database (Aired)</td></tr><tr><td>`tvdb_aired`</td><td>TheTVDb (Aired)</td></tr><tr><td>`tvdb_dvd`</td><td>TheTVDb (DVD)</td></tr><tr><td>`tvdb_absolute`</td><td>TheTVDb (Absolute)</td></tr></tbody></table> | `Shows` |
| `metadata_language`<sup>2</sup> | `default`, `ar-SA`, `ca-ES`, `cs-CZ`, `da-DK`, `de-DE`, `el-GR`, `en-AU`, `en-CA`, `en-GB`, `en-US`, `es-ES`, `es-MX`, `et-EE`, `fa-IR`, `fi-FI`, `fr-CA`, `fr-FR`, `he-IL`, `hi-IN`, `hu-HU`, `id-ID`, `it-IT`, `ja-JP`, `ko-KR`, `lt-LT`, `lv-LV`, `nb-NO`, `nl-NL`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sv-SE`, `th-TH`, `tr-TR`, `uk-UA`, `vi-VN`, `zh-CN`, `zh-HK`, `zh-TW` | `Shows` |
| `use_original_title`<sup>2</sup> | <table class="clearTable"><tbody><tr><td>`default`</td><td>Library default</td></tr><tr><td>`no`</td><td>No</td></tr><tr><td>`yes`</td><td>Yes</td></tr></tbody></table> | `Shows` |
| `album_sorting` | <table class="clearTable"><tbody><tr><td>`default`</td><td>Library default</td></tr><tr><td>`oldest`</td><td>Oldest first</td></tr><tr><td>`newest`</td><td>Newest first</td></tr><tr><td>`name`</td><td>Alphabetical</td></tr></tbody></table> | `Artists` |
1. Must be using the **New Plex Movie Agent**.
2. Must be using the **New Plex TV Agent**
| `metadata_language`<sup>1</sup> | `default`, `ar-SA`, `ca-ES`, `cs-CZ`, `da-DK`, `de-DE`, `el-GR`, `en-AU`, `en-CA`, `en-GB`, `en-US`, `es-ES`, `es-MX`, `et-EE`, `fa-IR`, `fi-FI`, `fr-CA`, `fr-FR`, `he-IL`, `hi-IN`, `hu-HU`, `id-ID`, `it-IT`, `ja-JP`, `ko-KR`, `lt-LT`, `lv-LV`, `nb-NO`, `nl-NL`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sv-SE`, `th-TH`, `tr-TR`, `uk-UA`, `vi-VN`, `zh-CN`, `zh-HK`, `zh-TW` | `Movies`, `Shows` |
| `use_original_title`<sup>1</sup> | <table class="clearTable"><tbody><tr><td>`default`</td><td>Library default</td></tr><tr><td>`no`</td><td>No</td></tr><tr><td>`yes`</td><td>Yes</td></tr></tbody></table> | `Movies`, `Shows` |
| `credits_detection`<sup>1</sup> | <table class="clearTable"><tbody><tr><td>`default`</td><td>Library default</td></tr><tr><td>`disabled`</td><td>Disabled</td></tr></tbody></table> | `Movies`, `Shows` |
| `audio_language`<sup>1</sup> | `default`, `en`, `ar-SA`, `ca-ES`, `cs-CZ`, `da-DK`, `de-DE`, `el-GR`, `en-AU`, `en-CA`, `en-GB`, `en-US`, `es-ES`, `es-MX`, `et-EE`, `fa-IR`, `fi-FI`, `fr-CA`, `fr-FR`, `he-IL`, `hi-IN`, `hu-HU`, `id-ID`, `it-IT`, `ja-JP`, `ko-KR`, `lt-LT`, `lv-LV`, `nb-NO`, `nl-NL`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sv-SE`, `th-TH`, `tr-TR`, `uk-UA`, `vi-VN`, `zh-CN`, `zh-HK`, `zh-TW` | `Shows`, `Seasons` |
| `subtitle_language`<sup>1</sup> | `default`, `en`, `ar-SA`, `ca-ES`, `cs-CZ`, `da-DK`, `de-DE`, `el-GR`, `en-AU`, `en-CA`, `en-GB`, `en-US`, `es-ES`, `es-MX`, `et-EE`, `fa-IR`, `fi-FI`, `fr-CA`, `fr-FR`, `he-IL`, `hi-IN`, `hu-HU`, `id-ID`, `it-IT`, `ja-JP`, `ko-KR`, `lt-LT`, `lv-LV`, `nb-NO`, `nl-NL`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sv-SE`, `th-TH`, `tr-TR`, `uk-UA`, `vi-VN`, `zh-CN`, `zh-HK`, `zh-TW` | `Shows`, `Seasons` |
| `subtitle_mode`<sup>1</sup> | <table class="clearTable"><tbody><tr><td>`default`</td><td>Account default</td></tr><tr><td>`no`</td><td>No</td></tr><tr><td>`yes`</td><td>Yes</td></tr></tbody></table> | `Shows`, `Seasons` |
| `album_sorting` | <table class="clearTable"><tbody><tr><td>`default`</td><td>Library default</td></tr><tr><td>`manual`</td><td>Manually selected</td></tr><tr><td>`foreign`</td><td>Shown with foreign audio</td></tr><tr><td>`always`</td><td>Always enabled</td></tr></tbody></table> | `Artists` |
1. Must be using the **New Plex Movie Agent** or the **New Plex TV Agent**

@ -1924,6 +1924,29 @@ class MetadataFile(DataFile):
title=f"{item.title} Season {season.seasonNumber}",
image_name=f"Season{'0' if season.seasonNumber < 10 else ''}{season.seasonNumber}",
folder_name=folder_name, style_data=season_style_data)
advance_edits = {}
prefs = None
for advance_edit in util.advance_tags_to_edit["Season"]:
if advance_edit in season_methods:
if season_dict[season_methods[advance_edit]]:
ad_key, options = plex.item_advance_keys[f"item_{advance_edit}"]
method_data = str(season_dict[season_methods[advance_edit]]).lower()
if prefs is None:
prefs = [p.id for p in season.preferences()]
if method_data not in options:
logger.error(f"{self.type_str} Error: {meta[methods[advance_edit]]} {advance_edit} attribute invalid")
elif ad_key in prefs and getattr(season, ad_key) != options[method_data]:
advance_edits[ad_key] = options[method_data]
logger.info(f"Metadata: {advance_edit} updated to {method_data}")
else:
logger.error(f"{self.type_str} Error: {advance_edit} attribute is blank")
if advance_edits:
if self.library.edit_advance(season, advance_edits):
updated = True
logger.info("Advanced Metadata Update Successful")
else:
logger.error("Advanced Metadata Update Failed")
if ups:
updated = True
logger.info(f"Season {season_id} of {mapping_name} Metadata Update {'Complete' if updated else 'Not Needed'}")

@ -209,7 +209,7 @@ date_sub_mods = {"s": "Seconds", "m": "Minutes", "h": "Hours", "d": "Days", "w":
album_sorting_options = {"default": -1, "newest": 0, "oldest": 1, "name": 2}
episode_sorting_options = {"default": -1, "oldest": 0, "newest": 1}
keep_episodes_options = {"all": 0, "5_latest": 5, "3_latest": 3, "latest": 1, "past_3": -3, "past_7": -7, "past_30": -30}
delete_episodes_options = {"never": 0, "day": 1, "week": 7, "refresh": 100}
delete_episodes_options = {"never": 0, "day": 1, "week": 7, "month": 30, "refresh": 100}
season_display_options = {"default": -1, "show": 0, "hide": 1}
episode_ordering_options = {"default": None, "tmdb_aired": "tmdbAiring", "tvdb_aired": "aired", "tvdb_dvd": "dvd", "tvdb_absolute": "absolute"}
plex_languages = ["default", "ar-SA", "ca-ES", "cs-CZ", "da-DK", "de-DE", "el-GR", "en-AU", "en-CA", "en-GB", "en-US",
@ -219,6 +219,12 @@ plex_languages = ["default", "ar-SA", "ca-ES", "cs-CZ", "da-DK", "de-DE", "el-GR
metadata_language_options = {lang.lower(): lang for lang in plex_languages}
metadata_language_options["default"] = None
use_original_title_options = {"default": -1, "no": 0, "yes": 1}
credits_detection_options = {"default": -1, "disabled": 0}
audio_language_options = {lang.lower(): lang for lang in plex_languages}
audio_language_options["en"] = "en"
subtitle_language_options = {lang.lower(): lang for lang in plex_languages}
subtitle_language_options["en"] = "en"
subtitle_mode_options = {"default": -1, "manual": 0, "foreign": 1, "always": 2}
collection_order_options = ["release", "alpha", "custom"]
collection_filtering_options = ["user", "admin"]
collection_mode_options = {
@ -239,7 +245,11 @@ item_advance_keys = {
"item_season_display": ("flattenSeasons", season_display_options),
"item_episode_ordering": ("showOrdering", episode_ordering_options),
"item_metadata_language": ("languageOverride", metadata_language_options),
"item_use_original_title": ("useOriginalTitle", use_original_title_options)
"item_use_original_title": ("useOriginalTitle", use_original_title_options),
"item_credits_detection": ("enableCreditsMarkerGeneration", credits_detection_options),
"item_audio_language": ("audioLanguage", audio_language_options),
"item_subtitle_language": ("subtitleLanguage", subtitle_language_options),
"item_subtitle_mode": ("subtitleMode", subtitle_mode_options)
}
new_plex_agents = ["tv.plex.agents.movie", "tv.plex.agents.series"]
and_searches = [
@ -1514,7 +1524,9 @@ class Plex(Library):
imdb_id = self.get_imdb_from_map(item)
return tmdb_id, tvdb_id, imdb_id
def get_locked_attributes(self, item, titles=None, year_titles=None):
def get_locked_attributes(self, item, titles=None, year_titles=None, item_type=None):
if not item_type:
item_type = self.type
item = self.reload(item)
attrs = {}
match_dict = {}
@ -1590,8 +1602,8 @@ class Plex(Library):
check_field("mood", "mood", var_key="moods")
check_field("style", "style", var_key="styles")
check_field("similar", "similar_artist")
if self.type in util.advance_tags_to_edit:
for advance_edit in util.advance_tags_to_edit[self.type]:
if item_type in util.advance_tags_to_edit:
for advance_edit in util.advance_tags_to_edit[item_type]:
key, options = item_advance_keys[f"item_{advance_edit}"]
if advance_edit in self.metadata_backup["exclude"] or not hasattr(item, key):
continue
@ -1599,10 +1611,10 @@ class Plex(Library):
if keys[getattr(item, key)] not in ["default", "all", "never"]:
attrs[advance_edit] = keys[getattr(item, key)]
def _recur(sub):
def _recur(sub, item_type_in=None):
sub_items = {}
for sub_item in getattr(item, sub)():
sub_item_key, sub_item_attrs = self.get_locked_attributes(sub_item)
sub_item_key, sub_item_attrs = self.get_locked_attributes(sub_item, item_type=item_type_in)
if sub_item_attrs:
sub_items[sub_item_key] = sub_item_attrs
if sub_items:
@ -1611,7 +1623,7 @@ class Plex(Library):
if isinstance(item, Show):
_recur("seasons")
elif isinstance(item, Season):
_recur("episodes")
_recur("episodes", item_type_in="Season")
elif isinstance(item, Artist):
_recur("albums")
elif isinstance(item, Album):

@ -84,8 +84,9 @@ pretty_months = {
lower_months = {v.lower(): k for k, v in pretty_months.items()}
seasons = ["current", "winter", "spring", "summer", "fall"]
advance_tags_to_edit = {
"Movie": ["metadata_language", "use_original_title"],
"Show": ["episode_sorting", "keep_episodes", "delete_episodes", "season_display", "episode_ordering", "metadata_language", "use_original_title"],
"Movie": ["metadata_language", "use_original_title", "credits_detection"],
"Show": ["episode_sorting", "keep_episodes", "delete_episodes", "season_display", "episode_ordering", "metadata_language", "use_original_title", "credits_detection", "audio_language", "subtitle_language", "subtitle_mode"],
"Season": ["audio_language", "subtitle_language", "subtitle_mode"],
"Artist": ["album_sorting"]
}
tags_to_edit = {

Loading…
Cancel
Save