|
|
@ -22,7 +22,6 @@ namespace NzbDrone.Core.Tv
|
|
|
|
void SetMonitoredFlat(Episode episode, bool monitored);
|
|
|
|
void SetMonitoredFlat(Episode episode, bool monitored);
|
|
|
|
void SetMonitoredBySeason(int seriesId, int seasonNumber, bool monitored);
|
|
|
|
void SetMonitoredBySeason(int seriesId, int seasonNumber, bool monitored);
|
|
|
|
void SetFileId(int episodeId, int fileId);
|
|
|
|
void SetFileId(int episodeId, int fileId);
|
|
|
|
void CleanupOrphanedEpisodes();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class EpisodeRepository : BasicRepository<Episode>, IEpisodeRepository
|
|
|
|
public class EpisodeRepository : BasicRepository<Episode>, IEpisodeRepository
|
|
|
@ -124,18 +123,6 @@ namespace NzbDrone.Core.Tv
|
|
|
|
SetFields(new Episode { Id = episodeId, EpisodeFileId = fileId }, episode => episode.EpisodeFileId);
|
|
|
|
SetFields(new Episode { Id = episodeId, EpisodeFileId = fileId }, episode => episode.EpisodeFileId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void CleanupOrphanedEpisodes()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var mapper = _database.GetDataMapper();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mapper.ExecuteNonQuery(@"DELETE FROM Episodes
|
|
|
|
|
|
|
|
WHERE Id IN (
|
|
|
|
|
|
|
|
SELECT Episodes.Id FROM Episodes
|
|
|
|
|
|
|
|
LEFT OUTER JOIN Series
|
|
|
|
|
|
|
|
ON Episodes.SeriesId = Series.Id
|
|
|
|
|
|
|
|
WHERE Series.Id IS NULL)");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private SortBuilder<Episode> GetEpisodesWithoutFilesQuery(PagingSpec<Episode> pagingSpec, DateTime currentTime, int startingSeasonNumber)
|
|
|
|
private SortBuilder<Episode> GetEpisodesWithoutFilesQuery(PagingSpec<Episode> pagingSpec, DateTime currentTime, int startingSeasonNumber)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Query.Join<Episode, Series>(JoinType.Inner, e => e.Series, (e, s) => e.SeriesId == s.Id)
|
|
|
|
return Query.Join<Episode, Series>(JoinType.Inner, e => e.Series, (e, s) => e.SeriesId == s.Id)
|
|
|
|