|
|
|
@ -13,11 +13,11 @@ namespace NzbDrone.Core.Music
|
|
|
|
|
{
|
|
|
|
|
public interface ITrackRepository : IBasicRepository<Track>
|
|
|
|
|
{
|
|
|
|
|
Track Find(string artistId, string albumId, int trackNumber);
|
|
|
|
|
List<Track> GetTracks(string artistId);
|
|
|
|
|
List<Track> GetTracks(string artistId, string albumId);
|
|
|
|
|
Track Find(int artistId, int albumId, int trackNumber);
|
|
|
|
|
List<Track> GetTracks(int artistId);
|
|
|
|
|
List<Track> GetTracks(int artistId, int albumId);
|
|
|
|
|
List<Track> GetTracksByFileId(int fileId);
|
|
|
|
|
List<Track> TracksWithFiles(string artistId);
|
|
|
|
|
List<Track> TracksWithFiles(int artistId);
|
|
|
|
|
PagingSpec<Track> TracksWithoutFiles(PagingSpec<Track> pagingSpec);
|
|
|
|
|
PagingSpec<Track> TracksWhereCutoffUnmet(PagingSpec<Track> pagingSpec, List<QualitiesBelowCutoff> qualitiesBelowCutoff);
|
|
|
|
|
void SetMonitoredFlat(Track episode, bool monitored);
|
|
|
|
@ -37,23 +37,23 @@ namespace NzbDrone.Core.Music
|
|
|
|
|
_logger = logger;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Track Find(string artistId, string albumId, int trackNumber)
|
|
|
|
|
public Track Find(int artistId, int albumId, int trackNumber)
|
|
|
|
|
{
|
|
|
|
|
return Query.Where(s => s.ArtistSpotifyId == artistId)
|
|
|
|
|
return Query.Where(s => s.ArtistId == artistId)
|
|
|
|
|
.AndWhere(s => s.AlbumId == albumId)
|
|
|
|
|
.AndWhere(s => s.TrackNumber == trackNumber)
|
|
|
|
|
.SingleOrDefault();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Track> GetTracks(string artistId)
|
|
|
|
|
public List<Track> GetTracks(int artistId)
|
|
|
|
|
{
|
|
|
|
|
return Query.Where(s => s.ArtistSpotifyId == artistId).ToList();
|
|
|
|
|
return Query.Where(s => s.ArtistId == artistId).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Track> GetTracks(string artistId, string albumId)
|
|
|
|
|
public List<Track> GetTracks(int artistId, int albumId)
|
|
|
|
|
{
|
|
|
|
|
return Query.Where(s => s.ArtistSpotifyId == artistId)
|
|
|
|
|
return Query.Where(s => s.ArtistId == artistId)
|
|
|
|
|
.AndWhere(s => s.AlbumId == albumId)
|
|
|
|
|
.ToList();
|
|
|
|
|
}
|
|
|
|
@ -63,10 +63,10 @@ namespace NzbDrone.Core.Music
|
|
|
|
|
return Query.Where(e => e.TrackFileId == fileId).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Track> TracksWithFiles(string artistId)
|
|
|
|
|
public List<Track> TracksWithFiles(int artistId)
|
|
|
|
|
{
|
|
|
|
|
return Query.Join<Track, TrackFile>(JoinType.Inner, e => e.TrackFile, (e, ef) => e.TrackFileId == ef.Id)
|
|
|
|
|
.Where(e => e.ArtistSpotifyId == artistId);
|
|
|
|
|
.Where(e => e.ArtistId == artistId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public PagingSpec<Track> TracksWhereCutoffUnmet(PagingSpec<Track> pagingSpec, List<QualitiesBelowCutoff> qualitiesBelowCutoff)
|
|
|
|
@ -118,7 +118,7 @@ namespace NzbDrone.Core.Music
|
|
|
|
|
|
|
|
|
|
private SortBuilder<Track> GetMissingEpisodesQuery(PagingSpec<Track> pagingSpec, DateTime currentTime)
|
|
|
|
|
{
|
|
|
|
|
return Query.Join<Track, Artist>(JoinType.Inner, e => e.Artist, (e, s) => e.ArtistSpotifyId == s.ForeignArtistId)
|
|
|
|
|
return Query.Join<Track, Artist>(JoinType.Inner, e => e.Artist, (e, s) => e.ArtistId == s.Id)
|
|
|
|
|
.Where(pagingSpec.FilterExpression)
|
|
|
|
|
.AndWhere(e => e.TrackFileId == 0)
|
|
|
|
|
.AndWhere(BuildAirDateUtcCutoffWhereClause(currentTime))
|
|
|
|
@ -130,7 +130,7 @@ namespace NzbDrone.Core.Music
|
|
|
|
|
|
|
|
|
|
private SortBuilder<Track> EpisodesWhereCutoffUnmetQuery(PagingSpec<Track> pagingSpec, List<QualitiesBelowCutoff> qualitiesBelowCutoff)
|
|
|
|
|
{
|
|
|
|
|
return Query.Join<Track, Artist>(JoinType.Inner, e => e.Artist, (e, s) => e.ArtistSpotifyId == s.ForeignArtistId)
|
|
|
|
|
return Query.Join<Track, Artist>(JoinType.Inner, e => e.Artist, (e, s) => e.ArtistId == s.Id)
|
|
|
|
|
.Join<Track, TrackFile>(JoinType.Left, e => e.TrackFile, (e, s) => e.TrackFileId == s.Id)
|
|
|
|
|
.Where(pagingSpec.FilterExpression)
|
|
|
|
|
.AndWhere(e => e.TrackFileId != 0)
|
|
|
|
|