From b7b109c17ec68b808bb77e2bedcdedd51bba7e06 Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Fri, 12 Dec 2025 21:28:54 +0100 Subject: [PATCH] add the focus time data to the ws --- modules/web.py | 10 +++++----- radioPlayer.py | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/web.py b/modules/web.py index d98ea33..dab21f7 100644 --- a/modules/web.py +++ b/modules/web.py @@ -1,4 +1,3 @@ -# TODO: focus time in track import multiprocessing, os import json import threading, uuid, time @@ -175,15 +174,16 @@ class Module(PlayerModule): "fade_in": track.fade_in, "official": track.official, "args": track.args, - "offset": track.offset + "offset": track.offset, + "focus_time_offset": track.focus_time_offset }) self.data["playlist"] = json.dumps(api_data) try: self.ws_q.put({"event": "playlist", "data": api_data}) except Exception: pass def on_new_track(self, index: int, track: Track, next_track: Track | None) -> None: - track_data = {"path": str(track.path), "fade_out": track.fade_out, "fade_in": track.fade_in, "official": track.official, "args": track.args, "offset": track.offset} - if next_track: next_track_data = {"path": str(next_track.path), "fade_out": next_track.fade_out, "fade_in": next_track.fade_in, "official": next_track.official, "args": next_track.args, "offset": next_track.offset} + track_data = {"path": str(track.path), "fade_out": track.fade_out, "fade_in": track.fade_in, "official": track.official, "args": track.args, "offset": track.offset, "focus_time_offset": track.focus_time_offset} + if next_track: next_track_data = {"path": str(next_track.path), "fade_out": next_track.fade_out, "fade_in": next_track.fade_in, "official": next_track.official, "args": next_track.args, "offset": next_track.offset, "focus_time_offset": track.focus_time_offset} else: next_track_data = None payload = {"index": index, "track": track_data, "next_track": next_track_data} self.data["track"] = json.dumps(payload) @@ -191,7 +191,7 @@ class Module(PlayerModule): except Exception: pass def progress(self, index: int, track: Track, elapsed: float, total: float, real_total: float) -> None: - track_data = {"path": str(track.path), "fade_out": track.fade_out, "fade_in": track.fade_in, "official": track.official, "args": track.args, "offset": track.offset} + track_data = {"path": str(track.path), "fade_out": track.fade_out, "fade_in": track.fade_in, "official": track.official, "args": track.args, "offset": track.offset, "focus_time_offset": track.focus_time_offset} payload = {"index": index, "track": track_data, "elapsed": elapsed, "total": total, "real_total": real_total} self.data["progress"] = json.dumps(payload) try: self.ws_q.put({"event": "progress", "data": payload}) diff --git a/radioPlayer.py b/radioPlayer.py index 7be0015..91e5058 100644 --- a/radioPlayer.py +++ b/radioPlayer.py @@ -228,7 +228,6 @@ class RadioPlayer: else: max_iterator = 1 playlist = None - global_args = {} return_pending = track = False song_i = i = 0