Format video time as hh:mm:ss
This commit is contained in:
@@ -210,7 +210,7 @@ class VlcSyncApp(QMainWindow):
|
||||
self.seekbar.sliderMoved.connect(self.on_seekbar_dragged)
|
||||
self.seekbar.sliderReleased.connect(self.on_seekbar_released)
|
||||
|
||||
self.time_lbl = QLabel("0:00 / 0:00")
|
||||
self.time_lbl = QLabel("00:00:00 / 00:00:00")
|
||||
|
||||
# Volume
|
||||
self.vol_icon = QLabel("🔊")
|
||||
@@ -316,7 +316,7 @@ class VlcSyncApp(QMainWindow):
|
||||
if length_ms > 0:
|
||||
def fmt(ms):
|
||||
s = max(0, ms) // 1000
|
||||
return f"{s//60}:{s%60:02d}"
|
||||
return f"{s//3600:02d}:{(s%3600)//60:02d}:{s%60:02d}"
|
||||
|
||||
if not self.seekbar.isSliderDown():
|
||||
self.time_lbl.setText(f"{fmt(time_ms)} / {fmt(length_ms)}")
|
||||
@@ -343,7 +343,7 @@ class VlcSyncApp(QMainWindow):
|
||||
target_ms = int((value / 1000.0) * length_ms)
|
||||
def fmt(ms):
|
||||
s = max(0, ms) // 1000
|
||||
return f"{s//60}:{s%60:02d}"
|
||||
return f"{s//3600:02d}:{(s%3600)//60:02d}:{s%60:02d}"
|
||||
self.time_lbl.setText(f"{fmt(target_ms)} / {fmt(length_ms)}")
|
||||
|
||||
def on_seekbar_released(self):
|
||||
@@ -573,7 +573,7 @@ class VlcSyncApp(QMainWindow):
|
||||
elif action == "pause":
|
||||
self.on_system_message(f"{username} paused")
|
||||
elif action == "seek":
|
||||
def fmt(s): return f"{int(s)//60}:{int(s)%60:02d}"
|
||||
def fmt(s): return f"{int(s)//3600:02d}:{(int(s)%3600)//60:02d}:{int(s)%60:02d}"
|
||||
self.on_system_message(f"{username} seeked to {fmt(position_s)}")
|
||||
|
||||
def send_chat(self):
|
||||
|
||||
Reference in New Issue
Block a user