2013-02-20 03:05:15 +01:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using NLog;
|
2013-04-24 03:56:00 +02:00
|
|
|
using NzbDrone.Common.Messaging;
|
2013-03-07 05:34:56 +01:00
|
|
|
using NzbDrone.Core.Configuration;
|
2013-02-24 20:18:48 +01:00
|
|
|
using NzbDrone.Core.Download;
|
2013-03-07 05:34:56 +01:00
|
|
|
using NzbDrone.Core.MediaFiles.Events;
|
2013-03-04 06:53:02 +01:00
|
|
|
using NzbDrone.Core.MetadataSource;
|
2013-02-20 03:05:15 +01:00
|
|
|
using NzbDrone.Core.Model;
|
2013-03-03 23:26:41 +01:00
|
|
|
using NzbDrone.Core.Tv.Events;
|
2013-02-20 03:05:15 +01:00
|
|
|
|
|
|
|
namespace NzbDrone.Core.Tv
|
|
|
|
{
|
|
|
|
public interface IEpisodeService
|
|
|
|
{
|
|
|
|
Episode GetEpisode(int id);
|
2013-04-15 03:41:39 +02:00
|
|
|
Episode GetEpisode(int seriesId, int seasonNumber, int episodeNumber, bool useScene = false);
|
2013-02-20 03:05:15 +01:00
|
|
|
Episode GetEpisode(int seriesId, DateTime date);
|
2013-03-02 20:13:23 +01:00
|
|
|
List<Episode> GetEpisodeBySeries(int seriesId);
|
2013-03-04 00:18:43 +01:00
|
|
|
List<Episode> GetEpisodesBySeason(int seriesId, int seasonNumber);
|
|
|
|
List<Episode> EpisodesWithoutFiles(bool includeSpecials);
|
|
|
|
List<Episode> GetEpisodesByFileId(int episodeFileId);
|
|
|
|
List<Episode> EpisodesWithFiles();
|
2013-02-20 03:05:15 +01:00
|
|
|
void RefreshEpisodeInfo(Series series);
|
|
|
|
void UpdateEpisode(Episode episode);
|
2013-03-04 00:18:43 +01:00
|
|
|
List<int> GetEpisodeNumbersBySeason(int seriesId, int seasonNumber);
|
2013-02-20 03:05:15 +01:00
|
|
|
void SetEpisodeIgnore(int episodeId, bool isIgnored);
|
2013-04-15 03:41:39 +02:00
|
|
|
bool IsFirstOrLastEpisodeOfSeason(int episodeId);
|
2013-02-20 03:05:15 +01:00
|
|
|
void SetPostDownloadStatus(List<int> episodeIds, PostDownloadStatusType postDownloadStatus);
|
|
|
|
void UpdateEpisodes(List<Episode> episodes);
|
2013-02-26 04:30:24 +01:00
|
|
|
List<Episode> EpisodesBetweenDates(DateTime start, DateTime end);
|
2013-02-20 03:05:15 +01:00
|
|
|
}
|
|
|
|
|
2013-03-05 20:49:34 +01:00
|
|
|
public class EpisodeService : IEpisodeService,
|
|
|
|
IHandle<EpisodeGrabbedEvent>,
|
2013-03-07 05:34:56 +01:00
|
|
|
IHandle<EpisodeFileDeletedEvent>,
|
2013-04-15 03:41:39 +02:00
|
|
|
IHandle<EpisodeFileAddedEvent>,
|
|
|
|
IHandleAsync<SeriesDeletedEvent>,
|
2013-03-30 23:43:19 +01:00
|
|
|
IHandleAsync<SeriesAddedEvent>
|
2013-02-20 03:05:15 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
2013-03-31 22:25:39 +02:00
|
|
|
private readonly IProvideEpisodeInfo _episodeInfoProxy;
|
2013-02-20 03:05:15 +01:00
|
|
|
private readonly ISeasonRepository _seasonRepository;
|
2013-02-24 21:24:31 +01:00
|
|
|
private readonly IEpisodeRepository _episodeRepository;
|
2013-04-24 03:56:00 +02:00
|
|
|
private readonly IMessageAggregator _messageAggregator;
|
2013-03-07 05:34:56 +01:00
|
|
|
private readonly IConfigService _configService;
|
2013-04-17 08:55:39 +02:00
|
|
|
private readonly ISeriesService _seriesService;
|
2013-03-07 05:34:56 +01:00
|
|
|
private readonly Logger _logger;
|
2013-02-20 03:05:15 +01:00
|
|
|
|
2013-04-17 08:55:39 +02:00
|
|
|
public EpisodeService(IProvideEpisodeInfo episodeInfoProxy, ISeasonRepository seasonRepository,
|
2013-04-24 03:56:00 +02:00
|
|
|
IEpisodeRepository episodeRepository, IMessageAggregator messageAggregator,
|
2013-04-17 08:55:39 +02:00
|
|
|
IConfigService configService, ISeriesService seriesService, Logger logger)
|
2013-02-20 03:05:15 +01:00
|
|
|
{
|
2013-03-31 22:25:39 +02:00
|
|
|
_episodeInfoProxy = episodeInfoProxy;
|
2013-02-20 03:05:15 +01:00
|
|
|
_seasonRepository = seasonRepository;
|
|
|
|
_episodeRepository = episodeRepository;
|
2013-04-24 03:56:00 +02:00
|
|
|
_messageAggregator = messageAggregator;
|
2013-03-07 05:34:56 +01:00
|
|
|
_configService = configService;
|
2013-04-17 08:55:39 +02:00
|
|
|
_seriesService = seriesService;
|
2013-03-07 05:34:56 +01:00
|
|
|
_logger = logger;
|
2013-02-20 03:05:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-02 20:13:23 +01:00
|
|
|
public Episode GetEpisode(int id)
|
2013-02-20 03:05:15 +01:00
|
|
|
{
|
|
|
|
return _episodeRepository.Get(id);
|
|
|
|
}
|
|
|
|
|
2013-04-15 03:41:39 +02:00
|
|
|
public Episode GetEpisode(int seriesId, int seasonNumber, int episodeNumber, bool useSceneNumbering = false)
|
2013-02-20 03:05:15 +01:00
|
|
|
{
|
2013-04-15 03:41:39 +02:00
|
|
|
if (useSceneNumbering)
|
|
|
|
{
|
|
|
|
return _episodeRepository.GetEpisodeBySceneNumbering(seriesId, seasonNumber, episodeNumber);
|
|
|
|
}
|
2013-02-20 03:05:15 +01:00
|
|
|
return _episodeRepository.Get(seriesId, seasonNumber, episodeNumber);
|
|
|
|
}
|
|
|
|
|
2013-03-02 20:13:23 +01:00
|
|
|
public Episode GetEpisode(int seriesId, DateTime date)
|
2013-02-20 03:05:15 +01:00
|
|
|
{
|
|
|
|
return _episodeRepository.Get(seriesId, date);
|
|
|
|
}
|
|
|
|
|
2013-03-02 20:13:23 +01:00
|
|
|
public List<Episode> GetEpisodeBySeries(int seriesId)
|
2013-02-20 03:05:15 +01:00
|
|
|
{
|
2013-03-02 20:13:23 +01:00
|
|
|
return _episodeRepository.GetEpisodes(seriesId).ToList();
|
2013-02-20 03:05:15 +01:00
|
|
|
}
|
|
|
|
|
2013-03-04 00:18:43 +01:00
|
|
|
public List<Episode> GetEpisodesBySeason(int seriesId, int seasonNumber)
|
2013-02-20 03:05:15 +01:00
|
|
|
{
|
|
|
|
return _episodeRepository.GetEpisodes(seriesId, seasonNumber);
|
|
|
|
}
|
|
|
|
|
2013-03-04 00:18:43 +01:00
|
|
|
public List<Episode> EpisodesWithoutFiles(bool includeSpecials)
|
2013-02-20 03:05:15 +01:00
|
|
|
{
|
|
|
|
return _episodeRepository.EpisodesWithoutFiles(includeSpecials);
|
|
|
|
}
|
|
|
|
|
2013-03-04 00:18:43 +01:00
|
|
|
public List<Episode> GetEpisodesByFileId(int episodeFileId)
|
2013-02-20 03:05:15 +01:00
|
|
|
{
|
|
|
|
return _episodeRepository.GetEpisodeByFileId(episodeFileId);
|
|
|
|
}
|
|
|
|
|
2013-03-04 00:18:43 +01:00
|
|
|
public List<Episode> EpisodesWithFiles()
|
2013-02-20 03:05:15 +01:00
|
|
|
{
|
|
|
|
return _episodeRepository.EpisodesWithFiles();
|
|
|
|
}
|
|
|
|
|
2013-03-02 20:13:23 +01:00
|
|
|
public void RefreshEpisodeInfo(Series series)
|
2013-02-20 03:05:15 +01:00
|
|
|
{
|
2013-02-26 04:58:57 +01:00
|
|
|
logger.Trace("Starting episode info refresh for series: {0}", series.Title.WithDefault(series.Id));
|
2013-02-20 03:05:15 +01:00
|
|
|
var successCount = 0;
|
|
|
|
var failCount = 0;
|
|
|
|
|
2013-04-17 08:55:39 +02:00
|
|
|
var tvdbEpisodes = _episodeInfoProxy.GetEpisodeInfo(series.TvdbId);
|
2013-02-26 03:20:42 +01:00
|
|
|
|
2013-02-26 04:58:57 +01:00
|
|
|
var seriesEpisodes = GetEpisodeBySeries(series.Id);
|
2013-02-20 03:05:15 +01:00
|
|
|
var updateList = new List<Episode>();
|
|
|
|
var newList = new List<Episode>();
|
|
|
|
|
|
|
|
foreach (var episode in tvdbEpisodes.OrderBy(e => e.SeasonNumber).ThenBy(e => e.EpisodeNumber))
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
logger.Trace("Updating info for [{0}] - S{1:00}E{2:00}", series.Title, episode.SeasonNumber, episode.EpisodeNumber);
|
|
|
|
|
|
|
|
//first check using tvdbId, this should cover cases when and episode number in a season is changed
|
2013-03-02 21:14:18 +01:00
|
|
|
|
|
|
|
var episodes = seriesEpisodes.Where(e => e.TvDbEpisodeId == episode.TvDbEpisodeId).ToList();
|
2013-02-26 03:20:42 +01:00
|
|
|
var episodeToUpdate = seriesEpisodes.SingleOrDefault(e => e.TvDbEpisodeId == episode.TvDbEpisodeId);
|
2013-02-20 03:05:15 +01:00
|
|
|
|
|
|
|
//not found, try using season/episode number
|
|
|
|
if (episodeToUpdate == null)
|
|
|
|
{
|
|
|
|
episodeToUpdate = seriesEpisodes.SingleOrDefault(e => e.SeasonNumber == episode.SeasonNumber && e.EpisodeNumber == episode.EpisodeNumber);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (episodeToUpdate == null)
|
|
|
|
{
|
|
|
|
episodeToUpdate = new Episode();
|
|
|
|
newList.Add(episodeToUpdate);
|
|
|
|
|
|
|
|
//If it is Episode Zero Ignore it (specials, sneak peeks.)
|
|
|
|
if (episode.EpisodeNumber == 0 && episode.SeasonNumber != 1)
|
|
|
|
{
|
|
|
|
episodeToUpdate.Ignored = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-02-26 04:58:57 +01:00
|
|
|
episodeToUpdate.Ignored = _seasonRepository.IsIgnored(series.Id, episode.SeasonNumber);
|
2013-02-20 03:05:15 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
updateList.Add(episodeToUpdate);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((episodeToUpdate.EpisodeNumber != episode.EpisodeNumber ||
|
|
|
|
episodeToUpdate.SeasonNumber != episode.SeasonNumber) &&
|
|
|
|
episodeToUpdate.EpisodeFileId > 0)
|
|
|
|
{
|
2013-02-26 03:20:42 +01:00
|
|
|
logger.Info("Unlinking episode file because TheTVDB changed the episode number...");
|
2013-02-20 03:05:15 +01:00
|
|
|
episodeToUpdate.EpisodeFile = null;
|
|
|
|
}
|
|
|
|
|
2013-02-26 04:58:57 +01:00
|
|
|
episodeToUpdate.SeriesId = series.Id;
|
2013-02-25 01:00:17 +01:00
|
|
|
episodeToUpdate.Series = series;
|
2013-02-26 03:20:42 +01:00
|
|
|
episodeToUpdate.TvDbEpisodeId = episode.TvDbEpisodeId;
|
2013-02-20 03:05:15 +01:00
|
|
|
episodeToUpdate.EpisodeNumber = episode.EpisodeNumber;
|
|
|
|
episodeToUpdate.SeasonNumber = episode.SeasonNumber;
|
2013-02-26 03:20:42 +01:00
|
|
|
episodeToUpdate.AbsoluteEpisodeNumber = episode.AbsoluteEpisodeNumber;
|
|
|
|
episodeToUpdate.Title = episode.Title;
|
|
|
|
episodeToUpdate.Overview = episode.Overview;
|
|
|
|
episodeToUpdate.AirDate = episode.AirDate;
|
2013-02-20 03:05:15 +01:00
|
|
|
|
2013-03-03 23:26:41 +01:00
|
|
|
if (!String.IsNullOrWhiteSpace(series.AirTime) && episodeToUpdate.AirDate.HasValue)
|
2013-03-01 05:59:06 +01:00
|
|
|
{
|
|
|
|
episodeToUpdate.AirDate = episodeToUpdate.AirDate.Value.Add(Convert.ToDateTime(series.AirTime).TimeOfDay)
|
|
|
|
.AddHours(series.UtcOffset * -1);
|
|
|
|
}
|
|
|
|
|
2013-02-20 03:05:15 +01:00
|
|
|
successCount++;
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
logger.FatalException(String.Format("An error has occurred while updating episode info for series {0}", series.Title), e);
|
|
|
|
failCount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-20 19:03:19 +02:00
|
|
|
var allEpisodes = new List<Episode>();
|
|
|
|
allEpisodes.AddRange(newList);
|
|
|
|
allEpisodes.AddRange(updateList);
|
|
|
|
|
|
|
|
var groups = allEpisodes.GroupBy(e => new { e.SeriesId, e.AirDate }).Where(g => g.Count() > 1).ToList();
|
|
|
|
|
|
|
|
foreach (var group in groups)
|
|
|
|
{
|
|
|
|
int episodeCount = 0;
|
|
|
|
foreach (var episode in group.OrderBy(e => e.SeasonNumber).ThenBy(e => e.EpisodeNumber))
|
|
|
|
{
|
|
|
|
episode.AirDate = episode.AirDate.Value.AddMinutes(episode.Series.Runtime * episodeCount);
|
|
|
|
episodeCount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-20 03:05:15 +01:00
|
|
|
_episodeRepository.InsertMany(newList);
|
|
|
|
_episodeRepository.UpdateMany(updateList);
|
|
|
|
|
2013-03-03 23:26:41 +01:00
|
|
|
if (newList.Any())
|
|
|
|
{
|
2013-04-27 04:03:34 +02:00
|
|
|
_messageAggregator.PublishEvent(new EpisodeInfoAddedEvent(newList));
|
2013-03-03 23:26:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (updateList.Any())
|
|
|
|
{
|
2013-04-27 04:03:34 +02:00
|
|
|
_messageAggregator.PublishEvent(new EpisodeInfoUpdatedEvent(updateList));
|
2013-03-03 23:26:41 +01:00
|
|
|
}
|
|
|
|
|
2013-02-20 03:05:15 +01:00
|
|
|
if (failCount != 0)
|
|
|
|
{
|
|
|
|
logger.Info("Finished episode refresh for series: {0}. Successful: {1} - Failed: {2} ",
|
|
|
|
series.Title, successCount, failCount);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
logger.Info("Finished episode refresh for series: {0}.", series.Title);
|
|
|
|
}
|
|
|
|
|
|
|
|
DeleteEpisodesNotInTvdb(series, tvdbEpisodes);
|
|
|
|
}
|
|
|
|
|
2013-03-02 20:13:23 +01:00
|
|
|
public void UpdateEpisode(Episode episode)
|
2013-02-20 03:05:15 +01:00
|
|
|
{
|
|
|
|
_episodeRepository.Update(episode);
|
|
|
|
}
|
|
|
|
|
2013-03-04 00:18:43 +01:00
|
|
|
public List<int> GetEpisodeNumbersBySeason(int seriesId, int seasonNumber)
|
2013-02-20 03:05:15 +01:00
|
|
|
{
|
2013-02-26 04:58:57 +01:00
|
|
|
return GetEpisodesBySeason(seriesId, seasonNumber).Select(c => c.Id).ToList();
|
2013-02-20 03:05:15 +01:00
|
|
|
}
|
|
|
|
|
2013-03-02 20:13:23 +01:00
|
|
|
public void SetEpisodeIgnore(int episodeId, bool isIgnored)
|
2013-02-20 03:05:15 +01:00
|
|
|
{
|
|
|
|
var episode = _episodeRepository.Get(episodeId);
|
2013-03-01 08:03:41 +01:00
|
|
|
_episodeRepository.SetIgnoreFlat(episode, isIgnored);
|
2013-02-20 03:05:15 +01:00
|
|
|
|
|
|
|
logger.Info("Ignore flag for Episode:{0} was set to {1}", episodeId, isIgnored);
|
|
|
|
}
|
|
|
|
|
2013-04-15 03:41:39 +02:00
|
|
|
public bool IsFirstOrLastEpisodeOfSeason(int episodeId)
|
2013-02-20 03:05:15 +01:00
|
|
|
{
|
2013-04-15 03:41:39 +02:00
|
|
|
var episode = GetEpisode(episodeId);
|
|
|
|
var seasonEpisodes = GetEpisodesBySeason(episode.SeriesId, episode.SeasonNumber);
|
2013-02-20 03:05:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
//Ensure that this is either the first episode
|
|
|
|
//or is the last episode in a season that has 10 or more episodes
|
2013-04-15 03:41:39 +02:00
|
|
|
if (seasonEpisodes.First().EpisodeNumber == episode.EpisodeNumber || (seasonEpisodes.Count() >= 10 && seasonEpisodes.Last().EpisodeNumber == episode.EpisodeNumber))
|
2013-02-20 03:05:15 +01:00
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-03-02 20:13:23 +01:00
|
|
|
public void SetPostDownloadStatus(List<int> episodeIds, PostDownloadStatusType postDownloadStatus)
|
2013-02-20 03:05:15 +01:00
|
|
|
{
|
|
|
|
if (episodeIds.Count == 0) throw new ArgumentException("episodeIds should contain one or more episode ids.");
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var episodeId in episodeIds)
|
|
|
|
{
|
|
|
|
var episode = _episodeRepository.Get(episodeId);
|
|
|
|
episode.PostDownloadStatus = postDownloadStatus;
|
|
|
|
_episodeRepository.Update(episode);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
logger.Trace("Updating PostDownloadStatus for {0} episode(s) to {1}", episodeIds.Count, postDownloadStatus);
|
|
|
|
}
|
|
|
|
|
2013-03-02 20:13:23 +01:00
|
|
|
public void UpdateEpisodes(List<Episode> episodes)
|
2013-02-20 03:05:15 +01:00
|
|
|
{
|
|
|
|
_episodeRepository.UpdateMany(episodes);
|
|
|
|
}
|
|
|
|
|
2013-02-26 04:30:24 +01:00
|
|
|
public List<Episode> EpisodesBetweenDates(DateTime start, DateTime end)
|
2013-02-24 00:08:22 +01:00
|
|
|
{
|
2013-04-17 08:55:39 +02:00
|
|
|
var episodes = _episodeRepository.EpisodesBetweenDates(start.ToUniversalTime(), end.ToUniversalTime());
|
|
|
|
var series = _seriesService.GetSeriesInList(episodes.Select(e => e.SeriesId).Distinct());
|
|
|
|
|
|
|
|
episodes.ForEach(e =>
|
|
|
|
{
|
|
|
|
e.Series = series.SingleOrDefault(s => s.Id == e.SeriesId);
|
|
|
|
});
|
|
|
|
|
|
|
|
return episodes;
|
2013-02-24 00:08:22 +01:00
|
|
|
}
|
2013-02-24 20:18:48 +01:00
|
|
|
|
|
|
|
public void Handle(EpisodeGrabbedEvent message)
|
|
|
|
{
|
2013-04-15 03:41:39 +02:00
|
|
|
foreach (var episode in message.Episode.Episodes)
|
2013-02-24 20:18:48 +01:00
|
|
|
{
|
2013-02-26 04:58:57 +01:00
|
|
|
logger.Trace("Marking episode {0} as fetched.", episode.Id);
|
2013-02-24 20:18:48 +01:00
|
|
|
episode.GrabDate = DateTime.UtcNow;
|
|
|
|
_episodeRepository.Update(episode);
|
|
|
|
}
|
|
|
|
}
|
2013-03-05 20:49:34 +01:00
|
|
|
|
|
|
|
public void HandleAsync(SeriesDeletedEvent message)
|
|
|
|
{
|
|
|
|
var episodes = GetEpisodeBySeries(message.Series.Id);
|
|
|
|
_episodeRepository.DeleteMany(episodes);
|
|
|
|
}
|
2013-03-07 05:34:56 +01:00
|
|
|
|
|
|
|
public void Handle(EpisodeFileDeletedEvent message)
|
|
|
|
{
|
|
|
|
foreach (var episode in GetEpisodesByFileId(message.EpisodeFile.Id))
|
|
|
|
{
|
|
|
|
_logger.Trace("Detaching episode {0} from file.", episode.Id);
|
|
|
|
episode.EpisodeFile = null;
|
|
|
|
episode.Ignored = _configService.AutoIgnorePreviouslyDownloadedEpisodes;
|
|
|
|
episode.GrabDate = null;
|
|
|
|
episode.PostDownloadStatus = PostDownloadStatusType.Unknown;
|
|
|
|
UpdateEpisode(episode);
|
|
|
|
}
|
|
|
|
}
|
2013-03-30 23:43:19 +01:00
|
|
|
|
|
|
|
public void HandleAsync(SeriesAddedEvent message)
|
|
|
|
{
|
|
|
|
RefreshEpisodeInfo(message.Series);
|
|
|
|
}
|
2013-04-15 03:41:39 +02:00
|
|
|
|
|
|
|
public void Handle(EpisodeFileAddedEvent message)
|
|
|
|
{
|
|
|
|
foreach (var episode in message.EpisodeFile.Episodes.Value)
|
|
|
|
{
|
|
|
|
_episodeRepository.SetFileId(episode.Id, message.EpisodeFile.Id);
|
|
|
|
_episodeRepository.SetPostDownloadStatus(episode.Id, PostDownloadStatusType.NoError);
|
|
|
|
_logger.Debug("Linking [{0}] > [{1}]", message.EpisodeFile.Path, episode);
|
|
|
|
}
|
|
|
|
}
|
2013-04-20 19:03:19 +02:00
|
|
|
|
|
|
|
private void DeleteEpisodesNotInTvdb(Series series, IEnumerable<Episode> tvdbEpisodes)
|
|
|
|
{
|
|
|
|
//Todo: This will not work as currently implemented - what are we trying to do here?
|
|
|
|
return;
|
|
|
|
logger.Trace("Starting deletion of episodes that no longer exist in TVDB: {0}", series.Title.WithDefault(series.Id));
|
|
|
|
foreach (var episode in tvdbEpisodes)
|
|
|
|
{
|
|
|
|
_episodeRepository.Delete(episode.Id);
|
|
|
|
}
|
|
|
|
|
|
|
|
logger.Trace("Deleted episodes that no longer exist in TVDB for {0}", series.Id);
|
|
|
|
}
|
2013-02-20 03:05:15 +01:00
|
|
|
}
|
|
|
|
}
|