diff --git a/modules/write_playlists.py b/modules/write_playlists.py index 6b2b994..e2b1474 100644 --- a/modules/write_playlists.py +++ b/modules/write_playlists.py @@ -1,4 +1,4 @@ -from . import PlayerModule, log95, Track, Popen +from . import PlayerModule, log95, Track, Path logger = log95.log95("PlayView") @@ -12,10 +12,10 @@ class Module(PlayerModule): # discrepancy, which means that the playing file was modified by the active modifier # we are playing a file that was not determined in the playlist, that means it was chosen by the active modifier and made up on the fly lines = self.playlist[:index] + [f"> ({track.path})"] + [self.playlist[index]] + self.playlist[index+1:] - logger.info("Next up:", self.playlist[index]) # core no longer does this + logger.info("Next up:", Path(self.playlist[index]).name) # core no longer does this else: lines = self.playlist[:index] + [f"> {self.playlist[index]}"] + self.playlist[index+1:] - if index + 1 < len(self.playlist): logger.info("Next up:", self.playlist[index+1]) + if index + 1 < len(self.playlist): logger.info("Next up:", Path(self.playlist[index+1]).name) with open("/tmp/radioPlayer_playlist", "w") as f: for line in lines: try: f.write(line + "\n") diff --git a/radioPlayer.py b/radioPlayer.py index d224912..5960498 100644 --- a/radioPlayer.py +++ b/radioPlayer.py @@ -102,7 +102,7 @@ def load_filelines(path: Path): return [] def parse_playlistfile(playlist_path: Path) -> tuple[dict[str, str], list[tuple[list[str], dict[str, str]]]]: - lines = load_filelines(playlist_path.absolute()) + lines = load_filelines(playlist_path) def check_for_imports(lines: list[str], seen=None) -> list[str]: if seen is None: seen = set() out = [] @@ -115,8 +115,7 @@ def parse_playlistfile(playlist_path: Path) -> tuple[dict[str, str], list[tuple[ logger.error(f"Target {target.name} of {playlist_path.name} does not exist") continue seen.add(target) - sub_lines = load_filelines(target) - out.extend(check_for_imports(sub_lines, seen)) + out.extend(check_for_imports(load_filelines(target), seen)) else: out.append(line) return out lines = check_for_imports(lines) # First, import everything @@ -154,7 +153,7 @@ def play_playlist(playlist_path: Path, starting_index: int = 0): playlist: list[Track] = [] [playlist.extend(Track(Path(line).absolute(), True, True, True, args) for line in lns) for (lns, args) in parsed] # i can read this, i think - for module in playlist_modifier_modules: playlist = module.modify(global_args, playlist) or playlist + for module in playlist_modifier_modules: playlist = module.modify(global_args, playlist) or playlist # id one liner this but the assignement is stopping me prefetch(playlist[0].path)