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/manifest.json b/custom_components/eversolo/manifest.json index 807ba2e..81fb8bd 100644 --- a/custom_components/eversolo/manifest.json +++ b/custom_components/eversolo/manifest.json @@ -8,5 +8,5 @@ "documentation": "https://github.com/hchris1/Eversolo", "iot_class": "local_polling", "issue_tracker": "https://github.com/hchris1/Eversolo/issues", - "version": "0.2.0" + "version": "0.2.1" } \ No newline at end of file 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 diff --git a/hacs.json b/hacs.json index b9b4be4..bc7dbfb 100644 --- a/hacs.json +++ b/hacs.json @@ -2,7 +2,7 @@ "name": "Eversolo Integration", "filename": "eversolo.zip", "hide_default_branch": true, - "homeassistant": "2023.9.1", + "homeassistant": "2023.10.0", "render_readme": true, "zip_release": true } \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 2491bfb..19e7b56 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ colorlog==6.7.0 -homeassistant==2023.9.1 +homeassistant==2023.10.0 pip>=21.0,<23.3 ruff==0.0.291