add --ignore-schedules

pull/556/head
meisnate12 3 years ago
parent 2cc4e7d829
commit 78d1aab6cf

@ -275,7 +275,7 @@ class CollectionBuilder:
logger.debug(f"Value: {data[methods['delete_not_scheduled']]}") logger.debug(f"Value: {data[methods['delete_not_scheduled']]}")
self.details["delete_not_scheduled"] = self._parse("delete_not_scheduled", self.data, datatype="bool", methods=methods, default=False) self.details["delete_not_scheduled"] = self._parse("delete_not_scheduled", self.data, datatype="bool", methods=methods, default=False)
if "schedule" in methods and not config.requested_collections: if "schedule" in methods and not self.config.requested_collections and not self.config.ignore_schedules:
logger.debug("") logger.debug("")
logger.debug("Validating Method: schedule") logger.debug("Validating Method: schedule")
if not self.data[methods["schedule"]]: if not self.data[methods["schedule"]]:
@ -355,23 +355,6 @@ class CollectionBuilder:
else: else:
raise Failed(f"{self.Type} Error: {test_sort} collection_order invalid\n\trelease (Order Collection by release dates)\n\talpha (Order Collection Alphabetically)\n\tcustom (Custom Order Collection)\n\tOther sorting options can be found at https://github.com/meisnate12/Plex-Meta-Manager/wiki/Smart-Builders#sort-options") raise Failed(f"{self.Type} Error: {test_sort} collection_order invalid\n\trelease (Order Collection by release dates)\n\talpha (Order Collection Alphabetically)\n\tcustom (Custom Order Collection)\n\tOther sorting options can be found at https://github.com/meisnate12/Plex-Meta-Manager/wiki/Smart-Builders#sort-options")
self.custom_sort = self.playlist
if "collection_order" in methods and not self.playlist:
logger.debug("")
logger.debug("Validating Method: collection_order")
if self.data[methods["collection_order"]] is None:
raise Failed(f"{self.Type} Warning: collection_order attribute is blank")
else:
logger.debug(f"Value: {self.data[methods['collection_order']]}")
if self.data[methods["collection_order"]].lower() in plex.collection_order_options:
self.details["collection_order"] = self.data[methods["collection_order"]].lower()
if self.data[methods["collection_order"]].lower() == "custom" and self.build_collection:
self.custom_sort = True
elif (self.library.is_movie and self.data[methods["collection_order"]].lower() in plex.movie_sorts) or (self.library.is_show and self.data[methods["collection_order"]].lower() in plex.show_sorts):
self.custom_sort = self.data[methods["collection_order"]].lower()
else:
raise Failed(f"{self.Type} Error: {self.data[methods['collection_order']]} collection_order invalid\n\trelease (Order Collection by release dates)\n\talpha (Order Collection Alphabetically)\n\tcustom (Custom Order Collection)\n\tOther sorting options can be found at https://github.com/meisnate12/Plex-Meta-Manager/wiki/Smart-Builders#sort-options")
self.collection_level = "movie" if self.library.is_movie else "show" self.collection_level = "movie" if self.library.is_movie else "show"
if self.playlist: if self.playlist:
self.collection_level = "item" self.collection_level = "item"
@ -466,11 +449,31 @@ class CollectionBuilder:
cant_interact("smart_label_collection", "smart_url", fail=True) cant_interact("smart_label_collection", "smart_url", fail=True)
cant_interact("smart_label_collection", "parts_collection", fail=True) cant_interact("smart_label_collection", "parts_collection", fail=True)
cant_interact("smart_url", "parts_collection", fail=True) cant_interact("smart_url", "parts_collection", fail=True)
if self.smart_url or self.smart_label_collection or self.parts_collection:
self.custom_sort = False
self.smart = self.smart_url or self.smart_label_collection self.smart = self.smart_url or self.smart_label_collection
self.custom_sort = self.playlist
if "collection_order" in methods and not self.playlist:
if self.smart:
raise Failed(f"{self.Type} Error: collection_order does not work with Smart Collections")
logger.debug("")
logger.debug("Validating Method: collection_order")
if self.data[methods["collection_order"]] is None:
raise Failed(f"{self.Type} Error: collection_order attribute is blank")
else:
logger.debug(f"Value: {self.data[methods['collection_order']]}")
if self.data[methods["collection_order"]].lower() in plex.collection_order_options:
self.details["collection_order"] = self.data[methods["collection_order"]].lower()
if self.data[methods["collection_order"]].lower() == "custom" and self.build_collection:
self.custom_sort = True
elif (self.library.is_movie and self.data[methods["collection_order"]].lower() in plex.movie_sorts) or (self.library.is_show and self.data[methods["collection_order"]].lower() in plex.show_sorts):
self.custom_sort = self.data[methods["collection_order"]].lower()
else:
raise Failed(f"{self.Type} Error: {self.data[methods['collection_order']]} collection_order invalid\n\trelease (Order Collection by release dates)\n\talpha (Order Collection Alphabetically)\n\tcustom (Custom Order Collection)\n\tOther sorting options can be found at https://github.com/meisnate12/Plex-Meta-Manager/wiki/Smart-Builders#sort-options")
if self.smart_url or self.smart_label_collection or self.parts_collection:
self.custom_sort = False
for method_key, method_data in self.data.items(): for method_key, method_data in self.data.items():
method_name, method_mod, method_final = self._split(method_key) method_name, method_mod, method_final = self._split(method_key)
if method_name in ignored_details: if method_name in ignored_details:

@ -47,6 +47,7 @@ class ConfigFile:
self.test_mode = attrs["test"] if "test" in attrs else False self.test_mode = attrs["test"] if "test" in attrs else False
self.trace_mode = attrs["trace"] if "trace" in attrs else False self.trace_mode = attrs["trace"] if "trace" in attrs else False
self.delete_collections = attrs["delete"] if "delete" in attrs else False self.delete_collections = attrs["delete"] if "delete" in attrs else False
self.ignore_schedules = attrs["ignore_schedules"] if "ignore_schedules" in attrs else False
self.start_time = attrs["time_obj"] self.start_time = attrs["time_obj"]
self.run_hour = datetime.strptime(attrs["time"], "%H:%M").hour self.run_hour = datetime.strptime(attrs["time"], "%H:%M").hour
self.requested_collections = util.get_list(attrs["collections"]) if "collections" in attrs else None self.requested_collections = util.get_list(attrs["collections"]) if "collections" in attrs else None
@ -714,7 +715,7 @@ class ConfigFile:
params["default_dir"] = default_dir params["default_dir"] = default_dir
params["skip_library"] = False params["skip_library"] = False
if lib and "schedule" in lib: if lib and "schedule" in lib and not self.requested_libraries and not self.ignore_schedules:
if not lib["schedule"]: if not lib["schedule"]:
raise Failed(f"Config Error: schedule attribute is blank") raise Failed(f"Config Error: schedule attribute is blank")
else: else:

@ -27,6 +27,7 @@ parser.add_argument("-c", "--config", dest="config", help="Run with desired *.ym
parser.add_argument("-t", "--time", "--times", dest="times", help="Times to update each day use format HH:MM (Default: 03:00) (comma-separated list)", default="03:00", type=str) parser.add_argument("-t", "--time", "--times", dest="times", help="Times to update each day use format HH:MM (Default: 03:00) (comma-separated list)", default="03:00", type=str)
parser.add_argument("-re", "--resume", dest="resume", help="Resume collection run from a specific collection", type=str) parser.add_argument("-re", "--resume", dest="resume", help="Resume collection run from a specific collection", type=str)
parser.add_argument("-r", "--run", dest="run", help="Run without the scheduler", action="store_true", default=False) parser.add_argument("-r", "--run", dest="run", help="Run without the scheduler", action="store_true", default=False)
parser.add_argument("-is", "--ignore-schedules", dest="ignore_schedules", help="Run ignoring collection schedules", action="store_true", default=False)
parser.add_argument("-rt", "--test", "--tests", "--run-test", "--run-tests", dest="test", help="Run in debug mode with only collections that have test: true", action="store_true", default=False) parser.add_argument("-rt", "--test", "--tests", "--run-test", "--run-tests", dest="test", help="Run in debug mode with only collections that have test: true", action="store_true", default=False)
parser.add_argument("-co", "--collection-only", "--collections-only", dest="collection_only", help="Run only collection operations", action="store_true", default=False) parser.add_argument("-co", "--collection-only", "--collections-only", dest="collection_only", help="Run only collection operations", action="store_true", default=False)
parser.add_argument("-lo", "--library-only", "--libraries-only", dest="library_only", help="Run only library operations", action="store_true", default=False) parser.add_argument("-lo", "--library-only", "--libraries-only", dest="library_only", help="Run only library operations", action="store_true", default=False)
@ -61,6 +62,7 @@ config_file = get_arg("PMM_CONFIG", args.config)
times = get_arg("PMM_TIME", args.times) times = get_arg("PMM_TIME", args.times)
run = get_arg("PMM_RUN", args.run, arg_bool=True) run = get_arg("PMM_RUN", args.run, arg_bool=True)
test = get_arg("PMM_TEST", args.test, arg_bool=True) test = get_arg("PMM_TEST", args.test, arg_bool=True)
ignore_schedules = get_arg("PMM_IGNORE_SCHEDULES", args.ignore_schedules, arg_bool=True)
collection_only = get_arg("PMM_COLLECTIONS_ONLY", args.collection_only, arg_bool=True) collection_only = get_arg("PMM_COLLECTIONS_ONLY", args.collection_only, arg_bool=True)
library_only = get_arg("PMM_LIBRARIES_ONLY", args.library_only, arg_bool=True) library_only = get_arg("PMM_LIBRARIES_ONLY", args.library_only, arg_bool=True)
collections = get_arg("PMM_COLLECTIONS", args.collections) collections = get_arg("PMM_COLLECTIONS", args.collections)
@ -153,6 +155,7 @@ def start(attrs):
logger.debug(f"--libraries-only (PMM_LIBRARIES_ONLY): {library_only}") logger.debug(f"--libraries-only (PMM_LIBRARIES_ONLY): {library_only}")
logger.debug(f"--run-collections (PMM_COLLECTIONS): {collections}") logger.debug(f"--run-collections (PMM_COLLECTIONS): {collections}")
logger.debug(f"--run-libraries (PMM_LIBRARIES): {libraries}") logger.debug(f"--run-libraries (PMM_LIBRARIES): {libraries}")
logger.debug(f"--ignore-schedules (PMM_IGNORE_SCHEDULES): {ignore_schedules}")
logger.debug(f"--delete-collections (PMM_DELETE_COLLECTIONS): {delete}") logger.debug(f"--delete-collections (PMM_DELETE_COLLECTIONS): {delete}")
logger.debug(f"--resume (PMM_RESUME): {resume}") logger.debug(f"--resume (PMM_RESUME): {resume}")
logger.debug(f"--no-countdown (PMM_NO_COUNTDOWN): {no_countdown}") logger.debug(f"--no-countdown (PMM_NO_COUNTDOWN): {no_countdown}")
@ -1199,6 +1202,7 @@ try:
"config_file": config_file, "config_file": config_file,
"test": test, "test": test,
"delete": delete, "delete": delete,
"ignore_schedules": ignore_schedules,
"collections": collections, "collections": collections,
"libraries": libraries, "libraries": libraries,
"resume": resume, "resume": resume,

Loading…
Cancel
Save