2024-12-21 19:42:26 +01:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
from PyQt6.QtCore import QTimer
|
|
|
|
|
|
|
|
|
|
|
|
class TrackProgress:
|
|
|
|
def __init__(self, app):
|
|
|
|
self.app = app
|
|
|
|
|
|
|
|
self.remaining_time = 0
|
|
|
|
|
|
|
|
self.timer = QTimer()
|
|
|
|
self.timer.timeout.connect(self.track_finished)
|
|
|
|
self.timer.setSingleShot(True)
|
|
|
|
|
|
|
|
def track_finished(self):
|
|
|
|
self.app.player.track_finished()
|
|
|
|
|
|
|
|
def start(self):
|
2024-12-22 17:41:54 +01:00
|
|
|
self.timer.start(self.app.player.current_sound_duration)
|
2024-12-21 19:42:26 +01:00
|
|
|
|
|
|
|
def pause(self):
|
|
|
|
self.remaining_time = self.timer.remainingTime()
|
|
|
|
self.timer.stop()
|
|
|
|
|
|
|
|
def unpause(self):
|
|
|
|
self.timer.start(self.remaining_time)
|
|
|
|
|
|
|
|
def stop(self):
|
|
|
|
self.timer.stop()
|
2024-12-24 17:22:30 +01:00
|
|
|
self.remaining_time = self.app.player.current_playlist.current_track.duration
|