feat(connection,media_player): on-demand manifest-label cache (≥24h TTL, one pm dump per watchdog cycle via the task pool) + app_name order map > label > entity > raw package (P5-1)
This commit is contained in:
1 parent
80e9a691bc
commit
cd0e634a76
3 files changed
+80
-9
No files matched your search
@@ -544,21 +544,29 @@ class NvidiaShieldMediaPlayer(MediaPlayerEntity):
|
||||
|
||||
@property
|
||||
def app_name(self):
|
||||
"""Entity tier → protocol-push tier → the P4-1 apps map.
|
||||
"""P5-1 resolution order — explicit override first:
|
||||
|
||||
The map (package → friendly name) resolves after the entity and
|
||||
push tiers; unmapped packages stay raw (icons follow HA's media
|
||||
image lookup by name).
|
||||
1. CONF_APP_NAME_MAP (the user's explicit override)
|
||||
2. device manifest label (`pm dump`, cached ≥24 h, resolved on
|
||||
demand — a miss enqueues the fetch and falls through)
|
||||
3. androidtv entity tier (when configured)
|
||||
4. raw package (protocol push / ADB foreground parse)
|
||||
"""
|
||||
package = self._manager.foreground_app if self._manager else None
|
||||
if package:
|
||||
mapped = self._app_name_map.get(package)
|
||||
if mapped:
|
||||
return mapped
|
||||
label = self._manager.app_label(package)
|
||||
if label:
|
||||
return label
|
||||
atv = self._read(self._androidtv_entity) if self._androidtv_entity else None
|
||||
if atv is not None:
|
||||
app_name = atv.attributes.get("app_name")
|
||||
if app_name:
|
||||
return app_name
|
||||
if self._manager is not None:
|
||||
package = self._manager.current_app
|
||||
if package:
|
||||
return self._app_name_map.get(package, package)
|
||||
if self._manager is not None and package:
|
||||
return package
|
||||
return None
|
||||
|
||||
@property
|
||||
|
||||
Reference in new issue
Block a user