Remove dead code
- wire.with_figure: the device uses dataclasses.replace directly. - DeviceConnected/DeviceDisconnected: emitted, never subscribed to, and a duplicate of ConnectionChanged(target="firmware"). - ScreenService.toggle(): never called. - GET /api/lirc (LircConfigOut, api.lircConfig): no front-end reads it. - POST /api/volume's delta_percent (api.nudgeVolume): no front-end sends it. - LibraryCache.shrink_stored_covers: a one-off migration that re-read every cover header on every scan. _INDEX_VERSION 7 rebuilds any cache that could still need it. - Firmware: the MFRC522 library and its unused globals (lib/nfc/rc522.c is the driver in use), and mfrc_version.h, a reader test sketch nothing included. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -141,9 +141,6 @@ class ScreenService:
|
||||
self._running = asyncio.create_task(self._run(command, sound=sound), name="screen")
|
||||
return True
|
||||
|
||||
async def toggle(self) -> None:
|
||||
await self._run(self.config.toggle_command, sound=True)
|
||||
|
||||
async def _run(self, command: str, *, sound: bool) -> None:
|
||||
argv = shlex.split(command)
|
||||
try:
|
||||
|
||||
@@ -46,7 +46,6 @@ from musicmouse.services.web.schemas import (
|
||||
HaConfigOut,
|
||||
HaDeviceOut,
|
||||
LibraryOut,
|
||||
LircConfigOut,
|
||||
PlayerStateOut,
|
||||
PlayIn,
|
||||
RemoteMappingIn,
|
||||
@@ -68,7 +67,6 @@ from musicmouse.services.web.schemas import (
|
||||
from musicmouse.services.web.settings import (
|
||||
read_settings,
|
||||
to_device_volume,
|
||||
to_percent,
|
||||
write_settings,
|
||||
)
|
||||
from musicmouse.services.web.state import snapshot
|
||||
@@ -234,18 +232,10 @@ def build_router(
|
||||
return emit(
|
||||
VolumeChangeRequested(delta=general.volume_increment * body.steps, source="web")
|
||||
)
|
||||
if body.percent is not None:
|
||||
target = body.percent
|
||||
elif body.delta_percent is not None:
|
||||
target = to_percent(app.player.volume, general) + body.delta_percent
|
||||
else:
|
||||
raise HTTPException(
|
||||
status_code=422, detail="percent, delta_percent or steps required"
|
||||
)
|
||||
if body.percent is None:
|
||||
raise HTTPException(status_code=422, detail="percent or steps required")
|
||||
return emit(
|
||||
SetVolumeRequested(
|
||||
volume=to_device_volume(max(0, min(100, target)), general), source="web"
|
||||
)
|
||||
SetVolumeRequested(volume=to_device_volume(body.percent, general), source="web")
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------- parent mode
|
||||
@@ -321,12 +311,6 @@ def build_router(
|
||||
|
||||
# -------------------------------------------------------------- IR remote
|
||||
|
||||
@router.get("/lirc")
|
||||
def get_lirc_config() -> LircConfigOut:
|
||||
if app.config.general.lirc is None:
|
||||
raise HTTPException(status_code=404, detail="lirc not configured")
|
||||
return LircConfigOut(connected=app.state.lirc_connected)
|
||||
|
||||
@router.post("/remote/press/{digit}", status_code=204)
|
||||
def press_remote(digit: Digit) -> Response:
|
||||
# A keyboard's number keys, doing what the IR remote's do. An unassigned key
|
||||
|
||||
@@ -26,7 +26,6 @@ __all__ = [
|
||||
"HaConfigOut",
|
||||
"HaDeviceOut",
|
||||
"LibraryOut",
|
||||
"LircConfigOut",
|
||||
"PlayIn",
|
||||
"PlayerStateOut",
|
||||
"RemoteMappingIn",
|
||||
@@ -261,15 +260,13 @@ class SeekIn(BaseModel):
|
||||
|
||||
|
||||
class VolumeIn(BaseModel):
|
||||
"""An absolute percentage, a relative percentage, or a number of steps; exactly
|
||||
one of the three.
|
||||
"""An absolute percentage or a number of steps; exactly one of the two.
|
||||
|
||||
``steps`` moves by ``volume_increment`` device units per step - the same step the
|
||||
IR remote's volume keys and the rotary encoder take - rather than by a percentage.
|
||||
"""
|
||||
|
||||
percent: int | None = Field(default=None, ge=0, le=100)
|
||||
delta_percent: int | None = Field(default=None, ge=-100, le=100)
|
||||
steps: int | None = Field(default=None, ge=-10, le=10)
|
||||
|
||||
|
||||
@@ -325,13 +322,6 @@ class HaConfigOut(BaseModel):
|
||||
scenes: list[HaDeviceOut]
|
||||
|
||||
|
||||
class LircConfigOut(BaseModel):
|
||||
"""Presence-only, like ``HaConfigOut``: there is nothing secret in a host/port,
|
||||
but the frontend only needs to know whether the remote is set up and connected."""
|
||||
|
||||
connected: bool
|
||||
|
||||
|
||||
class RemoteSlotOut(BaseModel):
|
||||
digit: str
|
||||
target_kind: Literal["album", "series"]
|
||||
|
||||
Reference in New Issue
Block a user