using System.Collections.Generic; using NzbDrone.Core.Datastore; using NzbDrone.Core.Messaging.Events; namespace NzbDrone.Core.MediaFiles { public interface IMediaFileRepository : IBasicRepository { List GetFilesBySeries(int seriesId); List GetFilesBySeason(int seriesId, int seasonNumber); List GetFilesWithoutMediaInfo(); } public class MediaFileRepository : BasicRepository, IMediaFileRepository { public MediaFileRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } public List GetFilesBySeries(int seriesId) { return Query.Where(c => c.SeriesId == seriesId).ToList(); } public List GetFilesBySeason(int seriesId, int seasonNumber) { return Query.Where(c => c.SeriesId == seriesId) .AndWhere(c => c.SeasonNumber == seasonNumber) .ToList(); } public List GetFilesWithoutMediaInfo() { return Query.Where(c => c.MediaInfo == null).ToList(); } } }