From f5627da222eeb2931f0dc329fda7b6813c521f7a Mon Sep 17 00:00:00 2001 From: Joshua Askharoun Date: Sun, 21 Feb 2021 20:09:31 -0600 Subject: [PATCH] Add album art to album search and artist page; Remove check for album art in Cover Art Archive in some places --- app.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 3c43288..b09b01b 100644 --- a/app.py +++ b/app.py @@ -55,9 +55,7 @@ def music_genre(): @app.route("/v3.2/en-US/music/album//") def music_get_album(album_id: str): - print(album_id) album = musicbrainzngs.get_release_by_id(album_id, includes=["artists", "recordings"])["release"] - print(album) album_name: str = album["title"] artist = album["artist-credit"][0]["artist"] artist_id: str = artist["id"] @@ -172,6 +170,12 @@ def music_get_artist_albums(artist_id: str): entry: Element = create_entry(doc, title, id, f"/v3.2/en-US/music/artist/{artist_id}/albums/{id}") feed.appendChild(entry) + # Add front cover + image_elem: Element = doc.createElement("image") + image_id_elem: Element = create_id(doc, id) + image_elem.appendChild(image_id_elem) + entry.appendChild(image_elem) + # Create primaryArtist element primary_artist_elem: Element = doc.createElement("primaryArtist") @@ -298,6 +302,12 @@ def music_album(): title: str = release["title"] entry: Element = create_entry(doc, title, id, "/v3.2/en-US/music/album/" + id) + # Add front cover + image_elem: Element = doc.createElement("image") + image_id_elem: Element = create_id(doc, id) + image_elem.appendChild(image_id_elem) + entry.appendChild(image_elem) + # Get artist ID and Name artist = release["artist-credit"][0]["artist"] artist_id: str = artist["id"]