You've already forked RadioPlayer
mirror of
https://github.com/radio95-rnt/RadioPlayer.git
synced 2026-02-26 13:52:00 +01:00
move skip to playview and dump progrss to file
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
from . import PlayerModule, Track
|
||||
import os
|
||||
from . import PlayerModule, Track, Path
|
||||
|
||||
def format_time(seconds) -> str:
|
||||
hours = int(seconds // 3600)
|
||||
@@ -10,9 +9,8 @@ def format_time(seconds) -> str:
|
||||
class Module(PlayerModule):
|
||||
def progress(self, index: int, track: Track, elapsed: float, total: float, real_total: float) -> None:
|
||||
if track.official:
|
||||
print(f"{track.path.name}: {format_time(elapsed)} / {format_time(total)}", end="\r", flush=True)
|
||||
if os.path.exists("/tmp/radioPlayer_skip"):
|
||||
self._imc.send(self, "procman", {"op": 2})
|
||||
os.remove("/tmp/radioPlayer_skip")
|
||||
data = f"{track.path.name}: {format_time(elapsed)} / {format_time(total)}"
|
||||
# print(data, end="\r", flush=True)
|
||||
Path("/tmp/radioPlayer_progress").write_text(data)
|
||||
|
||||
module = Module()
|
||||
@@ -1,4 +1,5 @@
|
||||
from . import PlayerModule, log95, Track, Path
|
||||
from . import PlayerModule, log95, Track
|
||||
import os
|
||||
|
||||
logger = log95.log95("PlayView")
|
||||
|
||||
@@ -8,6 +9,9 @@ class Module(PlayerModule):
|
||||
def on_new_playlist(self, playlist: list[Track]):
|
||||
self.playlist = [str(t.path.absolute()) for t in playlist]
|
||||
def on_new_track(self, index: int, track: Track, next_track: Track | None):
|
||||
if os.path.exists("/tmp/radioPlayer_skip"):
|
||||
self._imc.send(self, "procman", {"op": 2})
|
||||
os.remove("/tmp/radioPlayer_skip")
|
||||
if next_track: logger.info("Next up:", next_track.path.name)
|
||||
if str(track.path) != self.playlist[index]:
|
||||
# discrepancy, which means that the playing file was modified by the active modifier
|
||||
|
||||
Reference in New Issue
Block a user