You've already forked RadioPlayer
mirror of
https://github.com/radio95-rnt/RadioPlayer.git
synced 2026-02-26 21:53:54 +01:00
add extend parameter
This commit is contained in:
@@ -47,9 +47,9 @@ class Module(ActiveModifier):
|
|||||||
logger.info(f"Playing {song} instead, as instructed by toplay")
|
logger.info(f"Playing {song} instead, as instructed by toplay")
|
||||||
|
|
||||||
self.last_track = (song, next_track_to_fade_in, last_track_to_fade_out, True, {})
|
self.last_track = (song, next_track_to_fade_in, last_track_to_fade_out, True, {})
|
||||||
return self.last_track
|
return self.last_track, True
|
||||||
elif len(self.originals): self.last_track = self.originals.pop(0)
|
elif len(self.originals): self.last_track = self.originals.pop(0)
|
||||||
else: self.last_track = track
|
else: self.last_track = track
|
||||||
return self.last_track
|
return self.last_track, False
|
||||||
|
|
||||||
activemod = Module()
|
activemod = Module()
|
||||||
@@ -35,7 +35,7 @@ class ActiveModifier:
|
|||||||
"""
|
"""
|
||||||
This changes the next song to be played live, which means that this picks the next song, not the playlist, but this is affected by the playlist
|
This changes the next song to be played live, which means that this picks the next song, not the playlist, but this is affected by the playlist
|
||||||
"""
|
"""
|
||||||
def play(self, index:int, track: tuple[str, bool, bool, bool, dict[str, str]]): return track
|
def play(self, index:int, track: tuple[str, bool, bool, bool, dict[str, str]]): return track, False
|
||||||
def on_new_playlist(self, playlist: list[tuple[str, bool, bool, bool, dict[str, str]]]): pass
|
def on_new_playlist(self, playlist: list[tuple[str, bool, bool, bool, dict[str, str]]]): pass
|
||||||
|
|
||||||
simple_modules: list[PlayerModule] = []
|
simple_modules: list[PlayerModule] = []
|
||||||
@@ -230,13 +230,10 @@ def play_playlist(playlist_path):
|
|||||||
|
|
||||||
old_track_tuple = playlist[song_i]
|
old_track_tuple = playlist[song_i]
|
||||||
if active_modifier:
|
if active_modifier:
|
||||||
track_tuple = active_modifier.play(song_i, old_track_tuple)
|
track_tuple, extend = active_modifier.play(song_i, old_track_tuple)
|
||||||
logger.debug(repr(song_i), repr(old_track_tuple), repr(track_tuple), repr(old_track_tuple != track_tuple))
|
logger.debug(repr(song_i), repr(old_track_tuple), repr(track_tuple), repr(old_track_tuple != track_tuple))
|
||||||
if old_track_tuple != track_tuple:
|
if extend:
|
||||||
max_iterator += 1
|
max_iterator += 1
|
||||||
modified = True
|
|
||||||
else: modified = False
|
|
||||||
else: modified = False
|
|
||||||
track, to_fade_in, to_fade_out, official, args = track_tuple
|
track, to_fade_in, to_fade_out, official, args = track_tuple
|
||||||
|
|
||||||
track_path = os.path.abspath(os.path.expanduser(track))
|
track_path = os.path.abspath(os.path.expanduser(track))
|
||||||
@@ -254,7 +251,7 @@ def play_playlist(playlist_path):
|
|||||||
if not procman.anything_playing(): continue
|
if not procman.anything_playing(): continue
|
||||||
|
|
||||||
logger.info(f"Now playing: {track_name}")
|
logger.info(f"Now playing: {track_name}")
|
||||||
if modified:
|
if extend:
|
||||||
logger.info(f"Next up: {os.path.basename(playlist[song_i][0])}")
|
logger.info(f"Next up: {os.path.basename(playlist[song_i][0])}")
|
||||||
else:
|
else:
|
||||||
if (song_i + 1) < len(playlist): logger.info(f"Next up: {os.path.basename(playlist[song_i+1][0])}")
|
if (song_i + 1) < len(playlist): logger.info(f"Next up: {os.path.basename(playlist[song_i+1][0])}")
|
||||||
@@ -268,7 +265,7 @@ def play_playlist(playlist_path):
|
|||||||
else: time.sleep(ttw)
|
else: time.sleep(ttw)
|
||||||
|
|
||||||
i += 1
|
i += 1
|
||||||
if not modified: song_i += 1
|
if not extend: song_i += 1
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global playlist_advisor, active_modifier
|
global playlist_advisor, active_modifier
|
||||||
|
|||||||
Reference in New Issue
Block a user