Move skip to function. fix blacklist_library.
This commit is contained in:
37
src/plex.py
37
src/plex.py
@@ -1,7 +1,7 @@
|
||||
import re, os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from src.functions import logger, search_mapping
|
||||
from src.functions import logger, search_mapping, check_skip_logic
|
||||
from plexapi.server import PlexServer
|
||||
from plexapi.myplex import MyPlexAccount
|
||||
|
||||
@@ -103,38 +103,11 @@ class Plex:
|
||||
library_title = library.title
|
||||
library_type = library.type
|
||||
|
||||
if library_type.lower() in blacklist_library_type:
|
||||
logger(f"Plex: Library type {library_type} is blacklist_library_type", 1)
|
||||
skip_reason = check_skip_logic(library_title, library_type, blacklist_library, whitelist_library, blacklist_library_type, whitelist_library_type, library_mapping)
|
||||
|
||||
if skip_reason:
|
||||
logger(f"Plex: Skipping library {library_title} {skip_reason}", 1)
|
||||
continue
|
||||
|
||||
if library_title.lower() in [x.lower() for x in blacklist_library]:
|
||||
logger(f"Plex: Library {library_title} is blacklist_library", 1)
|
||||
continue
|
||||
|
||||
library_other = None
|
||||
if library_mapping:
|
||||
library_other = search_mapping(library_mapping, library_title)
|
||||
if library_other:
|
||||
library_other.lower()
|
||||
if library_other not in [x.lower() for x in blacklist_library]:
|
||||
logger(f"Plex: Library {library_other} is blacklist_library", 1)
|
||||
continue
|
||||
|
||||
if len(whitelist_library_type) > 0:
|
||||
if library_type.lower() not in whitelist_library_type:
|
||||
logger(f"Plex: Library type {library_type} is not whitelist_library_type", 1)
|
||||
continue
|
||||
|
||||
# if whitelist is not empty and library is not in whitelist
|
||||
if len(whitelist_library) > 0:
|
||||
if library_title.lower() not in [x.lower() for x in whitelist_library]:
|
||||
logger(f"Plex: Library {library_title} is not whitelist_library", 1)
|
||||
continue
|
||||
|
||||
if library_other:
|
||||
if library_other not in [x.lower() for x in whitelist_library]:
|
||||
logger(f"Plex: Library {library_other} is not whitelist_library", 1)
|
||||
continue
|
||||
|
||||
for user in users:
|
||||
logger(f"Plex: Generating watched for {user.title} in library {library_title}", 0)
|
||||
|
||||
Reference in New Issue
Block a user