You've already forked RadioPlayer
mirror of
https://github.com/radio95-rnt/RadioPlayer.git
synced 2026-02-26 21:53:54 +01:00
module progress! (literally0123
This commit is contained in:
@@ -8,6 +8,7 @@ class Track:
|
||||
fade_in: bool
|
||||
official: bool
|
||||
args: dict[str, str] | None
|
||||
offset: float = 0.0
|
||||
|
||||
class PlayerModule:
|
||||
"""
|
||||
@@ -27,6 +28,8 @@ class PlayerModule:
|
||||
"""
|
||||
pass
|
||||
def imc_data(self, source: 'PlayerModule | ActiveModifier | PlaylistAdvisor', data: object, broadcast: bool) -> object:
|
||||
return None
|
||||
def progess(self, index: int, track: Track, elapsed: float, total: float):
|
||||
pass
|
||||
class PlaylistModifierModule:
|
||||
"""
|
||||
@@ -58,7 +61,7 @@ class PlaylistAdvisor:
|
||||
"""
|
||||
pass
|
||||
def imc_data(self, source: 'PlayerModule | ActiveModifier | PlaylistAdvisor', data: object, broadcast: bool) -> object:
|
||||
pass
|
||||
return None
|
||||
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
|
||||
@@ -85,7 +88,7 @@ class ActiveModifier:
|
||||
"""
|
||||
pass
|
||||
def imc_data(self, source: 'PlayerModule | ActiveModifier | PlaylistAdvisor', data: object, broadcast: bool) -> object:
|
||||
pass
|
||||
return None
|
||||
class InterModuleCommunication:
|
||||
def __init__(self, advisor: PlaylistAdvisor, active_modifier: ActiveModifier | None, simple_modules: list[PlayerModule]) -> None:
|
||||
self.advisor = advisor
|
||||
|
||||
13
modules/cli_progress.py
Normal file
13
modules/cli_progress.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from . import PlayerModule, Track
|
||||
import os
|
||||
|
||||
def format_time(seconds):
|
||||
hours = int(seconds // 3600)
|
||||
minutes = int((seconds % 3600) // 60)
|
||||
secs = int(seconds % 60)
|
||||
return f"{hours:02d}:{minutes:02d}:{secs:02d}"
|
||||
|
||||
class Module(PlayerModule):
|
||||
def progess(self, index: int, track: Track, elapsed: float, total: float):
|
||||
if track.official:
|
||||
print(f"{os.path.basename(track.path)}: {format_time(elapsed)} / {format_time(total)}", end="\r", flush=True)
|
||||
@@ -14,6 +14,7 @@ class Track:
|
||||
fade_in: bool
|
||||
official: bool
|
||||
args: dict[str, str] | None
|
||||
offset: float = 0.0
|
||||
|
||||
class PlayerModule:
|
||||
"""
|
||||
@@ -33,7 +34,7 @@ class PlayerModule:
|
||||
"""
|
||||
pass
|
||||
def imc_data(self, source: 'PlayerModule | ActiveModifier | PlaylistAdvisor', data: object, broadcast: bool) -> object:
|
||||
pass
|
||||
return None
|
||||
class PlaylistModifierModule:
|
||||
"""
|
||||
Playlist modifier, this type of module allows you to shuffle, or put jingles into your playlist
|
||||
@@ -64,7 +65,7 @@ class PlaylistAdvisor:
|
||||
"""
|
||||
pass
|
||||
def imc_data(self, source: 'PlayerModule | ActiveModifier | PlaylistAdvisor', data: object, broadcast: bool) -> object:
|
||||
pass
|
||||
return None
|
||||
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
|
||||
@@ -91,7 +92,7 @@ class ActiveModifier:
|
||||
"""
|
||||
pass
|
||||
def imc_data(self, source: 'PlayerModule | ActiveModifier | PlaylistAdvisor', data: object, broadcast: bool) -> object:
|
||||
pass
|
||||
return None
|
||||
class InterModuleCommunication:
|
||||
def __init__(self, advisor: PlaylistAdvisor, active_modifier: ActiveModifier | None, simple_modules: list[PlayerModule]) -> None:
|
||||
self.advisor = advisor
|
||||
|
||||
Reference in New Issue
Block a user