Minor nit
This commit is contained in:
parent
54dee15713
commit
57064f3b3c
14
src/tui/lib/external/musicbrainz/mod.rs
vendored
14
src/tui/lib/external/musicbrainz/mod.rs
vendored
@ -1,7 +1,7 @@
|
|||||||
//! Module for interacting with the [MusicBrainz API](https://musicbrainz.org/doc/MusicBrainz_API).
|
//! Module for interacting with the [MusicBrainz API](https://musicbrainz.org/doc/MusicBrainz_API).
|
||||||
|
|
||||||
use musichoard::{
|
use musichoard::{
|
||||||
collection::{album::Album, musicbrainz::IMusicBrainzRef},
|
collection::album::{Album, AlbumDate},
|
||||||
external::musicbrainz::{
|
external::musicbrainz::{
|
||||||
IMusicBrainzHttp, MusicBrainzClient, SearchReleaseGroupRequest,
|
IMusicBrainzHttp, MusicBrainzClient, SearchReleaseGroupRequest,
|
||||||
SearchReleaseGroupResponseUnit,
|
SearchReleaseGroupResponseUnit,
|
||||||
@ -27,15 +27,15 @@ impl<Http: IMusicBrainzHttp> IMusicBrainz for MusicBrainz<Http> {
|
|||||||
arid: &Mbid,
|
arid: &Mbid,
|
||||||
album: &Album,
|
album: &Album,
|
||||||
) -> Result<Vec<Match<Album>>, Error> {
|
) -> Result<Vec<Match<Album>>, Error> {
|
||||||
|
// Some release groups may have a promotional early release messing up the search. Searching
|
||||||
|
// with just the year should be enough anyway.
|
||||||
|
let date = AlbumDate::new(album.date.year, None, None);
|
||||||
|
|
||||||
let mut request = SearchReleaseGroupRequest::default();
|
let mut request = SearchReleaseGroupRequest::default();
|
||||||
request.arid(arid);
|
|
||||||
if let Some(ref mbref) = album.musicbrainz {
|
|
||||||
request.rgid(mbref.mbid());
|
|
||||||
} else {
|
|
||||||
request
|
request
|
||||||
.first_release_date(&album.date)
|
.arid(arid)
|
||||||
|
.first_release_date(&date)
|
||||||
.release_group(&album.id.title);
|
.release_group(&album.id.title);
|
||||||
}
|
|
||||||
|
|
||||||
let mb_response = self.client.search_release_group(request)?;
|
let mb_response = self.client.search_release_group(request)?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user