|
|
@ -17,7 +17,7 @@ namespace NzbDrone.Core.Music
|
|
|
|
Track GetTrack(int id);
|
|
|
|
Track GetTrack(int id);
|
|
|
|
List<Track> GetTracks(IEnumerable<int> ids);
|
|
|
|
List<Track> GetTracks(IEnumerable<int> ids);
|
|
|
|
Track FindTrack(int artistId, int albumId, int mediumNumber, int trackNumber);
|
|
|
|
Track FindTrack(int artistId, int albumId, int mediumNumber, int trackNumber);
|
|
|
|
Track FindTrackByTitle(int artistId, int albumId, int mediumNumber, string releaseTitle);
|
|
|
|
Track FindTrackByTitle(int artistId, int albumId, int mediumNumber, int trackNumber, string releaseTitle);
|
|
|
|
List<Track> GetTracksByArtist(int artistId);
|
|
|
|
List<Track> GetTracksByArtist(int artistId);
|
|
|
|
List<Track> GetTracksByAlbum(int albumId);
|
|
|
|
List<Track> GetTracksByAlbum(int albumId);
|
|
|
|
//List<Track> GetTracksByAlbumTitle(string artistId, string albumTitle);
|
|
|
|
//List<Track> GetTracksByAlbumTitle(string artistId, string albumTitle);
|
|
|
@ -76,7 +76,7 @@ namespace NzbDrone.Core.Music
|
|
|
|
return _trackRepository.GetTracksByAlbum(albumId);
|
|
|
|
return _trackRepository.GetTracksByAlbum(albumId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Track FindTrackByTitle(int artistId, int albumId, int mediumNumber, string releaseTitle)
|
|
|
|
public Track FindTrackByTitle(int artistId, int albumId, int mediumNumber, int trackNumber, string releaseTitle)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// TODO: can replace this search mechanism with something smarter/faster/better
|
|
|
|
// TODO: can replace this search mechanism with something smarter/faster/better
|
|
|
|
var normalizedReleaseTitle = Parser.Parser.NormalizeEpisodeTitle(releaseTitle).Replace(".", " ");
|
|
|
|
var normalizedReleaseTitle = Parser.Parser.NormalizeEpisodeTitle(releaseTitle).Replace(".", " ");
|
|
|
@ -88,9 +88,17 @@ namespace NzbDrone.Core.Music
|
|
|
|
Position = normalizedReleaseTitle.IndexOf(Parser.Parser.NormalizeEpisodeTitle(track.Title), StringComparison.CurrentCultureIgnoreCase),
|
|
|
|
Position = normalizedReleaseTitle.IndexOf(Parser.Parser.NormalizeEpisodeTitle(track.Title), StringComparison.CurrentCultureIgnoreCase),
|
|
|
|
Length = Parser.Parser.NormalizeEpisodeTitle(track.Title).Length,
|
|
|
|
Length = Parser.Parser.NormalizeEpisodeTitle(track.Title).Length,
|
|
|
|
Track = track
|
|
|
|
Track = track
|
|
|
|
})
|
|
|
|
});
|
|
|
|
.Where(e => e.Track.Title.Length > 0 && e.Position >= 0)
|
|
|
|
|
|
|
|
.OrderBy(e => e.Position)
|
|
|
|
if (trackNumber == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
matches = matches.Where(e => e.Track.Title.Length > 0 && e.Position >= 0);
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
matches = matches.Where(e => e.Track.Title.Length > 0 && e.Position >= 0 && e.Track.AbsoluteTrackNumber == trackNumber);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
matches.OrderBy(e => e.Position)
|
|
|
|
.ThenByDescending(e => e.Length)
|
|
|
|
.ThenByDescending(e => e.Length)
|
|
|
|
.ToList();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|