Decide carefully where external::musicbrainz
belongs
#196
@ -22,7 +22,7 @@ pub struct MbidError(String);
|
||||
|
||||
impl fmt::Display for MbidError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", self.0)
|
||||
write!(f, "failed to parse a MBID: {}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
|
7
src/external/musicbrainz/api/lookup.rs
vendored
7
src/external/musicbrainz/api/lookup.rs
vendored
@ -20,15 +20,16 @@ impl<Http: IMusicBrainzHttp> MusicBrainzClient<Http> {
|
||||
) -> Result<LookupArtistResponse, Error> {
|
||||
let mut include: Vec<String> = vec![];
|
||||
|
||||
let mbid: String = request.mbid.uuid().as_hyphenated().to_string();
|
||||
|
||||
if request.release_groups {
|
||||
include.push(String::from("release-groups"));
|
||||
}
|
||||
|
||||
let include: String =
|
||||
form_urlencoded::byte_serialize(include.join("+").as_bytes()).collect();
|
||||
let url = format!("{MB_BASE_URL}/artist/{mbid}?inc={include}");
|
||||
let url = format!(
|
||||
"{MB_BASE_URL}/artist/{mbid}?inc={include}",
|
||||
mbid = request.mbid.uuid().as_hyphenated()
|
||||
);
|
||||
|
||||
let response: DeserializeLookupArtistResponse = self.http.get(&url)?;
|
||||
Ok(response.into())
|
||||
|
Loading…
Reference in New Issue
Block a user