[19] update how the default playlist files are run

pull/790/head
meisnate12 3 years ago
parent f73497c572
commit 4a33e9fcf4

@ -1 +1 @@
1.16.1-develop1 1.16.0-develop19

@ -467,8 +467,13 @@ class ConfigFile:
if "playlist_files" in self.data: if "playlist_files" in self.data:
logger.info("Reading in Playlist Files") logger.info("Reading in Playlist Files")
if self.data["playlist_files"] is None: if self.data["playlist_files"] is None:
raise Failed("Config Error: playlist_files attribute is blank") default_playlist_file = os.path.abspath(os.path.join(self.default_dir, "playlists.yml"))
paths_to_check = self.data["playlist_files"] if isinstance(self.data["playlist_files"], list) else [self.data["playlist_files"]] logger.warning(f"Config Warning: playlist_files attribute is blank using default: {default_playlist_file}")
paths_to_check = [default_playlist_file]
elif isinstance(self.data["playlist_files"], list):
paths_to_check = self.data["playlist_files"]
else:
paths_to_check = [self.data["playlist_files"]]
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):
@ -503,14 +508,12 @@ class ConfigFile:
else: else:
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)) if os.path.exists(path):
playlists_pairs.append(("File", path))
else:
logger.warning(f"Config Warning: Path not found: {path}")
else: else:
default_playlist_file = os.path.abspath(os.path.join(self.default_dir, "playlists.yml")) logger.warning("playlist_files attribute not found")
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: for file_type, playlist_file in playlists_pairs:
try: try:
playlist_obj = PlaylistFile(self, file_type, playlist_file) playlist_obj = PlaylistFile(self, file_type, playlist_file)

Loading…
Cancel
Save