Got progress and track length indicators working.

This commit is contained in:
The Wobbler 2024-12-21 20:50:09 +01:00
parent 24d589b172
commit bd69ddbcde
4 changed files with 42 additions and 3 deletions

26
wobuzz/utils.py Normal file
View file

@ -0,0 +1,26 @@
#!/usr/bin/python3
class Utils:
def __init__(self, app):
self.app = app
print(self.format_time(4656))
def format_time(self, ms):
seconds = int(ms / 1000) % 60
minutes = int(ms / (1000 * 60)) % 60
hours = int(ms / (1000 * 60 * 60))
seconds_str, minutes_str, hours_str = ("",) * 3 # create empty strings
if hours > 0:
hours_str = f"{hours}:"
minutes_str = f"{minutes}:".zfill(2)
seconds_str = f"{seconds}".zfill(2)
output = hours_str + minutes_str + seconds_str
return output