v0.1.4: playback-control provenance log

LinTunes has spontaneously resumed playback for ~4s (then paused) four
times while trav was away — suspected phantom media-key events from the
Audioengine USB DAC's HID 'keyboard', but the pathway (MPRIS vs the
focused-window key filter) is unproven. Every control path now drops a
timestamped line in ~/.cache/lintunes/control-events.log: MPRIS Player
methods, the media-key eventFilter (with source input device where the
compositor exposes it), and Player.toggle_play/pause with position. New
lintunes/eventlog.py, 1MB rotation, never raises; conftest autouse
fixture keeps tests off the real log file.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-10 18:09:21 -04:00
co-authored by Claude Fable 5
parent a50c39fa43
commit 663d5e5a08
8 changed files with 210 additions and 1 deletions
+5
View File
@@ -6,6 +6,7 @@ from PyQt6.QtCore import QObject, QUrl, pyqtSignal
from PyQt6.QtMultimedia import (
QMediaPlayer, QAudioOutput, QAudioBufferOutput, QMediaDevices, QAudio)
from lintunes.eventlog import log_control
from lintunes.models import Track
@@ -197,6 +198,9 @@ class Player(QObject):
# ---- transport ----
def toggle_play(self):
log_control("player", "toggle_play",
f"playing={self.is_playing()} pos={self.position_ms()}ms "
f"track={self._current_track.name if self._current_track else None!r}")
if self.is_playing():
self._paused_at = time.monotonic()
self._media.pause()
@@ -221,6 +225,7 @@ class Player(QObject):
def pause(self):
if self.is_playing():
log_control("player", "pause", f"pos={self.position_ms()}ms")
self._paused_at = time.monotonic()
self._media.pause()