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