added `build_collection` collection detail

pull/264/head
meisnate12 4 years ago
parent 5faf2f9b86
commit 0c67bfb731

@ -1,4 +1,4 @@
import glob, logging, os, re
import logging, os, re
from datetime import datetime, timedelta
from modules import anidb, anilist, imdb, letterboxd, mal, plex, radarr, sonarr, tautulli, tmdb, trakttv, tvdb, util
from modules.util import Failed
@ -645,10 +645,8 @@ class CollectionBuilder:
raise Failed(f"Collection Error: {method_name} attribute only works with normal collections")
elif method_name not in collectionless_details and self.collectionless:
raise Failed(f"Collection Error: {method_name} attribute does not work for Collectionless collection")
elif self.smart_url and method_name in all_builders:
elif self.smart_url and (method_name in all_builders or method_name in smart_url_collection_invalid):
raise Failed(f"Collection Error: {method_name} builder not allowed when using smart_filter")
elif self.smart_url and method_name in smart_url_collection_invalid:
raise Failed(f"Collection Error: {method_name} detail not allowed when using smart_url")
elif method_name == "summary":
self.summaries[method_name] = method_data
elif method_name == "tmdb_summary":
@ -1249,6 +1247,14 @@ class CollectionBuilder:
self.details["collection_mode"] = "hide"
self.sync = True
self.build_collection = True
if "build_collection" in methods:
if not self.data[methods["build_collection"]]:
logger.warning(f"Collection Warning: build_collection attribute is blank defaulting to true")
else:
self.build_collection = util.get_bool("build_collection", self.data[methods["build_collection"]])
if self.build_collection:
try:
self.obj = library.get_collection(self.name)
collection_smart = library.smart(self.obj)
@ -1264,6 +1270,9 @@ class CollectionBuilder:
if self.sync and self.obj:
for item in library.get_collection_items(self.obj, self.smart_label_collection):
self.plex_map[item.ratingKey] = item
else:
self.sync = False
self.run_again = False
def collect_rating_keys(self, movie_map, show_map):
def add_rating_keys(keys):

@ -220,7 +220,6 @@ def compile_list(data):
else:
return data
def get_list(data, lower=False, split=True, int_list=False):
if isinstance(data, list): return data
elif isinstance(data, dict): return [data]

@ -375,14 +375,15 @@ def run_collection(config, library, metadata, requested_collections, is_test, re
builder.collect_rating_keys(movie_map, show_map)
logger.info("")
if len(builder.rating_keys) > 0:
if len(builder.rating_keys) > 0 and builder.build_collection:
builder.add_to_collection(movie_map)
if len(builder.missing_movies) > 0 or len(builder.missing_shows) > 0:
builder.run_missing()
if builder.sync and len(builder.rating_keys) > 0:
if builder.sync and len(builder.rating_keys) > 0 and builder.build_collection:
builder.sync_collection()
logger.info("")
if builder.build_collection:
builder.update_details()
if builder.run_again and (len(builder.run_again_movies) > 0 or len(builder.run_again_shows) > 0):

Loading…
Cancel
Save