mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-24 22:35:39 -04:00
Added: Additional Album Monitoring Options
This commit is contained in:
@@ -25,6 +25,7 @@ namespace NzbDrone.Core.Music
|
||||
void SetMonitoredFlat(Album album, bool monitored);
|
||||
void SetMonitored(IEnumerable<int> ids, bool monitored);
|
||||
Album FindAlbumByRelease(string releaseId);
|
||||
List<Album> GetArtistAlbumsWithFiles(Artist artist);
|
||||
}
|
||||
|
||||
public class AlbumRepository : BasicRepository<Album>, IAlbumRepository
|
||||
@@ -307,5 +308,19 @@ namespace NzbDrone.Core.Music
|
||||
{
|
||||
return Query.FirstOrDefault(e => e.Releases.Any(r => r.Id == releaseId));
|
||||
}
|
||||
|
||||
public List<Album> GetArtistAlbumsWithFiles(Artist artist)
|
||||
{
|
||||
string query = string.Format("SELECT Albums.* FROM (SELECT Tracks.AlbumId, COUNT(*) AS TotalTrackCount," + "" +
|
||||
"SUM(CASE WHEN TrackFileId > 0 THEN 1 ELSE 0 END) AS AvailableTrackCount FROM Tracks GROUP BY Tracks.ArtistId, Tracks.AlbumId) as Tracks" +
|
||||
" LEFT OUTER JOIN Albums ON Tracks.AlbumId == Albums.Id" +
|
||||
" LEFT OUTER JOIN Artists ON Albums.ArtistId == Artists.Id" +
|
||||
" WHERE Tracks.AvailableTrackCount > 0" +
|
||||
" AND Albums.ArtistId=" + artist.Id +
|
||||
" GROUP BY Tracks.AlbumId");
|
||||
|
||||
return Query.QueryText(query);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user