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
asset_directory: config/assets
asset_folders: true
asset_depth: 0
create_asset_folders: false
dimensional_asset_rename: false
show_missing_season_assets: false
sync_mode: append
collection_minimum: 1
@ -29,6 +31,7 @@ settings: # Can be individually specified
only_filter_missing: false
show_unmanaged: true
show_filtered: false
show_options: false
show_missing: true
show_missing_assets: true
save_missing: true

@ -11,6 +11,7 @@ from modules.icheckmovies import ICheckMovies
from modules.imdb import IMDb
from modules.letterboxd import Letterboxd
from modules.mal import MyAnimeList
from modules.meta import PlaylistFile
from modules.notifiarr import Notifiarr
from modules.omdb import OMDb
from modules.plex import Plex
@ -367,18 +368,18 @@ class ConfigFile:
self.playlist_names = []
self.playlist_files = []
if "playlists" in self.data:
logger.info("Reading in Playlist Files")
if self.data["playlists"] is None:
raise Failed("Config Error: playlists attribute is blank")
playlists_pairs = []
paths_to_check = self.data["playlists"] if isinstance(self.data["playlists"], list) else [self.data["playlists"]]
if "playlist_files" in self.data:
logger.info("Reading in Playlist Files")
if self.data["playlist_files"] is None:
raise Failed("Config Error: playlist_files attribute is blank")
paths_to_check = self.data["playlist_files"] if isinstance(self.data["playlist_files"], list) else [self.data["playlist_files"]]
for path in paths_to_check:
if isinstance(path, dict):
def check_dict(attr):
if attr in path:
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)
logger.error(err)
else:
@ -405,6 +406,13 @@ class ConfigFile:
logger.error(f"Config Error: Folder not found: {folder}")
else:
playlists_pairs.append(("File", path))
else:
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)
@ -412,8 +420,6 @@ class ConfigFile:
self.playlist_files.append(playlist_obj)
except Failed as e:
util.print_multiline(e, error=True)
else:
logger.warning("playlists attribute not found")
self.TVDb = TVDb(self, self.general["tvdb_language"])
self.IMDb = IMDb(self)

@ -107,9 +107,9 @@ class Library(ABC):
except Failed as e:
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("")
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:
logger.info("")

@ -56,7 +56,7 @@ class DataFile:
elif os.path.exists(os.path.abspath(self.path)):
content = open(self.path, encoding="utf-8")
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)
return data
except yaml.scanner.ScannerError as ye:

@ -977,6 +977,7 @@ def run_collection(config, library, metadata, requested_collections):
items_added = 0
items_removed = 0
valid = True
if not builder.smart_url and builder.builders:
logger.info("")
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:
logger.info("")
logger.info(f"Collection Minimum: {builder.minimum} not met for {mapping_name} Collection")
valid = False
if builder.details["delete_below_minimum"] and builder.obj:
builder.delete_collection()
builder.deleted = True
@ -1019,7 +1021,7 @@ def run_collection(config, library, metadata, requested_collections):
stats["sonarr"] += sonarr_add
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:
builder.load_collection()
if builder.created:

Loading…
Cancel
Save