0
1
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:
Kuba
2025-11-01 18:01:51 +01:00
parent 2229d1cb45
commit d5c9c9e5c3
4 changed files with 45 additions and 27 deletions

13
modules/cli_progress.py Normal file
View 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)