Add artist and year to album spec string when available

This commit is contained in:
Daniel Underwood 2017-07-07 23:27:18 -04:00
parent e617563b63
commit 8c4d99eeff
No known key found for this signature in database
GPG Key ID: 7DF3A93330A80FCA
2 changed files with 15 additions and 1 deletions

View File

@ -6,7 +6,16 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
{ {
public override string ToString() public override string ToString()
{ {
return $"[{Album.Title}]"; var baseRepresentation = $"[{Artist.Name} - {Album.Title}]";
if (Album.ReleaseDate.HasValue)
{
var beforeLast = baseRepresentation.Length - 1;
return baseRepresentation.Insert(beforeLast, $" ({Album.ReleaseDate.Value.Year})");
}
else
{
return baseRepresentation;
}
} }
} }
} }

View File

@ -34,6 +34,7 @@ namespace NzbDrone.Core.IndexerSearch
private readonly IEpisodeService _episodeService; private readonly IEpisodeService _episodeService;
private readonly IAlbumService _albumService; private readonly IAlbumService _albumService;
private readonly IArtistService _artistService;
private readonly IMakeDownloadDecision _makeDownloadDecision; private readonly IMakeDownloadDecision _makeDownloadDecision;
private readonly Logger _logger; private readonly Logger _logger;
@ -42,6 +43,7 @@ namespace NzbDrone.Core.IndexerSearch
ISeriesService seriesService, ISeriesService seriesService,
IEpisodeService episodeService, IEpisodeService episodeService,
IAlbumService albumService, IAlbumService albumService,
IArtistService artistService,
IMakeDownloadDecision makeDownloadDecision, IMakeDownloadDecision makeDownloadDecision,
Logger logger) Logger logger)
{ {
@ -50,6 +52,7 @@ namespace NzbDrone.Core.IndexerSearch
_seriesService = seriesService; _seriesService = seriesService;
_episodeService = episodeService; _episodeService = episodeService;
_albumService = albumService; _albumService = albumService;
_artistService = artistService;
_makeDownloadDecision = makeDownloadDecision; _makeDownloadDecision = makeDownloadDecision;
_logger = logger; _logger = logger;
} }
@ -269,7 +272,9 @@ namespace NzbDrone.Core.IndexerSearch
{ {
var spec = new TSpec(); var spec = new TSpec();
album = _albumService.GetAlbum(album.Id);
spec.Album = album; spec.Album = album;
spec.Artist = _artistService.GetArtist(album.ArtistId);
spec.UserInvokedSearch = userInvokedSearch; spec.UserInvokedSearch = userInvokedSearch;
return spec; return spec;