0
1
mirror of https://github.com/radio95-rnt/RadioPlayer.git synced 2026-02-26 21:53:54 +01:00
This commit is contained in:
Kuba
2025-10-13 20:00:20 +02:00
parent cfa1b7f3b2
commit fe039e01bc

View File

@@ -5,7 +5,7 @@ class ActiveModifier:
"""Tuple consists of the track path, to fade out, fade in, official, and args""" """Tuple consists of the track path, to fade out, fade in, official, and args"""
def play(self, index: int, track: tuple[str, bool, bool, bool, dict[str, str]]): return track def play(self, index: int, track: tuple[str, bool, bool, bool, dict[str, str]]): return track
def on_new_playlist(self, playlist: list[tuple[str, bool, bool, bool, dict[str, str]]]): pass def on_new_playlist(self, playlist: list[tuple[str, bool, bool, bool, dict[str, str]]]): pass
import os
class Module(ActiveModifier): class Module(ActiveModifier):
def __init__(self) -> None: def __init__(self) -> None:
self.playlist = None self.playlist = None
@@ -14,6 +14,7 @@ class Module(ActiveModifier):
self.playlist = playlist self.playlist = playlist
def play(self, index: int, track: tuple[str, bool, bool, bool, dict[str, str]]): def play(self, index: int, track: tuple[str, bool, bool, bool, dict[str, str]]):
if not self.playlist: return track if not self.playlist: return track
if not os.path.exists("/tmp/radioPlayer_toplay"): open("/tmp/radioPlayer_toplay", "a").close()
with open("/tmp/radioPlayer_toplay", "r") as f: with open("/tmp/radioPlayer_toplay", "r") as f:
songs = [s.strip() for s in f.readlines() if s.strip()] songs = [s.strip() for s in f.readlines() if s.strip()]
if len(songs): if len(songs):
@@ -34,4 +35,6 @@ class Module(ActiveModifier):
return song, last_track_to_fade_out, next_track_to_fade_in, True, {} return song, last_track_to_fade_out, next_track_to_fade_in, True, {}
elif len(self.originals): elif len(self.originals):
return self.originals.pop(0) return self.originals.pop(0)
activemod = Module()