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.
This commit is contained in:
@@ -10,6 +10,7 @@ from PyQt6.QtGui import QAction, QKeySequence
|
||||
|
||||
from lintunes import mpris, tagging, theme
|
||||
from lintunes.art_search import AlbumArtFetcher
|
||||
from lintunes.eventlog import log_control
|
||||
from lintunes.inhibit import SleepInhibitor
|
||||
from lintunes.player import Player
|
||||
from lintunes.importers import file_importer
|
||||
@@ -551,16 +552,32 @@ class MainWindow(QMainWindow):
|
||||
return False
|
||||
key = event.key()
|
||||
if key == Qt.Key.Key_Space:
|
||||
self._log_key(event, "space")
|
||||
self.play_pause()
|
||||
return True
|
||||
if key == Qt.Key.Key_Right:
|
||||
self._log_key(event, "right")
|
||||
self.player.next()
|
||||
return True
|
||||
if key == Qt.Key.Key_Left:
|
||||
self._log_key(event, "left")
|
||||
self.player.previous()
|
||||
return True
|
||||
return super().eventFilter(obj, event)
|
||||
|
||||
@staticmethod
|
||||
def _log_key(event, name: str):
|
||||
"""Provenance for keys the filter acts on: which input device sent
|
||||
the press (compositor permitting) — see eventlog module docstring."""
|
||||
detail = ""
|
||||
try:
|
||||
device = event.device()
|
||||
if device is not None:
|
||||
detail = f"device={device.name()!r}"
|
||||
except Exception:
|
||||
pass
|
||||
log_control("keyfilter", name, detail)
|
||||
|
||||
def _on_playing_changed(self, playing: bool):
|
||||
if playing:
|
||||
self._inhibitor.inhibit()
|
||||
|
||||
Reference in New Issue
Block a user