mirror of
https://github.com/nwithan8/plex-prerolls
synced 2025-07-26 03:12:21 +00:00
Auto-Generation: Option to Exclude Plex Libraries (#24)
This commit is contained in:
@ -147,7 +147,8 @@ advanced:
|
||||
recently_added:
|
||||
# If enabled, auto-generate prerolls for recently added items and add them as an always-on choice (files will be uploaded to the "Preroll Auto-Generated/Recently Added" folder)
|
||||
enabled: true # If enabled, auto-generate prerolls for recently added items and add them to the "always" list
|
||||
count: 2 # The number of most-recently added items to use for auto-generation
|
||||
count: 2 # The number of most-recently added items to use for auto-generation
|
||||
excluded_libraries: [] # Optional: Exclude specific Plex libraries, e.g. [Documentaries, Anime] or "Documentaries, Anime"
|
||||
trailer_cutoff_year: 1980 # Optional: Specify the earliest year for valid trailer searches (Defaults to 1980)
|
||||
|
||||
|
||||
|
@ -253,6 +253,17 @@ class RecentlyAddedAutoGenerationConfig(ConfigSection):
|
||||
paths.append(remote_file)
|
||||
|
||||
return paths
|
||||
|
||||
@property
|
||||
def excluded_libraries(self) -> List[str]:
|
||||
raw = self._get_value(key="excluded_libraries", default=[])
|
||||
# Ensure it's a list even if someone types a comma-separated string
|
||||
if isinstance(raw, str):
|
||||
return [lib.strip().lower() for lib in raw.split(',') if lib.strip()]
|
||||
elif isinstance(raw, list):
|
||||
return [lib.strip().lower() for lib in raw]
|
||||
else:
|
||||
return []
|
||||
|
||||
@property
|
||||
def trailer_cutoff_year(self) -> int:
|
||||
|
@ -19,7 +19,6 @@ from modules.renderers import RecentlyAddedPrerollRenderer
|
||||
from modules.webhooks.plex import PlexWebhook, PlexWebhookEventType, PlexWebhookMetadataType
|
||||
from modules.webhooks.last_run import LastRunWithinTimeframeCheck
|
||||
|
||||
|
||||
class WebhookProcessor:
|
||||
def __init__(self):
|
||||
pass
|
||||
@ -115,7 +114,15 @@ class WebhookProcessor:
|
||||
if not plex_movie:
|
||||
logging.warning(f'Could not find movie in Plex: "{webhook.metadata.title}"') # Not an error, just a warning
|
||||
return
|
||||
|
||||
|
||||
# Check if the current library is in the exclusion list
|
||||
library_name = getattr(plex_movie, "librarySectionTitle", "").lower()
|
||||
logging.debug(f'plex_movie librarySectionTitle: "{library_name}"')
|
||||
excluded_libraries = config.advanced.auto_generation.recently_added.excluded_libraries
|
||||
if library_name in excluded_libraries:
|
||||
logging.info(f'Skipping preroll render for "{webhook.metadata.title}" from excluded library: "{library_name}"')
|
||||
return
|
||||
|
||||
renderer = RecentlyAddedPrerollRenderer(render_folder=output_dir,
|
||||
movie=plex_movie)
|
||||
asset_folder, local_file_path = renderer.render(config=config)
|
||||
|
Reference in New Issue
Block a user