Radio App for WUVA 92.7
Website: Live Radio and Song History
A (potential) source for cover art. The process seems complicated, but the images are licensed for comercial use without restrictions and the API is available for free.
Steps:
-
Get the
cue_title
andtrack_artist_name
from the Triton Station Player -
Use
cue_title
andtrack_artist_name
to query MusicBrainz Search API for the 36 characterMBID
(info)-
Url encode the parameters with the following syntax
"<cue_title>" AND artist:"<track_artist_name>"&limit=10
- If
<track_artist_name>
contains a forward slash (/
), which happens in some cases like where<track_artist_name>
is"artist_one F/ artist_two"
or when it's"artist_one W/ artist_two"
, we take the substring from the beginning of<track_artist_name>
to the first space found when searching backwards from the slash. In the above cases, this abbreviates the artist parameter to just"artist_one"
. This is necessary b/c the CoverArt database doesn't recognize artists in this format. - If
<cue_title>
or<track_artist_name>
is 27 characters long (the max_length coming from Triton Station Player), we assume the information got cut off and do the following: 1) Don't Enclose the Parameter in""
marks . 2) Add a*
to the end of the parameter - Example:
- If a parameter contains some occurrences of either
'&'
or'+'
but not both AND the above wildcard case (*) didn't apply to the parameter, we do the following: 1)<param> = (<param>%20OR%20<param_2>)
, where<param_2>
is equivalent to param with'&'
or'+'
(whatever appeared in param) replaced by the other symbol. If we're dealing with<track_artist_name>
note that<param>
and<param_2>
both include"artist:"
This is necessary b/c sometimes these symbols are used interchangeably and inconsistently between the Triton and the CoverArt/MusicBrainz databases. - Examples:
- https://www.musicbrainz.org/ws/2/recording?query=%22Nothin%27%20Like%20You%22+AND+%28artist:%22Dan+%2B+Shay%22%20OR%20artist:%22Dan+%26+Shay%22%29
- https://www.musicbrainz.org/ws/2/recording?query=%28%22Talladega%22%20OR%20%22Springsteen%22%29+AND+artist:%22Eric+Church%22 where you can imagine that
Springsteen
andTalladega
are identical phrases except for one contains+
while the other contains&
.
- If
-
Retrieve the
id
for all of thereleases
- If no
ids
exists, a placeholder image should be displayed
- If no
-
Sample query:
cue_title
: Talladegatrack_artist_name
: Eric Church- Search url: https://musicbrainz.org/ws/2/recording/?query="talladega"%20AND%20artist:%22eric%20church%22&limit=10
- A Resulting id:
9ca2e2db-bc6e-4f71-b16f-63020aa4b651
(among others)
-
-
For all release_ids (up to 10), fire off concurrent requests with the following format:
- Use the
id
to construct an image url based on the the Cover Art Archive API - Url syntax: 'https://coverartarchive.org/release/<release_id>/front-500.jpg'
- Sample image url: https://coverartarchive.org/release/9ca2e2db-bc6e-4f71-b16f-63020aa4b651/front-500
- Use the
-
Each request should write its result back to its respective spot in an array, based on the order the requests were fired off (which is also the order result_ids were found in the search results). When all requests are done, step through the array sequentially. If we find image data, use it (priority goes to higher search results). If we exhaust the array without finding image data, use a default image.