#650 added plex_pilots

pull/652/head
meisnate12 3 years ago
parent 1913e3ecc0
commit e9950b4eca

@ -170,11 +170,12 @@ custom_sort_builders = [
"mal_all", "mal_airing", "mal_upcoming", "mal_tv", "mal_movie", "mal_ova", "mal_special", "mal_all", "mal_airing", "mal_upcoming", "mal_tv", "mal_movie", "mal_ova", "mal_special",
"mal_popular", "mal_favorite", "mal_suggested", "mal_userlist", "mal_season", "mal_genre", "mal_studio" "mal_popular", "mal_favorite", "mal_suggested", "mal_userlist", "mal_season", "mal_genre", "mal_studio"
] ]
episode_parts_only = ["plex_pilots"]
parts_collection_valid = [ parts_collection_valid = [
"plex_all", "plex_search", "trakt_list", "trakt_list_details", "collection_mode", "label", "visible_library", "changes_webhooks" "plex_all", "plex_search", "trakt_list", "trakt_list_details", "collection_mode", "label", "visible_library",
"visible_home", "visible_shared", "show_missing", "save_missing", "missing_only_released", "server_preroll", "visible_home", "visible_shared", "show_missing", "save_missing", "missing_only_released", "server_preroll", "changes_webhooks",
"item_lock_background", "item_lock_poster", "item_lock_title", "item_refresh", "item_refresh_delay", "imdb_list" "item_lock_background", "item_lock_poster", "item_lock_title", "item_refresh", "item_refresh_delay", "imdb_list"
] + summary_details + poster_details + background_details + string_details ] + episode_parts_only + summary_details + poster_details + background_details + string_details
playlist_attributes = [ playlist_attributes = [
"filters", "name_mapping", "show_filtered", "show_missing", "save_missing", "filters", "name_mapping", "show_filtered", "show_missing", "save_missing",
"missing_only_released", "only_filter_missing", "delete_below_minimum", "ignore_ids", "ignore_imdb_ids", "missing_only_released", "only_filter_missing", "delete_below_minimum", "ignore_ids", "ignore_imdb_ids",
@ -505,6 +506,8 @@ class CollectionBuilder:
raise Failed(f"{self.Type} Error: {method_final} attribute only allowed for album collections") raise Failed(f"{self.Type} Error: {method_final} attribute only allowed for album collections")
elif not self.library.is_music and method_name in music_only_builders: elif not self.library.is_music and method_name in music_only_builders:
raise Failed(f"{self.Type} Error: {method_final} attribute only allowed for music libraries") raise Failed(f"{self.Type} Error: {method_final} attribute only allowed for music libraries")
elif self.collection_level != "episode" and method_name in episode_parts_only:
raise Failed(f"{self.Type} Error: {method_final} attribute only allowed with Collection Level: episode")
elif self.parts_collection and method_name not in parts_collection_valid: elif self.parts_collection and method_name not in parts_collection_valid:
raise Failed(f"{self.Type} Error: {method_final} attribute not allowed with Collection Level: {self.collection_level.capitalize()}") raise Failed(f"{self.Type} Error: {method_final} attribute not allowed with Collection Level: {self.collection_level.capitalize()}")
elif self.smart and method_name in smart_invalid: elif self.smart and method_name in smart_invalid:
@ -1057,7 +1060,7 @@ class CollectionBuilder:
})) }))
def _plex(self, method_name, method_data): def _plex(self, method_name, method_data):
if method_name == "plex_all": if method_name in ["plex_all", "plex_pilots"]:
self.builders.append((method_name, self.collection_level)) self.builders.append((method_name, self.collection_level))
elif method_name in ["plex_search", "plex_collectionless"]: elif method_name in ["plex_search", "plex_collectionless"]:
for dict_data, dict_methods in self._parse(method_name, method_data, datatype="dictlist"): for dict_data, dict_methods in self._parse(method_name, method_data, datatype="dictlist"):
@ -2091,6 +2094,7 @@ class CollectionBuilder:
path = path[:-1] if path.endswith(('/', '\\')) else path path = path[:-1] if path.endswith(('/', '\\')) else path
tvdb_paths.append((self.library.show_rating_key_map[item.ratingKey], path)) tvdb_paths.append((self.library.show_rating_key_map[item.ratingKey], path))
advance_edits = {} advance_edits = {}
if hasattr(item, "preferences"):
prefs = [p.id for p in item.preferences()] prefs = [p.id for p in item.preferences()]
for method_name, method_data in self.item_details.items(): for method_name, method_data in self.item_details.items():
if method_name in plex.item_advance_keys: if method_name in plex.item_advance_keys:

@ -16,7 +16,7 @@ from xml.etree.ElementTree import ParseError
logger = logging.getLogger("Plex Meta Manager") logger = logging.getLogger("Plex Meta Manager")
builders = ["plex_all", "plex_collectionless", "plex_search"] builders = ["plex_all", "plex_pilots", "plex_collectionless", "plex_search"]
search_translation = { search_translation = {
"episode_title": "episode.title", "episode_title": "episode.title",
"network": "show.network", "network": "show.network",
@ -701,6 +701,14 @@ class Plex(Library):
if method == "plex_all": if method == "plex_all":
logger.info(f"Processing Plex All {data.capitalize()}s") logger.info(f"Processing Plex All {data.capitalize()}s")
items = self.get_all(collection_level=data) items = self.get_all(collection_level=data)
elif method == "plex_pilots":
logger.info(f"Processing Plex Pilot {data.capitalize()}s")
items = []
for item in self.get_all():
try:
items.append(item.episode(season=1, episode=1))
except NotFound:
logger.warning(f"Plex Warning: {item.title} has no Season 1 Episode 1 ")
elif method == "plex_search": elif method == "plex_search":
util.print_multiline(data[1], info=True) util.print_multiline(data[1], info=True)
items = self.get_filter_items(data[2]) items = self.get_filter_items(data[2])

@ -1001,6 +1001,15 @@ def run_playlists(config):
logger.debug(f"Builder: {method}: {value}") logger.debug(f"Builder: {method}: {value}")
logger.info("") logger.info("")
items = [] items = []
if "plex" in method:
ids = []
for pl_library in pl_libraries:
ids.extend(pl_library.get_rating_keys(method, value))
elif "tautulli" in method:
ids = []
for pl_library in pl_libraries:
ids.extend(pl_library.Tautulli.get_rating_keys(pl_library, value, True))
else:
ids = builder.gather_ids(method, value) ids = builder.gather_ids(method, value)
if len(ids) > 0: if len(ids) > 0:

Loading…
Cancel
Save