From 2b4b557012e298dae7c643efe15fc2dd741445ad Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Tue, 28 Dec 2021 15:40:33 -0500 Subject: [PATCH] Allow Blank users --- config/config.yml.template | 1 + modules/config.py | 2 +- plex_meta_manager.py | 25 ++++++++++++------------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/config/config.yml.template b/config/config.yml.template index a770a3c2..b4d1b994 100644 --- a/config/config.yml.template +++ b/config/config.yml.template @@ -40,6 +40,7 @@ settings: # Can be individually specified tvdb_language: eng ignore_ids: ignore_imdb_ids: + playlist_sync_to_user: all webhooks: # Can be individually specified per library as well error: run_start: diff --git a/modules/config.py b/modules/config.py index e6cf4cac..8f0e3ca7 100644 --- a/modules/config.py +++ b/modules/config.py @@ -247,7 +247,7 @@ class ConfigFile: "tvdb_language": check_for_attribute(self.data, "tvdb_language", parent="settings", default="default"), "ignore_ids": check_for_attribute(self.data, "ignore_ids", parent="settings", var_type="int_list", default_is_none=True), "ignore_imdb_ids": check_for_attribute(self.data, "ignore_imdb_ids", parent="settings", var_type="list", default_is_none=True), - "playlist_sync_to_user": check_for_attribute(self.data, "playlist_sync_to_user", parent="settings", default="all"), + "playlist_sync_to_user": check_for_attribute(self.data, "playlist_sync_to_user", parent="settings", default="all", default_is_none=True), "assets_for_all": check_for_attribute(self.data, "assets_for_all", parent="settings", var_type="bool", default=False, save=False, do_print=False) } self.webhooks = { diff --git a/plex_meta_manager.py b/plex_meta_manager.py index 993c2ea8..6ada4fc8 100644 --- a/plex_meta_manager.py +++ b/plex_meta_manager.py @@ -853,23 +853,22 @@ def run_playlists(config): server_check = pl_library.PlexServer.machineIdentifier sync_to_users = config.general["playlist_sync_to_user"] - if "sync_to_users" not in playlist_attrs: - logger.warning(f"Playlist Error: sync_to_users attribute not found defaulting to playlist_sync_to_user: {sync_to_users}") - elif not playlist_attrs["sync_to_users"]: - logger.warning(f"Playlist Error: sync_to_users attribute is blank defaulting to playlist_sync_to_user: {sync_to_users}") - else: + if "sync_to_users" in playlist_attrs: sync_to_users = playlist_attrs["sync_to_users"] + else: + logger.warning(f"Playlist Error: sync_to_users attribute not found defaulting to playlist_sync_to_user: {sync_to_users}") valid_users = [] plex_users = pl_libraries[0].users - if str(sync_to_users) == "all": - valid_users = plex_users - else: - for user in util.get_list(sync_to_users): - if user in plex_users: - valid_users.append(user) - else: - raise Failed(f"Playlist Error: User: {user} not found in plex\nOptions: {plex_users}") + if sync_to_users: + if str(sync_to_users) == "all": + valid_users = plex_users + else: + for user in util.get_list(sync_to_users): + if user in plex_users: + valid_users.append(user) + else: + raise Failed(f"Playlist Error: User: {user} not found in plex\nOptions: {plex_users}") util.separator(f"Validating {mapping_name} Attributes", space=False, border=False)