From aa5d97a0d529cb96d7c89ee7ef24622acfb09897 Mon Sep 17 00:00:00 2001 From: Lai Jiang Date: Mon, 29 May 2023 21:08:12 -0400 Subject: [PATCH 1/4] Fix a type --- src/black_white.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/black_white.py b/src/black_white.py index e32ee08..5b44c03 100644 --- a/src/black_white.py +++ b/src/black_white.py @@ -15,7 +15,7 @@ def setup_black_white_lists( blacklist_library, blacklist_library_type, blacklist_users, - "White", + "Black", library_mapping, user_mapping, ) @@ -24,7 +24,7 @@ def setup_black_white_lists( whitelist_library, whitelist_library_type, whitelist_users, - "Black", + "White", library_mapping, user_mapping, ) From ff2e2deb20ffb9b80af8f61c628bfd5d2fd19ccc Mon Sep 17 00:00:00 2001 From: Luigi311 Date: Wed, 28 Jun 2023 16:21:07 -0600 Subject: [PATCH 2/4] Jellyfin: Handle missing paths Signed-off-by: Luigi311 --- src/jellyfin.py | 97 ++++++++++++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 41 deletions(-) diff --git a/src/jellyfin.py b/src/jellyfin.py index 78f0484..4f71157 100644 --- a/src/jellyfin.py +++ b/src/jellyfin.py @@ -49,8 +49,11 @@ def get_episode_guids(episode): # Create a dictionary for the episode with its provider IDs and media sources episode_dict = {k.lower(): v for k, v in episode["ProviderIds"].items()} episode_dict["title"] = episode["Name"] - episode_dict["locations"] = tuple( - [x["Path"].split("/")[-1] for x in episode["MediaSources"]] + + episode_dict["locations"] = ( + tuple([x["Path"].split("/")[-1] for x in ["MediaSources"] if "Path" in x]) + if "MediaSources" in episode + else tuple() ) episode_dict["status"] = { @@ -238,7 +241,11 @@ class Jellyfin: k.lower(): v for k, v in show["ProviderIds"].items() } show_guids["title"] = show["Name"] - show_guids["locations"] = tuple([show["Path"].split("/")[-1]]) + show_guids["locations"] = ( + tuple([show["Path"].split("/")[-1]]) + if "Path" in show + else tuple() + ) show_guids = frozenset(show_guids.items()) show_identifiers = { "show_guids": show_guids, @@ -550,24 +557,27 @@ class Jellyfin: if "MediaSources" in jellyfin_video: for movie_location in jellyfin_video["MediaSources"]: - if ( - contains_nested( - movie_location["Path"].split("/")[-1], - videos_movies_ids["locations"], - ) - is not None - ): - for video in videos: - if ( - contains_nested( - movie_location["Path"].split("/")[-1], - video["locations"], - ) - is not None - ): - movie_status = video["status"] - break - break + if "Path" in movie_location: + if ( + contains_nested( + movie_location["Path"].split("/")[-1], + videos_movies_ids["locations"], + ) + is not None + ): + for video in videos: + if ( + contains_nested( + movie_location["Path"].split("/")[ + -1 + ], + video["locations"], + ) + is not None + ): + movie_status = video["status"] + break + break if not movie_status: for ( @@ -697,26 +707,31 @@ class Jellyfin: for episode_location in jellyfin_episode[ "MediaSources" ]: - if ( - contains_nested( - episode_location["Path"].split("/")[-1], - videos_episodes_ids["locations"], - ) - is not None - ): - for episode in episode_videos: - if ( - contains_nested( - episode_location["Path"].split( - "/" - )[-1], - episode["locations"], - ) - is not None - ): - episode_status = episode["status"] - break - break + if "Path" in episode_location: + if ( + contains_nested( + episode_location["Path"].split("/")[ + -1 + ], + videos_episodes_ids["locations"], + ) + is not None + ): + for episode in episode_videos: + if ( + contains_nested( + episode_location[ + "Path" + ].split("/")[-1], + episode["locations"], + ) + is not None + ): + episode_status = episode[ + "status" + ] + break + break if not episode_status: for ( From 29f55104bc22f01f9ffc626172e20517d2a26421 Mon Sep 17 00:00:00 2001 From: Luigi311 Date: Wed, 28 Jun 2023 16:52:23 -0600 Subject: [PATCH 3/4] Jellyfin: Check for provider_source in episode Signed-off-by: Luigi311 --- src/jellyfin.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/jellyfin.py b/src/jellyfin.py index 4f71157..32078bc 100644 --- a/src/jellyfin.py +++ b/src/jellyfin.py @@ -750,15 +750,19 @@ class Jellyfin: ): for episode in episode_videos: if ( - episode_provider_id.lower() - in episode[ - episode_provider_source.lower() - ] + episode_provider_source.lower() + in episode ): - episode_status = episode[ - "status" - ] - break + if ( + episode_provider_id.lower() + in episode[ + episode_provider_source.lower() + ] + ): + episode_status = episode[ + "status" + ] + break break if episode_status: From 81e967864dfbdb201b759c40cb43df4f5c901c7e Mon Sep 17 00:00:00 2001 From: Luigi311 Date: Wed, 28 Jun 2023 16:55:56 -0600 Subject: [PATCH 4/4] Disable fast fail Signed-off-by: Luigi311 --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 826a647..4dcee0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,7 @@ jobs: runs-on: ubuntu-latest needs: pytest strategy: + fail-fast: false matrix: include: - dockerfile: Dockerfile.alpine