33 lines
786 B
Python
33 lines
786 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.playing_track.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):
|
||
|
print(self.app.player.playing_track.path)
|
||
|
self.timer.stop()
|
||
|
self.remaining_time = self.app.player.playing_track.duration
|