mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
moved media file service
This commit is contained in:
parent
8900bbb3a1
commit
de5d5b76e8
46 changed files with 512 additions and 488 deletions
39
NzbDrone.Core/MediaFiles/MediaFileRepository.cs
Normal file
39
NzbDrone.Core/MediaFiles/MediaFileRepository.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Datastore;
|
||||
|
||||
namespace NzbDrone.Core.MediaFiles
|
||||
{
|
||||
public interface IMediaFileRepository : IBasicRepository<EpisodeFile>
|
||||
{
|
||||
EpisodeFile GetFileByPath(string path);
|
||||
List<EpisodeFile> GetFilesBySeries(int seriesId);
|
||||
List<EpisodeFile> GetFilesBySeason(int seriesId, int seasonNumber);
|
||||
}
|
||||
|
||||
|
||||
public class MediaFileRepository : BasicRepository<EpisodeFile>, IMediaFileRepository
|
||||
{
|
||||
public MediaFileRepository(IObjectDatabase objectDatabase)
|
||||
: base(objectDatabase)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public EpisodeFile GetFileByPath(string path)
|
||||
{
|
||||
return Queryable.SingleOrDefault(c => c.Path == path);
|
||||
}
|
||||
|
||||
public List<EpisodeFile> GetFilesBySeries(int seriesId)
|
||||
{
|
||||
return Queryable.Where(c => c.SeriesId == seriesId).ToList();
|
||||
}
|
||||
|
||||
public List<EpisodeFile> GetFilesBySeason(int seriesId, int seasonNumber)
|
||||
{
|
||||
return Queryable.Where(c => c.SeriesId == seriesId && c.SeasonNumber == seasonNumber).ToList();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue