#5 Works with multiple versions of a movie

pull/211/head
meisnate12 4 years ago
parent 66e6e42acd
commit 93c3120090

@ -1009,14 +1009,16 @@ class CollectionBuilder:
items_found_inside += len(movie_ids)
for movie_id in movie_ids:
if movie_id in movie_map:
items.append(movie_map[movie_id])
items.extend(movie_map[movie_id])
else:
missing_movies.append(movie_id)
if len(show_ids) > 0:
items_found_inside += len(show_ids)
for show_id in show_ids:
if show_id in show_map: items.append(show_map[show_id])
else: missing_shows.append(show_id)
if show_id in show_map:
items.extend(show_map[show_id])
else:
missing_shows.append(show_id)
return items_found_inside
logger.info("")
logger.debug(f"Value: {value}")
@ -1325,10 +1327,14 @@ class CollectionBuilder:
def run_collections_again(self, collection_obj, movie_map, show_map):
collection_items = collection_obj.items() if isinstance(collection_obj, Collections) else []
name = collection_obj.title if isinstance(collection_obj, Collections) else collection_obj
rating_keys = [movie_map[mm] for mm in self.missing_movies if mm in movie_map]
rating_keys = []
for mm in self.missing_movies:
if mm in movie_map:
rating_keys.extend(movie_map[mm])
if self.library.is_show:
rating_keys.extend([show_map[sm] for sm in self.missing_shows if sm in show_map])
for sm in self.missing_shows:
if sm in show_map:
rating_keys.extend(show_map[sm])
if len(rating_keys) > 0:
for rating_key in rating_keys:
try:

@ -553,7 +553,10 @@ class Config:
util.print_stacktrace()
logger.error(f"Unknown Error: {e}")
if library.assets_for_all:
if library.assets_for_all is True and not test and not requested_collections:
logger.info("")
util.separator(f"All {'Movies' if library.is_movie else 'Shows'} Assets Check for {library.name} Library")
logger.info("")
for item in library.get_all():
folder = os.path.basename(os.path.dirname(item.locations[0]) if library.is_movie else item.locations[0])
for ad in library.asset_directory:
@ -797,13 +800,13 @@ class Config:
if self.Cache:
ids, expired = self.Cache.get_ids("movie" if library.is_movie else "show", plex_guid=item.guid)
elif library.is_movie:
for tmdb in movie_map:
if movie_map[tmdb] == item.ratingKey:
for tmdb, rating_keys in movie_map.items():
if item.ratingKey in rating_keys:
ids["tmdb"] = tmdb
break
else:
for tvdb in show_map:
if show_map[tvdb] == item.ratingKey:
for tvdb, rating_keys in show_map.items():
if item.ratingKey in rating_keys:
ids["tvdb"] = tvdb
break
@ -859,12 +862,28 @@ class Config:
continue
if isinstance(main_id, list):
if id_type == "movie":
for m in main_id: movie_map[m] = item.ratingKey
for m in main_id:
if m in movie_map:
movie_map[m].append(item.ratingKey)
else:
movie_map[m] = [item.ratingKey]
elif id_type == "show":
for m in main_id:
if m in show_map:
show_map[m].append(item.ratingKey)
else:
show_map[m] = [item.ratingKey]
else:
if id_type == "movie":
if main_id in movie_map:
movie_map[main_id].append(item.ratingKey)
else:
movie_map[main_id] = [item.ratingKey]
elif id_type == "show":
for m in main_id: show_map[m] = item.ratingKey
if main_id in show_map:
show_map[main_id].append(item.ratingKey)
else:
if id_type == "movie": movie_map[main_id] = item.ratingKey
elif id_type == "show": show_map[main_id] = item.ratingKey
show_map[main_id] = [item.ratingKey]
util.print_end(length, f"Processed {len(items)} {'Movies' if library.is_movie else 'Shows'}")
return movie_map, show_map

@ -413,7 +413,7 @@ class PlexAPI:
elif method_name == "original_language":
movie = None
for key, value in movie_map.items():
if current.ratingKey == value:
if current.ratingKey in value:
try:
movie = self.TMDb.get_movie(key)
break
@ -445,7 +445,7 @@ class PlexAPI:
if method_name == "vote_count":
tmdb_item = None
for key, value in movie_map.items():
if current.ratingKey == value:
if current.ratingKey in value:
try:
tmdb_item = self.TMDb.get_movie(key) if self.is_movie else self.TMDb.get_show(key)
break

@ -89,7 +89,7 @@ util.centered("| |_) | |/ _ \\ \\/ / | |\\/| |/ _ \\ __/ _` | | |\\/| |/ _` | '_
util.centered("| __/| | __/> < | | | | __/ || (_| | | | | | (_| | | | | (_| | (_| | __/ | ")
util.centered("|_| |_|\\___/_/\\_\\ |_| |_|\\___|\\__\\__,_| |_| |_|\\__,_|_| |_|\\__,_|\\__, |\\___|_| ")
util.centered(" |___/ ")
util.centered(" Version: 1.7.2-Beta9 ")
util.centered(" Version: 1.7.2-Beta10 ")
util.separator()
if my_tests:

Loading…
Cancel
Save