#274 added --no-countdown

This commit is contained in:
meisnate12 2021-05-24 18:16:19 -04:00
parent 85a0db091a
commit 6d5fa9d525
4 changed files with 17 additions and 13 deletions

View file

@ -1392,8 +1392,8 @@ class CollectionBuilder:
if movie is None: if movie is None:
logger.warning(f"Filter Error: No TMDb ID found for {current.title}") logger.warning(f"Filter Error: No TMDb ID found for {current.title}")
continue continue
if (modifier == ".not" and movie.original_language in filter_data) or ( if (modifier == ".not" and movie.original_language in filter_data) \
modifier != ".not" and movie.original_language not in filter_data): or (modifier != ".not" and movie.original_language not in filter_data):
match = False match = False
break break
elif method_name == "audio_track_title": elif method_name == "audio_track_title":

View file

@ -275,6 +275,7 @@ class Convert:
elif url_parsed.scheme == "imdb": imdb_id.append(url_parsed.netloc) elif url_parsed.scheme == "imdb": imdb_id.append(url_parsed.netloc)
elif url_parsed.scheme == "tmdb": tmdb_id.append(int(url_parsed.netloc)) elif url_parsed.scheme == "tmdb": tmdb_id.append(int(url_parsed.netloc))
except requests.exceptions.ConnectionError: except requests.exceptions.ConnectionError:
library.query(item.refresh)
util.print_stacktrace() util.print_stacktrace()
raise Failed("No External GUIDs found") raise Failed("No External GUIDs found")
if not tvdb_id and not imdb_id and not tmdb_id: 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}")) logger.info(util.adjust_space(length, f"Mapping Error | {item.guid:<46} | {e} for {item.title}"))
except BadRequest: except BadRequest:
util.print_stacktrace() 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 return None, None

View file

@ -403,7 +403,7 @@ class PlexAPI:
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex) @retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
def get_guids(self, item): def get_guids(self, item):
item.reload(checkFiles=False, includeAllConcerts=False, includeBandwidths=False, includeChapters=False, 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, includeFields='', includeGeolocation=False, includeLoudnessRamps=False, includeMarkers=False,
includeOnDeck=False, includePopularLeaves=False, includePreferences=False, includeRelated=False, includeOnDeck=False, includePopularLeaves=False, includePreferences=False, includeRelated=False,
includeRelatedCount=0, includeReviews=False, includeStations=False) includeRelatedCount=0, includeReviews=False, includeStations=False)

View file

@ -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("-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("-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("-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("-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) parser.add_argument("-w", "--width", dest="width", help="Screen Width (Default: 100)", default=100, type=int)
args = parser.parse_args() args = parser.parse_args()
@ -40,6 +41,7 @@ def check_bool(env_str, default):
test = check_bool("PMM_TEST", args.test) test = check_bool("PMM_TEST", args.test)
debug = check_bool("PMM_DEBUG", args.debug) debug = check_bool("PMM_DEBUG", args.debug)
run = check_bool("PMM_RUN", args.run) 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) library_only = check_bool("PMM_LIBRARIES_ONLY", args.library_only)
collection_only = check_bool("PMM_COLLECTIONS_ONLY", args.collection_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 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) schedule.every().day.at(time_to_run).do(start, config_file, False, True, None, None, None)
while True: while True:
schedule.run_pending() schedule.run_pending()
current = datetime.now().strftime("%H:%M") if not no_countdown:
seconds = (datetime.strptime(time_to_run, "%H:%M") - datetime.strptime(current, "%H:%M")).total_seconds() current = datetime.now().strftime("%H:%M")
hours = int(seconds // 3600) seconds = (datetime.strptime(time_to_run, "%H:%M") - datetime.strptime(current, "%H:%M")).total_seconds()
if hours < 0: hours = int(seconds // 3600)
hours += 24 if hours < 0:
minutes = int((seconds % 3600) // 60) hours += 24
time_str = f"{hours} Hour{'s' if hours > 1 else ''} and " if hours > 0 else "" minutes = int((seconds % 3600) // 60)
time_str += f"{minutes} Minute{'s' if minutes > 1 else ''}" 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) time.sleep(1)
except KeyboardInterrupt: except KeyboardInterrupt:
util.separator("Exiting Plex Meta Manager") util.separator("Exiting Plex Meta Manager")