Skip to content

v0.17.4-0009: Clear Emby Logos feature (GH #475, bd-v9tp7)#478

Merged
MotWakorb merged 2 commits into
devfrom
feat/bd-clear-emby-logos
Jun 6, 2026
Merged

v0.17.4-0009: Clear Emby Logos feature (GH #475, bd-v9tp7)#478
MotWakorb merged 2 commits into
devfrom
feat/bd-clear-emby-logos

Conversation

@MotWakorb

Copy link
Copy Markdown
Owner

Problem

GH #475 (Critical): Emby caches channel logos and keeps serving a stale image even after the logo changes upstream in Dispatcharr, with no way to force a refresh. Channel Identifiarr has a "clear logos" function that deletes the cached image so Emby re-fetches it; this replicates that.

Approach

Reuses ECM's existing Emby connectivity — the saved emby_base_url + emby_api_key with X-Emby-Token auth (what the resolver/cache already use). A static Emby API key authenticates both GET /LiveTv/Channels (enumerate) and per-channel DELETE /Items/{id}/Images/{type} (clear), so no new credentials and no AuthenticateByName username/password login (simpler than CI). Deleting the cached image makes Emby re-download the logo from its source on next channel access.

What's included

Backend

  • EmbyClient.get_livetv_channels() (the auth gate — a bad key fails here before any delete) and delete_item_image(id, type), with a Primary / LogoLight / LogoLightColor image-type whitelist.
  • New admin-gated routers/emby.py: POST /api/emby/clear-logos202 + {job_id} running a supervised background task (a full-lineup sweep — hundreds of channels × up to 3 types — would exceed the 30s ECM_REQUEST_TIMEOUT_SECONDS middleware; same 202+poll pattern as bulk-commit, bd-ggxks), plus GET /api/emby/clear-logos/{job_id}. Clears all Live TV channels (accepts an optional channel_ids filter for a future per-group UI — PO decision), per-channel resilient, validates Emby is configured (400 otherwise) and the image types (400 on unknown).

Progress via the notification system, like stream probe (PO decision)

  • The job emits a task_clear_emby_logos progress notification (create → rate-limited updates → finalize success/warning), rendered live by the NotificationCenter — progress bar, deleted/skipped/error counts, current channel name — driven by a new clearing active status.

Frontend

  • services/api.ts: clearEmbyLogos + getClearEmbyLogosStatus + EMBY_LOGO_TYPES.
  • Settings → Integrations → Emby: a "Clear Cached Logos" block with per-type checkboxes (default all three) and a fire-and-forget button gated on a saved Emby key; live progress shows in the Notifications panel.
  • NotificationCenter: clearing added to the progress status union + active list.

MCP

  • New clear_emby_logos tool (202+poll), endpoint contract + registration.

Tests

  • Backend: 33 (Emby client + clear-logos router incl. the notification create→update→finalize lifecycle, channel filter, per-channel-error resilience, auth-failure-fails-job).
  • MCP: 6 tool tests + 129 MCP↔backend contract tests.
  • Frontend: 76 (incl. clear-logos UI render, disabled-until-configured, type-filtered call, no-type-selected guard).
  • tsc 0, eslint 0.

Pre-existing unrelated failures in test_alert_methods.py (6 SMTP cases — unregistered smtp type in the local test registry) are environment-specific and documented in PR #474; not touched here.

Versioning

All three touchpoints bumped 0.17.4-0008 → 0.17.4-0009 (consistency check passes); CHANGELOG [Unreleased] → Added entry.

Closes GH #475. bd-v9tp7.

🤖 Generated with Claude Code

claude added 2 commits June 5, 2026 20:06
Emby caches channel logos and keeps serving a stale image even after the
logo changes in Dispatcharr. Replicate Channel Identifiarr's clear-logos
feature, reusing ECM's existing Emby connection (saved emby_base_url +
emby_api_key, X-Emby-Token auth) — no new credentials, no AuthenticateByName
login. Deleting the cached image makes Emby re-download the logo from its
source on next channel access.

Backend:
- EmbyClient.get_livetv_channels() (auth gate) + delete_item_image(id, type)
  with a Primary/LogoLight/LogoLightColor image-type whitelist.
- New admin-gated routers/emby.py: POST /api/emby/clear-logos returns
  202 + {job_id} and runs a supervised background task (full-lineup sweep
  would exceed the 30s request timeout; same 202+poll pattern as bulk-commit
  bd-ggxks), plus GET /api/emby/clear-logos/{job_id} to poll. Clears all
  Live TV channels (optional channel_ids filter for a future per-group UI),
  per-channel resilient, validates Emby is configured.
- Progress surfaced through the notification system like stream probe: the
  job emits a task_clear_emby_logos progress notification (create →
  rate-limited updates → finalize success/warning) rendered live by the
  NotificationCenter via a new 'clearing' active status.

Frontend:
- services/api.ts: clearEmbyLogos + getClearEmbyLogosStatus + EMBY_LOGO_TYPES.
- Settings → Integrations → Emby: "Clear Cached Logos" block with per-type
  checkboxes (default all three), fire-and-forget button gated on a saved key.
- NotificationCenter: add 'clearing' to the progress status union + active list.

MCP:
- New clear_emby_logos tool (202+poll), endpoint contract, registration.

Tests: 33 backend (client + router incl. notification lifecycle), 6 MCP tool,
129 MCP/backend contract, 76 frontend (incl. clear-logos UI). Bumps the three
version touchpoints 0.17.4-0008 -> 0.17.4-0009 and adds the CHANGELOG entry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…pi const

Two CI failures from the clear-logos change:

- Backend test_router_registration::test_used_tags_mostly_covered: the new
  routers/emby.py added a tags=["Emby"] tag not present in main.py
  tags_metadata, pushing the missing-tag set from 3 to 4 (>3 cap). Declare
  the Emby tag in tags_metadata.

- Frontend Plex/Jellyfin section tests crashed rendering the Integrations
  page: SettingsTab read api.EMBY_LOGO_TYPES at render time, but those test
  files mock the api module without that export, so .map() hit undefined.
  Define EMBY_LOGO_TYPES as a local module constant in SettingsTab instead
  (api.clearEmbyLogos stays — it's call-time only). The api export remains
  for the API-layer types/MCP parity.

Verified: full frontend suite 1570 passed; tsc 0; eslint 0; backend
router-registration tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@MotWakorb MotWakorb merged commit 83781d3 into dev Jun 6, 2026
30 checks passed
@MotWakorb MotWakorb deleted the feat/bd-clear-emby-logos branch June 6, 2026 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants