You've already forked RadioPlayer
mirror of
https://github.com/radio95-rnt/RadioPlayer.git
synced 2026-02-26 13:52:00 +01:00
less verbose
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user