fix for #39 and housekeeping

pull/50/head
meisnate12 4 years ago
parent bcbab43ea9
commit f1b6e54083

@ -434,16 +434,13 @@ class Config:
except Failed as e: logger.error(e)
logger.info("")
util.seperator("{} Library {}Collections".format(library.name, "Test " if test else ""))
collections = library.collections
collections_to_process = (collections.keys() & util.get_list(requested_collections)) if requested_collections else collections
if collections_to_process:
collections = (library.collections.keys() & util.get_list(requested_collections)) if requested_collections else library.collections
if collections:
logger.info("")
util.seperator("Mapping {} Library".format(library.name))
logger.info("")
movie_map, show_map = self.map_guids(library)
logger.info(movie_map)
logger.info(show_map)
for c in collections_to_process:
for c in collections:
if test and ("test" not in collections[c] or collections[c]["test"] is not True):
continue
try:
@ -646,13 +643,12 @@ class Config:
elif method_name == "trakt_watchlist": methods.append((method_name, self.Trakt.validate_trakt_watchlist(util.get_list(collections[c][m]), library.is_movie)))
elif method_name == "imdb_list":
new_list = []
for imdb_list in util.get_list(collections[c][m]):
for imdb_list in util.get_list(collections[c][m], split=False):
new_dictionary = {}
if isinstance(imdb_list, dict):
if "url" in imdb_list and imdb_list["url"]: imdb_url = imdb_list["url"]
else: raise Failed("Collection Error: No I")
if "limit" in imdb_list and imdb_list["limit"]: list_count = util.regex_first_int(imdb_list["limit"], "List Limit", default=0)
else: list_count = 0
else: raise Failed("Collection Error: imdb_list attribute url is required")
list_count = util.regex_first_int(imdb_list["limit"], "List Limit", default=0) if "limit" in imdb_list and imdb_list["limit"] else 0
else:
imdb_url = str(imdb_list)
list_count = 0
@ -726,8 +722,6 @@ class Config:
searches_used.append(util.remove_not(final_attr))
search.append((final_attr, util.get_int_list(collections[c][m][search_attr], util.remove_not(final_attr))))
elif final_attr in util.plex_searches:
if final_attr.startswith("tmdb_"):
final_attr = final_attr[5:]
searches_used.append(util.remove_not(final_attr))
search.append((final_attr, util.get_list(collections[c][m][search_attr])))
else:

@ -481,9 +481,10 @@ def choose_from_list(datalist, description, data=None, list_type="title", exact=
else:
return None
def get_list(data, lower=False):
def get_list(data, lower=False, split=True):
if isinstance(data, list): return data
elif isinstance(data, dict): return [data]
elif split is False: return [str(data)]
elif lower is True: return [d.strip().lower() for d in str(data).split(",")]
else: return [d.strip() for d in str(data).split(",")]

@ -65,7 +65,7 @@ if args.tests:
tests.run_tests(default_dir)
sys.exit(0)
def start(config_path, test, daily, collections = ""):
def start(config_path, test, daily, collections):
if daily: type = "Daily "
elif test: type = "Test "
elif collections: type = "Collections "
@ -85,7 +85,7 @@ try:
start(args.config, args.test, False, args.collections)
else:
length = 0
schedule.every().day.at(args.time).do(start, args.config, False, True)
schedule.every().day.at(args.time).do(start, args.config, False, True, None)
while True:
schedule.run_pending()
current = datetime.datetime.now().strftime("%H:%M")

Loading…
Cancel
Save