public List <Album> GetAlbums(ParsedAlbumInfo parsedAlbumInfo, Artist artist, SearchCriteriaBase searchCriteria = null) { var albumTitle = parsedAlbumInfo.AlbumTitle; var result = new List <Album>(); if (parsedAlbumInfo.AlbumTitle == null) { return(new List <Album>()); } Album albumInfo = null; if (parsedAlbumInfo.Discography) { if (parsedAlbumInfo.DiscographyStart > 0) { return(_albumService.ArtistAlbumsBetweenDates(artist, new DateTime(parsedAlbumInfo.DiscographyStart, 1, 1), new DateTime(parsedAlbumInfo.DiscographyEnd, 12, 31), false)); } if (parsedAlbumInfo.DiscographyEnd > 0) { return(_albumService.ArtistAlbumsBetweenDates(artist, new DateTime(1800, 1, 1), new DateTime(parsedAlbumInfo.DiscographyEnd, 12, 31), false)); } return(_albumService.GetAlbumsByArtist(artist.Id)); } if (searchCriteria != null) { albumInfo = searchCriteria.Albums.ExclusiveOrDefault(e => e.Title == albumTitle); } if (albumInfo == null) { // TODO: Search by Title and Year instead of just Title when matching albumInfo = _albumService.FindByTitle(artist.ArtistMetadataId, parsedAlbumInfo.AlbumTitle); } if (albumInfo == null) { _logger.Debug("Trying inexact album match for {0}", parsedAlbumInfo.AlbumTitle); albumInfo = _albumService.FindByTitleInexact(artist.ArtistMetadataId, parsedAlbumInfo.AlbumTitle); } if (albumInfo != null) { result.Add(albumInfo); } else { _logger.Debug("Unable to find {0}", parsedAlbumInfo); } return(result); }