Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

11 album artwork not shown when using airplay #12

Merged
merged 3 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion custom_components/eversolo/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion custom_components/eversolo/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
17 changes: 10 additions & 7 deletions custom_components/eversolo/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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