You've already forked RadioPlayer
mirror of
https://github.com/radio95-rnt/RadioPlayer.git
synced 2026-02-26 21:53:54 +01:00
add the focus time data to the ws
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
# TODO: focus time in track
|
|
||||||
import multiprocessing, os
|
import multiprocessing, os
|
||||||
import json
|
import json
|
||||||
import threading, uuid, time
|
import threading, uuid, time
|
||||||
@@ -175,15 +174,16 @@ class Module(PlayerModule):
|
|||||||
"fade_in": track.fade_in,
|
"fade_in": track.fade_in,
|
||||||
"official": track.official,
|
"official": track.official,
|
||||||
"args": track.args,
|
"args": track.args,
|
||||||
"offset": track.offset
|
"offset": track.offset,
|
||||||
|
"focus_time_offset": track.focus_time_offset
|
||||||
})
|
})
|
||||||
self.data["playlist"] = json.dumps(api_data)
|
self.data["playlist"] = json.dumps(api_data)
|
||||||
try: self.ws_q.put({"event": "playlist", "data": api_data})
|
try: self.ws_q.put({"event": "playlist", "data": api_data})
|
||||||
except Exception: pass
|
except Exception: pass
|
||||||
|
|
||||||
def on_new_track(self, index: int, track: Track, next_track: Track | None) -> None:
|
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}
|
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}
|
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
|
else: next_track_data = None
|
||||||
payload = {"index": index, "track": track_data, "next_track": next_track_data}
|
payload = {"index": index, "track": track_data, "next_track": next_track_data}
|
||||||
self.data["track"] = json.dumps(payload)
|
self.data["track"] = json.dumps(payload)
|
||||||
@@ -191,7 +191,7 @@ class Module(PlayerModule):
|
|||||||
except Exception: pass
|
except Exception: pass
|
||||||
|
|
||||||
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:
|
||||||
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}
|
payload = {"index": index, "track": track_data, "elapsed": elapsed, "total": total, "real_total": real_total}
|
||||||
self.data["progress"] = json.dumps(payload)
|
self.data["progress"] = json.dumps(payload)
|
||||||
try: self.ws_q.put({"event": "progress", "data": payload})
|
try: self.ws_q.put({"event": "progress", "data": payload})
|
||||||
|
|||||||
@@ -228,7 +228,6 @@ class RadioPlayer:
|
|||||||
else:
|
else:
|
||||||
max_iterator = 1
|
max_iterator = 1
|
||||||
playlist = None
|
playlist = None
|
||||||
global_args = {}
|
|
||||||
return_pending = track = False
|
return_pending = track = False
|
||||||
song_i = i = 0
|
song_i = i = 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user