From 6d5fa9d52519168347a174c5e69ebf9883f66d58 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Mon, 24 May 2021 18:16:19 -0400 Subject: [PATCH] #274 added --no-countdown --- modules/builder.py | 4 ++-- modules/convert.py | 3 ++- modules/plex.py | 2 +- plex_meta_manager.py | 21 ++++++++++++--------- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/modules/builder.py b/modules/builder.py index 2163520f..2ddf7135 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -1392,8 +1392,8 @@ class CollectionBuilder: if movie is None: logger.warning(f"Filter Error: No TMDb ID found for {current.title}") continue - if (modifier == ".not" and movie.original_language in filter_data) or ( - modifier != ".not" and movie.original_language not in filter_data): + if (modifier == ".not" and movie.original_language in filter_data) \ + or (modifier != ".not" and movie.original_language not in filter_data): match = False break elif method_name == "audio_track_title": diff --git a/modules/convert.py b/modules/convert.py index 043185cb..1124dc0c 100644 --- a/modules/convert.py +++ b/modules/convert.py @@ -275,6 +275,7 @@ class Convert: elif url_parsed.scheme == "imdb": imdb_id.append(url_parsed.netloc) elif url_parsed.scheme == "tmdb": tmdb_id.append(int(url_parsed.netloc)) except requests.exceptions.ConnectionError: + library.query(item.refresh) util.print_stacktrace() raise Failed("No External GUIDs found") if not tvdb_id and not imdb_id and not tmdb_id: @@ -361,5 +362,5 @@ class Convert: logger.info(util.adjust_space(length, f"Mapping Error | {item.guid:<46} | {e} for {item.title}")) except BadRequest: util.print_stacktrace() - logger.info(util.adjust_space(length, f"Mapping Error: | {item.guid} for {item.title} not found")) + logger.info(util.adjust_space(length, f"Mapping Error | {item.guid:<46} | Bad Request for {item.title}")) return None, None diff --git a/modules/plex.py b/modules/plex.py index 104bbd76..9105d8c2 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -403,7 +403,7 @@ class PlexAPI: @retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex) def get_guids(self, item): item.reload(checkFiles=False, includeAllConcerts=False, includeBandwidths=False, includeChapters=False, - includeChildren=False, includeConcerts=False, includeExternalMedia=False, inclueExtras=False, + includeChildren=False, includeConcerts=False, includeExternalMedia=False, includeExtras=False, includeFields='', includeGeolocation=False, includeLoudnessRamps=False, includeMarkers=False, includeOnDeck=False, includePopularLeaves=False, includePreferences=False, includeRelated=False, includeRelatedCount=0, includeReviews=False, includeStations=False) diff --git a/plex_meta_manager.py b/plex_meta_manager.py index 623b934c..11ba6865 100644 --- a/plex_meta_manager.py +++ b/plex_meta_manager.py @@ -21,6 +21,7 @@ parser.add_argument("-co", "--collection-only", "--collections-only", dest="coll parser.add_argument("-lo", "--library-only", "--libraries-only", dest="library_only", help="Run only library operations", action="store_true", default=False) parser.add_argument("-rc", "-cl", "--collection", "--collections", "--run-collection", "--run-collections", dest="collections", help="Process only specified collections (comma-separated list)", type=str) parser.add_argument("-rl", "-l", "--library", "--libraries", "--run-library", "--run-libraries", dest="libraries", help="Process only specified libraries (comma-separated list)", type=str) +parser.add_argument("-nc", "--no-countdown", dest="no_countdown", help="Run without displaying countdown", action="store_true", default=False) parser.add_argument("-d", "--divider", dest="divider", help="Character that divides the sections (Default: '=')", default="=", type=str) parser.add_argument("-w", "--width", dest="width", help="Screen Width (Default: 100)", default=100, type=int) args = parser.parse_args() @@ -40,6 +41,7 @@ def check_bool(env_str, default): test = check_bool("PMM_TEST", args.test) debug = check_bool("PMM_DEBUG", args.debug) run = check_bool("PMM_RUN", args.run) +no_countdown = check_bool("PMM_NO_COUNTDOWN", args.no_countdown) library_only = check_bool("PMM_LIBRARIES_ONLY", args.library_only) collection_only = check_bool("PMM_COLLECTIONS_ONLY", args.collection_only) collections = os.environ.get("PMM_COLLECTIONS") if os.environ.get("PMM_COLLECTIONS") else args.collections @@ -489,16 +491,17 @@ try: schedule.every().day.at(time_to_run).do(start, config_file, False, True, None, None, None) while True: schedule.run_pending() - current = datetime.now().strftime("%H:%M") - seconds = (datetime.strptime(time_to_run, "%H:%M") - datetime.strptime(current, "%H:%M")).total_seconds() - hours = int(seconds // 3600) - if hours < 0: - hours += 24 - minutes = int((seconds % 3600) // 60) - time_str = f"{hours} Hour{'s' if hours > 1 else ''} and " if hours > 0 else "" - time_str += f"{minutes} Minute{'s' if minutes > 1 else ''}" + if not no_countdown: + current = datetime.now().strftime("%H:%M") + seconds = (datetime.strptime(time_to_run, "%H:%M") - datetime.strptime(current, "%H:%M")).total_seconds() + hours = int(seconds // 3600) + if hours < 0: + hours += 24 + minutes = int((seconds % 3600) // 60) + time_str = f"{hours} Hour{'s' if hours > 1 else ''} and " if hours > 0 else "" + time_str += f"{minutes} Minute{'s' if minutes > 1 else ''}" - time_length = util.print_return(time_length, f"Current Time: {current} | {time_str} until the daily run at {time_to_run}") + time_length = util.print_return(time_length, f"Current Time: {current} | {time_str} until the daily run at {time_to_run}") time.sleep(1) except KeyboardInterrupt: util.separator("Exiting Plex Meta Manager")