0
1
mirror of https://github.com/radio95-rnt/RadioPlayer.git synced 2026-02-26 21:53:54 +01:00

fix official

This commit is contained in:
2025-12-14 13:14:33 +01:00
parent 8226d58459
commit 0318d3a5d1

View File

@@ -54,7 +54,7 @@ class Module(ActiveModifier):
if len(songs): if len(songs):
song, official = get_song() song, official = get_song()
if self.last_track: last_track_fade_out = self.last_track.fade_out if self.last_track: last_track_fade_out = self.last_track.fade_out
else: else:
if (index - 1) >= 0: last_track_fade_out = self.playlist[index - 1].fade_out if (index - 1) >= 0: last_track_fade_out = self.playlist[index - 1].fade_out
@@ -78,10 +78,19 @@ class Module(ActiveModifier):
if len(songs): if len(songs):
# There are more tracks on the temp list # There are more tracks on the temp list
new_song, new_official = get_song(False) new_song, new_official = get_song(False)
self.last_track = Track(song, self.crossfade if new_official else 0, last_track_fade_out, official, {}, focus_time_offset=-self.crossfade if new_official else 0) current_track_fade_in = last_track_fade_out if official else 0
next_track = Track(new_song, self.crossfade if len(songs) else next_track_fade_in, self.crossfade if new_official else 0, new_official, {}, focus_time_offset=-self.crossfade if len(songs) else -next_track_fade_in) crossfade_amount = self.crossfade if official and new_official else 0
self.last_track = Track(song, crossfade_amount, current_track_fade_in, official, {}, focus_time_offset=-crossfade_amount)
next_track_fade_out = self.crossfade if new_official else 0
next_track = Track(new_song, next_track_fade_out, crossfade_amount, new_official, {}, focus_time_offset=-crossfade_amount)
else: else:
self.last_track = Track(song, next_track_fade_in, last_track_fade_out, official, {}, focus_time_offset=-next_track_fade_in) next_playlist_track_fade_in = next_track.fade_in if next_track else self.crossfade
current_track_fade_in = last_track_fade_out if official else 0
current_track_fade_out = next_playlist_track_fade_in if official else 0
self.last_track = Track(song, current_track_fade_out, current_track_fade_in, official, {}, focus_time_offset=-current_track_fade_out)
next_track = track next_track = track
self.limit_tracks = False self.limit_tracks = False
if self.skip_next: if self.skip_next:
@@ -138,9 +147,9 @@ class Module(ActiveModifier):
elif data.get("action") == "clear_toplay": elif data.get("action") == "clear_toplay":
with self.file_lock: with self.file_lock:
# Due to policy, i will not recommend to strip the next song but only the songs after. # Due to policy, i will not recommend to strip the next song but only the songs after.
with open(TOPLAY, "r") as f: with open(TOPLAY, "r") as f:
first_line, i = "", 0 first_line, i = "", 0
while not first_line.strip() and i < 3: while not first_line.strip() and i < 3:
first_line = f.readline() first_line = f.readline()
i += 1 i += 1
with open(TOPLAY, "w") as f: f.write(first_line.strip() + "\n") with open(TOPLAY, "w") as f: f.write(first_line.strip() + "\n")