diff --git a/custom_components/eversolo/api.py b/custom_components/eversolo/api.py index 39d0160..0bbd76e 100644 --- a/custom_components/eversolo/api.py +++ b/custom_components/eversolo/api.py @@ -246,10 +246,14 @@ async def async_set_output(self, index, tag) -> any: parseJson=False, ) - def create_internal_image_url(self, song_id) -> any: + def create_image_url_by_song_id(self, song_id) -> any: """Create url to fetch album covers when using the internal player.""" return f"http://{self._host}:{self._port}/ZidooMusicControl/v2/getImage?id={song_id}&target=16" + def create_image_url_by_path(self, path) -> any: + """Create url to fetch album covers when using AirPlay by concatting the path.""" + return f"http://{self._host}:{self._port}{path}" + async def _api_wrapper( self, method: str, diff --git a/custom_components/eversolo/media_player.py b/custom_components/eversolo/media_player.py index fbb07e3..846aa42 100644 --- a/custom_components/eversolo/media_player.py +++ b/custom_components/eversolo/media_player.py @@ -226,20 +226,23 @@ def media_image_url(self): # Bluetooth or Spotify Connect if play_type == 6: - album_url = ( - music_control_state.get("everSoloPlayInfo", {}) - .get("everSoloPlayAudioInfo", {}) - .get("albumUrl", None) + album_url = music_control_state.get("everSoloPlayInfo", {}).get( + "icon", None ) - if album_url is not None: - return album_url + if album_url is None or album_url == "": + return None + + if not album_url.startswith("http"): + album_url = self.coordinator.client.create_image_url_by_path(album_url) + + return album_url # Internal Player if play_type == 5: song_id = music_control_state.get("playingMusic", {}).get("id", None) if song_id is not None: - return self.coordinator.client.create_internal_image_url(song_id) + return self.coordinator.client.create_image_url_by_song_id(song_id) return None