Skip library before erroring for multiple types.
This commit is contained in:
@@ -168,8 +168,13 @@ def check_skip_logic(
|
||||
):
|
||||
skip_reason = None
|
||||
|
||||
if library_type.lower() in blacklist_library_type:
|
||||
skip_reason = "is blacklist_library_type"
|
||||
if type(library_type) in [list, tuple, set]:
|
||||
for library_type_item in library_type:
|
||||
if library_type_item.lower() in blacklist_library_type:
|
||||
skip_reason = "is blacklist_library_type"
|
||||
else:
|
||||
if library_type.lower() in blacklist_library_type:
|
||||
skip_reason = "is blacklist_library_type"
|
||||
|
||||
if library_title.lower() in [x.lower() for x in blacklist_library]:
|
||||
skip_reason = "is blacklist_library"
|
||||
@@ -182,8 +187,13 @@ def check_skip_logic(
|
||||
skip_reason = "is blacklist_library"
|
||||
|
||||
if len(whitelist_library_type) > 0:
|
||||
if library_type.lower() not in whitelist_library_type:
|
||||
skip_reason = "is not whitelist_library_type"
|
||||
if type(library_type) in [list, tuple, set]:
|
||||
for library_type_item in library_type:
|
||||
if library_type_item.lower() not in whitelist_library_type:
|
||||
skip_reason = "is not whitelist_library_type"
|
||||
else:
|
||||
if library_type.lower() not in whitelist_library_type:
|
||||
skip_reason = "is not whitelist_library_type"
|
||||
|
||||
# if whitelist is not empty and library is not in whitelist
|
||||
if len(whitelist_library) > 0:
|
||||
|
||||
@@ -366,16 +366,9 @@ class Jellyfin:
|
||||
]
|
||||
)
|
||||
|
||||
# If there are multiple types in library raise error
|
||||
if len(types) > 1:
|
||||
raise Exception(
|
||||
f"Jellyfin: Library {library_title} has multiple types: {types}"
|
||||
)
|
||||
library_type = types.pop()
|
||||
|
||||
skip_reason = check_skip_logic(
|
||||
library_title,
|
||||
library_type,
|
||||
types,
|
||||
blacklist_library,
|
||||
whitelist_library,
|
||||
blacklist_library_type,
|
||||
@@ -390,6 +383,13 @@ class Jellyfin:
|
||||
)
|
||||
continue
|
||||
|
||||
# If there are multiple types in library raise error
|
||||
if len(types) > 1:
|
||||
raise Exception(
|
||||
f"Jellyfin: Library {library_title} has multiple types: {types}"
|
||||
)
|
||||
library_type = types.pop()
|
||||
|
||||
# Get watched for user
|
||||
task = asyncio.ensure_future(
|
||||
self.get_user_library_watched(
|
||||
|
||||
Reference in New Issue
Block a user