forked from Wobbl/Wobuzz
MPRIS: Got everything necessary working. (I think.)
This commit is contained in:
parent
f23530628c
commit
1f149a25a3
10 changed files with 333 additions and 58 deletions
|
@ -35,10 +35,10 @@ class Player:
|
|||
self.playing = True
|
||||
self.paused = False
|
||||
|
||||
self.app.gui.on_playstate_update()
|
||||
|
||||
self.export_cover_art_tmp()
|
||||
|
||||
self.app.gui.on_playstate_update()
|
||||
|
||||
# cache next track so it immediately starts when the current track finishes
|
||||
self.cache_next_track()
|
||||
|
||||
|
@ -234,3 +234,24 @@ class Player:
|
|||
file = open(art_path, "wb")
|
||||
file.write(metadata.images.any.data)
|
||||
file.close()
|
||||
|
||||
def get_progress(self) -> int:
|
||||
"""
|
||||
Gets the progress of the current track in milliseconds.
|
||||
(Also when paused.)
|
||||
:return: Progress in milliseconds
|
||||
"""
|
||||
|
||||
if self.playing:
|
||||
remaining = self.track_progress.timer.remainingTime()
|
||||
|
||||
if remaining == -1:
|
||||
remaining = self.track_progress.remaining_time
|
||||
|
||||
track_duration = self.current_playlist.current_track.duration
|
||||
|
||||
progress = track_duration - remaining
|
||||
|
||||
return progress
|
||||
|
||||
return 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue