Merge pull request #90 from luigi311/dev

Fix missing paths and providers
This commit is contained in:
Luigi311
2023-06-30 19:41:16 -06:00
committed by GitHub
3 changed files with 71 additions and 51 deletions

View File

@@ -25,6 +25,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: pytest needs: pytest
strategy: strategy:
fail-fast: false
matrix: matrix:
include: include:
- dockerfile: Dockerfile.alpine - dockerfile: Dockerfile.alpine

View File

@@ -15,7 +15,7 @@ def setup_black_white_lists(
blacklist_library, blacklist_library,
blacklist_library_type, blacklist_library_type,
blacklist_users, blacklist_users,
"White", "Black",
library_mapping, library_mapping,
user_mapping, user_mapping,
) )
@@ -24,7 +24,7 @@ def setup_black_white_lists(
whitelist_library, whitelist_library,
whitelist_library_type, whitelist_library_type,
whitelist_users, whitelist_users,
"Black", "White",
library_mapping, library_mapping,
user_mapping, user_mapping,
) )

View File

@@ -49,8 +49,11 @@ def get_episode_guids(episode):
# Create a dictionary for the episode with its provider IDs and media sources # 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 = {k.lower(): v for k, v in episode["ProviderIds"].items()}
episode_dict["title"] = episode["Name"] 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"] = { episode_dict["status"] = {
@@ -238,7 +241,11 @@ class Jellyfin:
k.lower(): v for k, v in show["ProviderIds"].items() k.lower(): v for k, v in show["ProviderIds"].items()
} }
show_guids["title"] = show["Name"] 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_guids = frozenset(show_guids.items())
show_identifiers = { show_identifiers = {
"show_guids": show_guids, "show_guids": show_guids,
@@ -550,6 +557,7 @@ class Jellyfin:
if "MediaSources" in jellyfin_video: if "MediaSources" in jellyfin_video:
for movie_location in jellyfin_video["MediaSources"]: for movie_location in jellyfin_video["MediaSources"]:
if "Path" in movie_location:
if ( if (
contains_nested( contains_nested(
movie_location["Path"].split("/")[-1], movie_location["Path"].split("/")[-1],
@@ -560,7 +568,9 @@ class Jellyfin:
for video in videos: for video in videos:
if ( if (
contains_nested( contains_nested(
movie_location["Path"].split("/")[-1], movie_location["Path"].split("/")[
-1
],
video["locations"], video["locations"],
) )
is not None is not None
@@ -697,9 +707,12 @@ class Jellyfin:
for episode_location in jellyfin_episode[ for episode_location in jellyfin_episode[
"MediaSources" "MediaSources"
]: ]:
if "Path" in episode_location:
if ( if (
contains_nested( contains_nested(
episode_location["Path"].split("/")[-1], episode_location["Path"].split("/")[
-1
],
videos_episodes_ids["locations"], videos_episodes_ids["locations"],
) )
is not None is not None
@@ -707,14 +720,16 @@ class Jellyfin:
for episode in episode_videos: for episode in episode_videos:
if ( if (
contains_nested( contains_nested(
episode_location["Path"].split( episode_location[
"/" "Path"
)[-1], ].split("/")[-1],
episode["locations"], episode["locations"],
) )
is not None is not None
): ):
episode_status = episode["status"] episode_status = episode[
"status"
]
break break
break break
@@ -734,6 +749,10 @@ class Jellyfin:
] ]
): ):
for episode in episode_videos: for episode in episode_videos:
if (
episode_provider_source.lower()
in episode
):
if ( if (
episode_provider_id.lower() episode_provider_id.lower()
in episode[ in episode[