[24] small fixes

pull/921/head
meisnate12 3 years ago
parent c364b64a60
commit 6d27ca508c

@ -1 +1 @@
1.17.0-develop23 1.17.0-develop24

@ -102,7 +102,6 @@ collections:
limit: 30 limit: 30
- chart: popular - chart: popular
limit: 30 limit: 30
collection_order: custom
sync_mode: sync sync_mode: sync
``` ```

@ -77,6 +77,7 @@ advance_tags_to_edit = {
} }
tags_to_edit = { tags_to_edit = {
"Movie": ["genre", "label", "collection", "country", "director", "producer", "writer"], "Movie": ["genre", "label", "collection", "country", "director", "producer", "writer"],
"Video": ["genre", "label", "collection", "country", "director", "producer", "writer"],
"Show": ["genre", "label", "collection"], "Show": ["genre", "label", "collection"],
"Artist": ["genre", "label", "style", "mood", "country", "collection", "similar_artist"] "Artist": ["genre", "label", "style", "mood", "country", "collection", "similar_artist"]
} }

@ -18,7 +18,7 @@ parser = argparse.ArgumentParser()
parser.add_argument("-db", "--debug", dest="debug", help=argparse.SUPPRESS, action="store_true", default=False) parser.add_argument("-db", "--debug", dest="debug", help=argparse.SUPPRESS, action="store_true", default=False)
parser.add_argument("-tr", "--trace", dest="trace", help=argparse.SUPPRESS, action="store_true", default=False) parser.add_argument("-tr", "--trace", dest="trace", help=argparse.SUPPRESS, action="store_true", default=False)
parser.add_argument("-c", "--config", dest="config", help="Run with desired *.yml file", type=str) parser.add_argument("-c", "--config", dest="config", help="Run with desired *.yml file", 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("-t", "--time", "--times", dest="times", help="Times to update each day use format HH:MM (Default: 03:00) (comma-separated list)", default="05: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("-is", "--ignore-schedules", dest="ignore_schedules", help="Run ignoring collection schedules", action="store_true", default=False)
@ -530,7 +530,7 @@ def run_collection(config, library, metadata, requested_collections):
else: else:
collection_log_name, output_str = util.validate_filename(mapping_name) collection_log_name, output_str = util.validate_filename(mapping_name)
logger.add_collection_handler(library.mapping_name, collection_log_name) logger.add_collection_handler(library.mapping_name, collection_log_name)
library.status[mapping_name] = {"status": "Unchanged", "errors": [], "added": 0, "unchanged": 0, "removed": 0, "radarr": 0, "sonarr": 0} library.status[str(mapping_name)] = {"status": "Unchanged", "errors": [], "added": 0, "unchanged": 0, "removed": 0, "radarr": 0, "sonarr": 0}
try: try:
builder = CollectionBuilder(config, metadata, mapping_name, collection_attrs, library=library, extra=output_str) builder = CollectionBuilder(config, metadata, mapping_name, collection_attrs, library=library, extra=output_str)
@ -568,21 +568,21 @@ def run_collection(config, library, metadata, requested_collections):
if len(builder.added_items) > 0 and len(builder.added_items) + builder.beginning_count >= builder.minimum and builder.build_collection: if len(builder.added_items) > 0 and len(builder.added_items) + builder.beginning_count >= builder.minimum and builder.build_collection:
items_added, items_unchanged = builder.add_to_collection() items_added, items_unchanged = builder.add_to_collection()
library.stats["added"] += items_added library.stats["added"] += items_added
library.status[mapping_name]["added"] = items_added library.status[str(mapping_name)]["added"] = items_added
library.stats["unchanged"] += items_unchanged library.stats["unchanged"] += items_unchanged
library.status[mapping_name]["unchanged"] = items_unchanged library.status[str(mapping_name)]["unchanged"] = items_unchanged
items_removed = 0 items_removed = 0
if builder.sync: if builder.sync:
items_removed = builder.sync_collection() items_removed = builder.sync_collection()
library.stats["removed"] += items_removed library.stats["removed"] += items_removed
library.status[mapping_name]["removed"] = items_removed library.status[str(mapping_name)]["removed"] = items_removed
if builder.do_missing and (len(builder.missing_movies) > 0 or len(builder.missing_shows) > 0): if builder.do_missing and (len(builder.missing_movies) > 0 or len(builder.missing_shows) > 0):
radarr_add, sonarr_add = builder.run_missing() radarr_add, sonarr_add = builder.run_missing()
library.stats["radarr"] += radarr_add library.stats["radarr"] += radarr_add
library.status[mapping_name]["radarr"] += radarr_add library.status[str(mapping_name)]["radarr"] += radarr_add
library.stats["sonarr"] += sonarr_add library.stats["sonarr"] += sonarr_add
library.status[mapping_name]["sonarr"] += sonarr_add library.status[str(mapping_name)]["sonarr"] += sonarr_add
valid = True valid = True
if builder.build_collection and not builder.blank_collection and ( if builder.build_collection and not builder.blank_collection and (
@ -598,7 +598,7 @@ def run_collection(config, library, metadata, requested_collections):
logger.info(builder.delete()) logger.info(builder.delete())
library.stats["deleted"] += 1 library.stats["deleted"] += 1
delete_status = f"Deleted; {delete_status}" delete_status = f"Deleted; {delete_status}"
library.status[mapping_name]["status"] = delete_status library.status[str(mapping_name)]["status"] = delete_status
run_item_details = True run_item_details = True
if valid and builder.build_collection and (builder.builders or builder.smart_url or builder.blank_collection): if valid and builder.build_collection and (builder.builders or builder.smart_url or builder.blank_collection):
@ -606,10 +606,10 @@ def run_collection(config, library, metadata, requested_collections):
builder.load_collection() builder.load_collection()
if builder.created: if builder.created:
library.stats["created"] += 1 library.stats["created"] += 1
library.status[mapping_name]["status"] = "Created" library.status[str(mapping_name)]["status"] = "Created"
elif items_added > 0 or items_removed > 0: elif items_added > 0 or items_removed > 0:
library.stats["modified"] += 1 library.stats["modified"] += 1
library.status[mapping_name]["status"] = "Modified" library.status[str(mapping_name)]["status"] = "Modified"
except Failed: except Failed:
logger.stacktrace() logger.stacktrace()
run_item_details = False run_item_details = False
@ -619,9 +619,9 @@ def run_collection(config, library, metadata, requested_collections):
details_list = builder.update_details() details_list = builder.update_details()
if details_list: if details_list:
pre = "" pre = ""
if library.status[mapping_name]["status"] != "Unchanged": if library.status[str(mapping_name)]["status"] != "Unchanged":
pre = f"{library.status[mapping_name]['status']} and " pre = f"{library.status[str(mapping_name)]['status']} and "
library.status[mapping_name]["status"] = f"{pre}Updated {', '.join(details_list)}" library.status[str(mapping_name)]["status"] = f"{pre}Updated {', '.join(details_list)}"
if builder.server_preroll is not None: if builder.server_preroll is not None:
library.set_server_preroll(builder.server_preroll) library.set_server_preroll(builder.server_preroll)
@ -651,25 +651,25 @@ def run_collection(config, library, metadata, requested_collections):
logger.info(e) logger.info(e)
if str(e).endswith("and was deleted"): if str(e).endswith("and was deleted"):
library.stats["deleted"] += 1 library.stats["deleted"] += 1
library.status[mapping_name]["status"] = "Deleted Not Scheduled" library.status[str(mapping_name)]["status"] = "Deleted Not Scheduled"
elif str(e).startswith("Skipped because allowed_library_types"): elif str(e).startswith("Skipped because allowed_library_types"):
library.status[mapping_name]["status"] = "Skipped Invalid Library Type" library.status[str(mapping_name)]["status"] = "Skipped Invalid Library Type"
else: else:
library.status[mapping_name]["status"] = "Not Scheduled" library.status[str(mapping_name)]["status"] = "Not Scheduled"
except Failed as e: except Failed as e:
library.notify(e, collection=mapping_name) library.notify(e, collection=mapping_name)
logger.stacktrace() logger.stacktrace()
logger.error(e) logger.error(e)
library.status[mapping_name]["status"] = "PMM Failure" library.status[str(mapping_name)]["status"] = "PMM Failure"
library.status[mapping_name]["errors"].append(e) library.status[str(mapping_name)]["errors"].append(e)
except Exception as e: except Exception as e:
library.notify(f"Unknown Error: {e}", collection=mapping_name) library.notify(f"Unknown Error: {e}", collection=mapping_name)
logger.stacktrace() logger.stacktrace()
logger.error(f"Unknown Error: {e}") logger.error(f"Unknown Error: {e}")
library.status[mapping_name]["status"] = "Unknown Error" library.status[str(mapping_name)]["status"] = "Unknown Error"
library.status[mapping_name]["errors"].append(e) library.status[str(mapping_name)]["errors"].append(e)
collection_run_time = str(datetime.now() - collection_start).split('.')[0] collection_run_time = str(datetime.now() - collection_start).split('.')[0]
library.status[mapping_name]["run_time"] = collection_run_time library.status[str(mapping_name)]["run_time"] = collection_run_time
logger.info("") logger.info("")
logger.separator(f"Finished {mapping_name} Collection\nCollection Run Time: {collection_run_time}") logger.separator(f"Finished {mapping_name} Collection\nCollection Run Time: {collection_run_time}")
logger.remove_collection_handler(library.mapping_name, collection_log_name) logger.remove_collection_handler(library.mapping_name, collection_log_name)

Loading…
Cancel
Save