|
|
@ -6,7 +6,6 @@ using NzbDrone.Common.Instrumentation;
|
|
|
|
using NzbDrone.Core.Configuration;
|
|
|
|
using NzbDrone.Core.Configuration;
|
|
|
|
using NzbDrone.Core.Datastore;
|
|
|
|
using NzbDrone.Core.Datastore;
|
|
|
|
using NzbDrone.Core.MediaFiles.Events;
|
|
|
|
using NzbDrone.Core.MediaFiles.Events;
|
|
|
|
using NzbDrone.Core.Messaging;
|
|
|
|
|
|
|
|
using NzbDrone.Core.Messaging.Events;
|
|
|
|
using NzbDrone.Core.Messaging.Events;
|
|
|
|
using NzbDrone.Core.Tv.Events;
|
|
|
|
using NzbDrone.Core.Tv.Events;
|
|
|
|
|
|
|
|
|
|
|
@ -15,7 +14,6 @@ namespace NzbDrone.Core.Tv
|
|
|
|
public interface IEpisodeService
|
|
|
|
public interface IEpisodeService
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Episode GetEpisode(int id);
|
|
|
|
Episode GetEpisode(int id);
|
|
|
|
Episode GetEpisode(int seriesId, int seasonNumber, int episodeNumber, bool useScene = false);
|
|
|
|
|
|
|
|
Episode FindEpisode(int seriesId, int seasonNumber, int episodeNumber, bool useScene = false);
|
|
|
|
Episode FindEpisode(int seriesId, int seasonNumber, int episodeNumber, bool useScene = false);
|
|
|
|
Episode GetEpisode(int seriesId, DateTime date);
|
|
|
|
Episode GetEpisode(int seriesId, DateTime date);
|
|
|
|
Episode FindEpisode(int seriesId, DateTime date);
|
|
|
|
Episode FindEpisode(int seriesId, DateTime date);
|
|
|
@ -23,9 +21,7 @@ namespace NzbDrone.Core.Tv
|
|
|
|
List<Episode> GetEpisodesBySeason(int seriesId, int seasonNumber);
|
|
|
|
List<Episode> GetEpisodesBySeason(int seriesId, int seasonNumber);
|
|
|
|
PagingSpec<Episode> EpisodesWithoutFiles(PagingSpec<Episode> pagingSpec);
|
|
|
|
PagingSpec<Episode> EpisodesWithoutFiles(PagingSpec<Episode> pagingSpec);
|
|
|
|
List<Episode> GetEpisodesByFileId(int episodeFileId);
|
|
|
|
List<Episode> GetEpisodesByFileId(int episodeFileId);
|
|
|
|
List<Episode> EpisodesWithFiles();
|
|
|
|
|
|
|
|
void UpdateEpisode(Episode episode);
|
|
|
|
void UpdateEpisode(Episode episode);
|
|
|
|
List<int> GetEpisodeNumbersBySeason(int seriesId, int seasonNumber);
|
|
|
|
|
|
|
|
void SetEpisodeMonitored(int episodeId, bool monitored);
|
|
|
|
void SetEpisodeMonitored(int episodeId, bool monitored);
|
|
|
|
bool IsFirstOrLastEpisodeOfSeason(int episodeId);
|
|
|
|
bool IsFirstOrLastEpisodeOfSeason(int episodeId);
|
|
|
|
void UpdateEpisodes(List<Episode> episodes);
|
|
|
|
void UpdateEpisodes(List<Episode> episodes);
|
|
|
@ -42,8 +38,6 @@ namespace NzbDrone.Core.Tv
|
|
|
|
IHandleAsync<SeriesDeletedEvent>
|
|
|
|
IHandleAsync<SeriesDeletedEvent>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly Logger logger = NzbDroneLogger.GetLogger();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly IEpisodeRepository _episodeRepository;
|
|
|
|
private readonly IEpisodeRepository _episodeRepository;
|
|
|
|
private readonly IConfigService _configService;
|
|
|
|
private readonly IConfigService _configService;
|
|
|
|
private readonly Logger _logger;
|
|
|
|
private readonly Logger _logger;
|
|
|
@ -60,15 +54,6 @@ namespace NzbDrone.Core.Tv
|
|
|
|
return _episodeRepository.Get(id);
|
|
|
|
return _episodeRepository.Get(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Episode GetEpisode(int seriesId, int seasonNumber, int episodeNumber, bool useSceneNumbering = false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (useSceneNumbering)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return _episodeRepository.GetEpisodeBySceneNumbering(seriesId, seasonNumber, episodeNumber);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return _episodeRepository.Find(seriesId, seasonNumber, episodeNumber);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Episode FindEpisode(int seriesId, int seasonNumber, int episodeNumber, bool useSceneNumbering = false)
|
|
|
|
public Episode FindEpisode(int seriesId, int seasonNumber, int episodeNumber, bool useSceneNumbering = false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (useSceneNumbering)
|
|
|
|
if (useSceneNumbering)
|
|
|
@ -110,27 +95,17 @@ namespace NzbDrone.Core.Tv
|
|
|
|
return _episodeRepository.GetEpisodeByFileId(episodeFileId);
|
|
|
|
return _episodeRepository.GetEpisodeByFileId(episodeFileId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<Episode> EpisodesWithFiles()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return _episodeRepository.EpisodesWithFiles();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void UpdateEpisode(Episode episode)
|
|
|
|
public void UpdateEpisode(Episode episode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_episodeRepository.Update(episode);
|
|
|
|
_episodeRepository.Update(episode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<int> GetEpisodeNumbersBySeason(int seriesId, int seasonNumber)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return GetEpisodesBySeason(seriesId, seasonNumber).Select(c => c.Id).ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void SetEpisodeMonitored(int episodeId, bool monitored)
|
|
|
|
public void SetEpisodeMonitored(int episodeId, bool monitored)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var episode = _episodeRepository.Get(episodeId);
|
|
|
|
var episode = _episodeRepository.Get(episodeId);
|
|
|
|
_episodeRepository.SetMonitoredFlat(episode, monitored);
|
|
|
|
_episodeRepository.SetMonitoredFlat(episode, monitored);
|
|
|
|
|
|
|
|
|
|
|
|
logger.Debug("Monitored flag for Episode:{0} was set to {1}", episodeId, monitored);
|
|
|
|
_logger.Debug("Monitored flag for Episode:{0} was set to {1}", episodeId, monitored);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetEpisodeMonitoredBySeason(int seriesId, int seasonNumber, bool monitored)
|
|
|
|
public void SetEpisodeMonitoredBySeason(int seriesId, int seasonNumber, bool monitored)
|
|
|
|