31 lines
753 B
Python
31 lines
753 B
Python
#!/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):
|
|
self.timer.start(self.app.player.current_sound_duration)
|
|
|
|
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()
|
|
self.remaining_time = self.app.player.current_playlist.current_track.duration
|