add --no-missing

pull/353/head
meisnate12 3 years ago
parent 382c156b66
commit 3b88d77492

@ -993,7 +993,7 @@ class CollectionBuilder:
else:
logger.error(message)
def find_rating_keys(self):
def find_rating_keys(self, no_missing):
for method, value in self.builders:
ids = []
rating_keys = []
@ -1058,20 +1058,23 @@ class CollectionBuilder:
if input_id in self.library.imdb_map:
rating_keys.append(self.library.imdb_map[input_id][0])
else:
try:
tmdb_id, tmdb_type = self.config.Convert.imdb_to_tmdb(input_id)
if tmdb_type == "movie":
if tmdb_id not in self.missing_movies:
self.missing_movies.append(tmdb_id)
else:
tvdb_id = self.config.Convert.tmdb_to_tvdb(tmdb_id)
if tvdb_id not in self.missing_shows:
self.missing_shows.append(tvdb_id)
except Failed as e:
logger.error(e)
continue
if (self.details["show_missing"] or self.details["save_missing"]
or (self.library.Radarr and self.add_to_radarr)
or (self.library.Sonarr and self.add_to_sonarr)) and not no_missing:
try:
tmdb_id, tmdb_type = self.config.Convert.imdb_to_tmdb(input_id)
if tmdb_type == "movie":
if tmdb_id not in self.missing_movies:
self.missing_movies.append(tmdb_id)
else:
tvdb_id = self.config.Convert.tmdb_to_tvdb(tmdb_id)
if tvdb_id not in self.missing_shows:
self.missing_shows.append(tvdb_id)
except Failed as e:
logger.error(e)
continue
util.print_end()
if len(rating_keys) > 0:
name = self.obj.title if self.obj else self.name
if not isinstance(rating_keys, list):

@ -26,6 +26,7 @@ parser.add_argument("-lo", "--library-only", "--libraries-only", dest="library_o
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 the countdown", action="store_true", default=False)
parser.add_argument("-nm", "--no-missing", dest="no_missing", help="Run without running the midding section", 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()
@ -46,6 +47,7 @@ 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)
no_missing = check_bool("PMM_NO_MISSING", args.no_missing)
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
@ -471,16 +473,16 @@ def run_collection(config, library, metadata, requested_collections):
for filter_key, filter_value in builder.filters:
logger.info(f"Collection Filter {filter_key}: {filter_value}")
builder.find_rating_keys()
builder.find_rating_keys(no_missing)
if len(builder.rating_keys) > 0 and builder.build_collection:
logger.info("")
util.separator(f"Adding to {mapping_name} Collection", space=False, border=False)
logger.info("")
builder.add_to_collection()
if (builder.details["show_missing"] is True or builder.details["save_missing"] is True
if (builder.details["show_missing"] or builder.details["save_missing"]
or (library.Radarr and builder.add_to_radarr) or (library.Sonarr and builder.add_to_sonarr)) \
and (len(builder.missing_movies) > 0 or len(builder.missing_shows) > 0):
and (len(builder.missing_movies) > 0 or len(builder.missing_shows) > 0) and not no_missing:
if builder.details["show_missing"] is True:
logger.info("")
util.separator(f"Missing from Library", space=False, border=False)

Loading…
Cancel
Save