home
·
contact
·
privacy
projects
/
ytplom
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
82df48e
)
Fix timestamp setting bug.
master
author
Christian Heller
<c.heller@plomlompom.de>
Wed, 12 Mar 2025 02:46:44 +0000
(
03:46
+0100)
committer
Christian Heller
<c.heller@plomlompom.de>
Wed, 12 Mar 2025 02:46:44 +0000
(
03:46
+0100)
src/ytplom/misc.py
patch
|
blob
|
history
diff --git
a/src/ytplom/misc.py
b/src/ytplom/misc.py
index cf9bc96453f12414819484cf5d58c7981b065e17..08888483a8d921a91b6ed761b487940e45f128fe 100644
(file)
--- a/
src/ytplom/misc.py
+++ b/
src/ytplom/misc.py
@@
-590,19
+590,19
@@
class Player:
self._kill_queue: Queue = Queue()
self.playlist: list[VideoFile] = []
self.speed = -1.0
self._kill_queue: Queue = Queue()
self.playlist: list[VideoFile] = []
self.speed = -1.0
- self.timestamp = -1
self.duration = -1
self.load_files_and_mpv()
self.duration = -1
self.load_files_and_mpv()
- def _signal_update(self) -> None:
- """Update .last_update as signal player state has changed relevantly.
+ @property
+ def timestamp(self) -> int:
+ """If available, return int of self._mpv.time_pos, else -1."""
+ if self._mpv and self._mpv.time_pos is not None:
+ return int(self._mpv.time_pos)
+ return -1
- If possible, also updates current player timestamp.
- """
+ def _signal_update(self) -> None:
+ """
Update .last_update as signal player state changed relevantly."""
self.last_update = _now_string()
self.last_update = _now_string()
- if self._mpv:
- self.timestamp = (int(self._mpv.time_pos) if self._mpv.time_pos
- else -1)
def _monitor_kill(self) -> None:
"""Properly enforce mpv shutdown from direct interaction with mpv
def _monitor_kill(self) -> None:
"""Properly enforce mpv shutdown from direct interaction with mpv