Check for response status 200 on jellyfin query

This commit is contained in:
Luigi311
2023-03-08 21:49:56 -07:00
parent 13b4ff3215
commit dc1fe11590
3 changed files with 44 additions and 21 deletions

View File

@@ -18,7 +18,6 @@ load_dotenv(override=True)
def setup_users(
server_1, server_2, blacklist_users, whitelist_users, user_mapping=None
):
# generate list of users from server 1 and server 2
server_1_type = server_1[0]
server_1_connection = server_1[1]
@@ -266,27 +265,45 @@ def update_server_watched(
def should_sync_server(server_1_type, server_2_type):
sync_from_plex_to_jellyfin = str_to_bool(
os.getenv("SYNC_FROM_PLEX_TO_JELLYFIN", "True"))
os.getenv("SYNC_FROM_PLEX_TO_JELLYFIN", "True")
)
sync_from_jelly_to_plex = str_to_bool(
os.getenv("SYNC_FROM_JELLYFIN_TO_PLEX", "True"))
sync_from_plex_to_plex = str_to_bool(
os.getenv("SYNC_FROM_PLEX_TO_PLEX", "True"))
os.getenv("SYNC_FROM_JELLYFIN_TO_PLEX", "True")
)
sync_from_plex_to_plex = str_to_bool(os.getenv("SYNC_FROM_PLEX_TO_PLEX", "True"))
sync_from_jelly_to_jellyfin = str_to_bool(
os.getenv("SYNC_FROM_JELLYFIN_TO_JELLYFIN", "True"))
os.getenv("SYNC_FROM_JELLYFIN_TO_JELLYFIN", "True")
)
if server_1_type == "plex" and server_2_type == "plex" and not sync_from_plex_to_plex:
if (
server_1_type == "plex"
and server_2_type == "plex"
and not sync_from_plex_to_plex
):
logger("Sync between plex and plex is disabled", 1)
return False
if server_1_type == "plex" and server_2_type == "jellyfin" and not sync_from_jelly_to_plex:
if (
server_1_type == "plex"
and server_2_type == "jellyfin"
and not sync_from_jelly_to_plex
):
logger("Sync from jellyfin to plex disabled", 1)
return False
if server_1_type == "jellyfin" and server_2_type == "jellyfin" and not sync_from_jelly_to_jellyfin:
if (
server_1_type == "jellyfin"
and server_2_type == "jellyfin"
and not sync_from_jelly_to_jellyfin
):
logger("Sync between jellyfin and jellyfin is disabled", 1)
return False
if server_1_type == "jellyfin" and server_2_type == "plex" and not sync_from_plex_to_jellyfin:
if (
server_1_type == "jellyfin"
and server_2_type == "plex"
and not sync_from_plex_to_jellyfin
):
logger("Sync from plex to jellyfin is disabled", 1)
return False