small fixes

pull/541/head
meisnate12 3 years ago
parent 2b67b991d4
commit d9770c2e67

@ -18,7 +18,9 @@ settings: # Can be individually specified
cache_expiration: 60 cache_expiration: 60
asset_directory: config/assets asset_directory: config/assets
asset_folders: true asset_folders: true
asset_depth: 0
create_asset_folders: false create_asset_folders: false
dimensional_asset_rename: false
show_missing_season_assets: false show_missing_season_assets: false
sync_mode: append sync_mode: append
collection_minimum: 1 collection_minimum: 1
@ -29,6 +31,7 @@ settings: # Can be individually specified
only_filter_missing: false only_filter_missing: false
show_unmanaged: true show_unmanaged: true
show_filtered: false show_filtered: false
show_options: false
show_missing: true show_missing: true
show_missing_assets: true show_missing_assets: true
save_missing: true save_missing: true

@ -11,6 +11,7 @@ from modules.icheckmovies import ICheckMovies
from modules.imdb import IMDb from modules.imdb import IMDb
from modules.letterboxd import Letterboxd from modules.letterboxd import Letterboxd
from modules.mal import MyAnimeList from modules.mal import MyAnimeList
from modules.meta import PlaylistFile
from modules.notifiarr import Notifiarr from modules.notifiarr import Notifiarr
from modules.omdb import OMDb from modules.omdb import OMDb
from modules.plex import Plex from modules.plex import Plex
@ -367,18 +368,18 @@ class ConfigFile:
self.playlist_names = [] self.playlist_names = []
self.playlist_files = [] self.playlist_files = []
if "playlists" in self.data: playlists_pairs = []
if "playlist_files" in self.data:
logger.info("Reading in Playlist Files") logger.info("Reading in Playlist Files")
if self.data["playlists"] is None: if self.data["playlist_files"] is None:
raise Failed("Config Error: playlists attribute is blank") raise Failed("Config Error: playlist_files attribute is blank")
playlists_pairs = [] paths_to_check = self.data["playlist_files"] if isinstance(self.data["playlist_files"], list) else [self.data["playlist_files"]]
paths_to_check = self.data["playlists"] if isinstance(self.data["playlists"], list) else [self.data["playlists"]]
for path in paths_to_check: for path in paths_to_check:
if isinstance(path, dict): if isinstance(path, dict):
def check_dict(attr): def check_dict(attr):
if attr in path: if attr in path:
if path[attr] is None: if path[attr] is None:
err = f"Config Error: playlists {attr} is blank" err = f"Config Error: playlist_files {attr} is blank"
self.errors.append(err) self.errors.append(err)
logger.error(err) logger.error(err)
else: else:
@ -405,15 +406,20 @@ class ConfigFile:
logger.error(f"Config Error: Folder not found: {folder}") logger.error(f"Config Error: Folder not found: {folder}")
else: else:
playlists_pairs.append(("File", path)) playlists_pairs.append(("File", path))
for file_type, playlist_file in playlists_pairs:
try:
playlist_obj = PlaylistFile(self, file_type, playlist_file)
self.playlist_names.extend([p for p in playlist_obj.playlists])
self.playlist_files.append(playlist_obj)
except Failed as e:
util.print_multiline(e, error=True)
else: else:
logger.warning("playlists attribute not found") default_playlist_file = os.path.abspath(os.path.join(self.default_dir, "playlists.yml"))
if os.path.exists(default_playlist_file):
playlists_pairs.append(("File", default_playlist_file))
logger.warning(f"playlist_files attribute not found using {default_playlist_file} as default")
else:
logger.warning("playlist_files attribute not found")
for file_type, playlist_file in playlists_pairs:
try:
playlist_obj = PlaylistFile(self, file_type, playlist_file)
self.playlist_names.extend([p for p in playlist_obj.playlists])
self.playlist_files.append(playlist_obj)
except Failed as e:
util.print_multiline(e, error=True)
self.TVDb = TVDb(self, self.general["tvdb_language"]) self.TVDb = TVDb(self, self.general["tvdb_language"])
self.IMDb = IMDb(self) self.IMDb = IMDb(self)

@ -107,9 +107,9 @@ class Library(ABC):
except Failed as e: except Failed as e:
util.print_multiline(e, error=True) util.print_multiline(e, error=True)
if len(self.metadata_files) == 0 and not self.library_operation: if len(self.metadata_files) == 0 and not self.library_operation and not self.config.playlist_files:
logger.info("") logger.info("")
raise Failed("Config Error: No valid metadata files or library operations found") raise Failed("Config Error: No valid metadata files, playlist files, or library operations found")
if self.asset_directory: if self.asset_directory:
logger.info("") logger.info("")

@ -56,7 +56,7 @@ class DataFile:
elif os.path.exists(os.path.abspath(self.path)): elif os.path.exists(os.path.abspath(self.path)):
content = open(self.path, encoding="utf-8") content = open(self.path, encoding="utf-8")
else: else:
raise Failed(f"File Error: File does not exist {self.path}") raise Failed(f"File Error: File does not exist {os.path.abspath(self.path)}")
data, _, _ = yaml.util.load_yaml_guess_indent(content) data, _, _ = yaml.util.load_yaml_guess_indent(content)
return data return data
except yaml.scanner.ScannerError as ye: except yaml.scanner.ScannerError as ye:

@ -977,6 +977,7 @@ def run_collection(config, library, metadata, requested_collections):
items_added = 0 items_added = 0
items_removed = 0 items_removed = 0
valid = True
if not builder.smart_url and builder.builders: if not builder.smart_url and builder.builders:
logger.info("") logger.info("")
logger.info(f"Sync Mode: {'sync' if builder.sync else 'append'}") logger.info(f"Sync Mode: {'sync' if builder.sync else 'append'}")
@ -1003,6 +1004,7 @@ def run_collection(config, library, metadata, requested_collections):
elif len(builder.added_items) < builder.minimum and builder.build_collection: elif len(builder.added_items) < builder.minimum and builder.build_collection:
logger.info("") logger.info("")
logger.info(f"Collection Minimum: {builder.minimum} not met for {mapping_name} Collection") logger.info(f"Collection Minimum: {builder.minimum} not met for {mapping_name} Collection")
valid = False
if builder.details["delete_below_minimum"] and builder.obj: if builder.details["delete_below_minimum"] and builder.obj:
builder.delete_collection() builder.delete_collection()
builder.deleted = True builder.deleted = True
@ -1019,7 +1021,7 @@ def run_collection(config, library, metadata, requested_collections):
stats["sonarr"] += sonarr_add stats["sonarr"] += sonarr_add
run_item_details = True run_item_details = True
if builder.build_collection and (builder.builders or builder.smart_url): if valid and builder.build_collection and (builder.builders or builder.smart_url):
try: try:
builder.load_collection() builder.load_collection()
if builder.created: if builder.created:

Loading…
Cancel
Save