Allow Blank users

This commit is contained in:
meisnate12 2021-12-28 15:40:33 -05:00
parent b09f0dc366
commit 2b4b557012
3 changed files with 14 additions and 14 deletions

View file

@ -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:

View file

@ -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 = {

View file

@ -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)