not scheduled collection no longer error

This commit is contained in:
meisnate12 2021-10-21 10:00:16 -04:00
parent f34634f5d9
commit d10aa91b8c
3 changed files with 9 additions and 3 deletions

View file

@ -1,7 +1,7 @@
import logging, os, re
from datetime import datetime, timedelta
from modules import anidb, anilist, icheckmovies, imdb, letterboxd, mal, plex, radarr, sonarr, stevenlu, tautulli, tmdb, trakt, tvdb, util
from modules.util import Failed, ImageData
from modules.util import Failed, ImageData, NotScheduled
from PIL import Image
from plexapi.exceptions import BadRequest, NotFound
from plexapi.video import Movie, Show, Season, Episode
@ -391,7 +391,7 @@ class CollectionBuilder:
if len(self.schedule) == 0:
skip_collection = False
if skip_collection:
raise Failed(f"{self.schedule}\n\nCollection {self.name} not scheduled to run")
raise NotScheduled(f"{self.schedule}\n\nCollection {self.name} not scheduled to run")
self.collectionless = "plex_collectionless" in methods

View file

@ -19,6 +19,9 @@ class TimeoutExpired(Exception):
class Failed(Exception):
pass
class NotScheduled(Exception):
pass
class ImageData:
def __init__(self, attribute, location, prefix="", is_poster=True, is_url=True):
self.attribute = attribute

View file

@ -6,7 +6,7 @@ try:
from modules import util
from modules.builder import CollectionBuilder
from modules.config import Config
from modules.util import Failed
from modules.util import Failed, NotScheduled
except ModuleNotFoundError:
print("Requirements Error: Requirements are not installed")
sys.exit(0)
@ -572,6 +572,9 @@ def run_collection(config, library, metadata, requested_collections):
if builder.run_again and (len(builder.run_again_movies) > 0 or len(builder.run_again_shows) > 0):
library.run_again.append(builder)
except NotScheduled as e:
util.print_multiline(e, info=True)
except Failed as e:
library.notify(e, collection=mapping_name)
util.print_stacktrace()