feat(config_flow,media_player): apps name/icon map editor in the options flow (package=name per line, invalid input error) + app_name resolves through CONF_APP_NAME_MAP after the entity/push tiers (P4-1b)
This commit is contained in:
1 parent
1dbb695cec
commit
61c7ac99a3
2 files changed
+63
-4
No files matched your search
@@ -48,6 +48,7 @@ from .const import (
|
||||
CHANNEL_DIGIT_DELAY,
|
||||
CONF_ADB_STORE_APP_INFO,
|
||||
CONF_ANDROIDTV_ENTITY,
|
||||
CONF_APP_NAME_MAP,
|
||||
CONF_CHANNEL_DIGIT_DELAY,
|
||||
CONF_CHANNEL_SEND_ENTER,
|
||||
CONF_JELLYFIN_ENTITY,
|
||||
@@ -511,16 +512,28 @@ class NvidiaShieldMediaPlayer(MediaPlayerEntity):
|
||||
return self._manager.current_app
|
||||
return None
|
||||
|
||||
@property
|
||||
def _app_name_map(self) -> dict:
|
||||
"""The user's apps name/icon map (P4-1 options editor)."""
|
||||
return self._entry.options.get(CONF_APP_NAME_MAP) or {}
|
||||
|
||||
@property
|
||||
def app_name(self):
|
||||
"""Entity tier → protocol-push tier → the P4-1 apps map.
|
||||
|
||||
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).
|
||||
"""
|
||||
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:
|
||||
# Name resolution is deferred app-map work; the package is truth.
|
||||
return self._manager.current_app
|
||||
package = self._manager.current_app
|
||||
if package:
|
||||
return self._app_name_map.get(package, package)
|
||||
return None
|
||||
|
||||
@property
|
||||
|
||||
Reference in new issue
Block a user