Remove unused LanguagesBelowCutoff
This commit is contained in:
parent
8971ac2e14
commit
fd58e9671c
|
@ -21,7 +21,6 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
|
|||
private Series _unmonitoredSeries;
|
||||
private PagingSpec<Episode> _pagingSpec;
|
||||
private List<QualitiesBelowCutoff> _qualitiesBelowCutoff;
|
||||
private List<LanguagesBelowCutoff> _languagesBelowCutoff;
|
||||
private List<Episode> _unairedEpisodes;
|
||||
|
||||
[SetUp]
|
||||
|
@ -71,11 +70,6 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
|
|||
new QualitiesBelowCutoff(profile.Id, new[] { Quality.SDTV.Id })
|
||||
};
|
||||
|
||||
_languagesBelowCutoff = new List<LanguagesBelowCutoff>
|
||||
{
|
||||
new LanguagesBelowCutoff(profile.Id, new[] { Language.English.Id })
|
||||
};
|
||||
|
||||
var qualityMetLanguageUnmet = new EpisodeFile { RelativePath = "a", Quality = new QualityModel { Quality = Quality.WEBDL480p }, Languages = new List<Language> { Language.English } };
|
||||
var qualityMetLanguageMet = new EpisodeFile { RelativePath = "b", Quality = new QualityModel { Quality = Quality.WEBDL480p }, Languages = new List<Language> { Language.Spanish } };
|
||||
var qualityMetLanguageExceed = new EpisodeFile { RelativePath = "c", Quality = new QualityModel { Quality = Quality.WEBDL480p }, Languages = new List<Language> { Language.French } };
|
||||
|
@ -157,7 +151,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
|
|||
{
|
||||
GivenMonitoredFilterExpression();
|
||||
|
||||
var spec = Subject.EpisodesWhereCutoffUnmet(_pagingSpec, _qualitiesBelowCutoff, _languagesBelowCutoff, false);
|
||||
var spec = Subject.EpisodesWhereCutoffUnmet(_pagingSpec, _qualitiesBelowCutoff, false);
|
||||
|
||||
spec.Records.Should().HaveCount(1);
|
||||
spec.Records.Should().OnlyContain(e => e.EpisodeFile.Value.Quality.Quality == Quality.SDTV);
|
||||
|
@ -168,7 +162,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
|
|||
{
|
||||
GivenMonitoredFilterExpression();
|
||||
|
||||
var spec = Subject.EpisodesWhereCutoffUnmet(_pagingSpec, _qualitiesBelowCutoff, _languagesBelowCutoff, false);
|
||||
var spec = Subject.EpisodesWhereCutoffUnmet(_pagingSpec, _qualitiesBelowCutoff, false);
|
||||
|
||||
spec.Records.Should().HaveCount(1);
|
||||
spec.Records.Should().OnlyContain(e => e.Monitored);
|
||||
|
@ -179,7 +173,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
|
|||
{
|
||||
GivenMonitoredFilterExpression();
|
||||
|
||||
var spec = Subject.EpisodesWhereCutoffUnmet(_pagingSpec, _qualitiesBelowCutoff, _languagesBelowCutoff, false);
|
||||
var spec = Subject.EpisodesWhereCutoffUnmet(_pagingSpec, _qualitiesBelowCutoff, false);
|
||||
|
||||
spec.Records.Should().HaveCount(1);
|
||||
spec.Records.Should().OnlyContain(e => e.Series.Monitored);
|
||||
|
@ -192,7 +186,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
|
|||
|
||||
GivenMonitoredFilterExpression();
|
||||
|
||||
var spec = Subject.EpisodesWhereCutoffUnmet(_pagingSpec, _qualitiesBelowCutoff, _languagesBelowCutoff, false);
|
||||
var spec = Subject.EpisodesWhereCutoffUnmet(_pagingSpec, _qualitiesBelowCutoff, false);
|
||||
|
||||
spec.Records.Should().HaveCount(2);
|
||||
spec.Records.Should().OnlyContain(e => e.Series.Monitored);
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace NzbDrone.Core.Languages
|
||||
{
|
||||
public class LanguagesBelowCutoff
|
||||
{
|
||||
public int ProfileId { get; set; }
|
||||
public IEnumerable<int> LanguageIds { get; set; }
|
||||
|
||||
public LanguagesBelowCutoff(int profileId, IEnumerable<int> languageIds)
|
||||
{
|
||||
ProfileId = profileId;
|
||||
LanguageIds = languageIds;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Languages;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
|
@ -19,7 +17,7 @@ namespace NzbDrone.Core.Tv
|
|||
private readonly IEpisodeRepository _episodeRepository;
|
||||
private readonly IQualityProfileService _qualityProfileService;
|
||||
|
||||
public EpisodeCutoffService(IEpisodeRepository episodeRepository, IQualityProfileService qualityProfileService, Logger logger)
|
||||
public EpisodeCutoffService(IEpisodeRepository episodeRepository, IQualityProfileService qualityProfileService)
|
||||
{
|
||||
_episodeRepository = episodeRepository;
|
||||
_qualityProfileService = qualityProfileService;
|
||||
|
@ -28,7 +26,6 @@ namespace NzbDrone.Core.Tv
|
|||
public PagingSpec<Episode> EpisodesWhereCutoffUnmet(PagingSpec<Episode> pagingSpec)
|
||||
{
|
||||
var qualitiesBelowCutoff = new List<QualitiesBelowCutoff>();
|
||||
var languagesBelowCutoff = new List<LanguagesBelowCutoff>();
|
||||
var profiles = _qualityProfileService.All();
|
||||
|
||||
// Get all items less than the cutoff
|
||||
|
@ -51,7 +48,7 @@ namespace NzbDrone.Core.Tv
|
|||
return pagingSpec;
|
||||
}
|
||||
|
||||
return _episodeRepository.EpisodesWhereCutoffUnmet(pagingSpec, qualitiesBelowCutoff, languagesBelowCutoff, false);
|
||||
return _episodeRepository.EpisodesWhereCutoffUnmet(pagingSpec, qualitiesBelowCutoff, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ using System.Linq;
|
|||
using Dapper;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Languages;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
@ -23,7 +22,7 @@ namespace NzbDrone.Core.Tv
|
|||
List<Episode> GetEpisodeByFileId(int fileId);
|
||||
List<Episode> EpisodesWithFiles(int seriesId);
|
||||
PagingSpec<Episode> EpisodesWithoutFiles(PagingSpec<Episode> pagingSpec, bool includeSpecials);
|
||||
PagingSpec<Episode> EpisodesWhereCutoffUnmet(PagingSpec<Episode> pagingSpec, List<QualitiesBelowCutoff> qualitiesBelowCutoff, List<LanguagesBelowCutoff> languagesBelowCutoff, bool includeSpecials);
|
||||
PagingSpec<Episode> EpisodesWhereCutoffUnmet(PagingSpec<Episode> pagingSpec, List<QualitiesBelowCutoff> qualitiesBelowCutoff, bool includeSpecials);
|
||||
List<Episode> FindEpisodesBySceneNumbering(int seriesId, int seasonNumber, int episodeNumber);
|
||||
List<Episode> FindEpisodesBySceneNumbering(int seriesId, int sceneAbsoluteEpisodeNumber);
|
||||
List<Episode> EpisodesBetweenDates(DateTime startDate, DateTime endDate, bool includeUnmonitored);
|
||||
|
@ -124,7 +123,7 @@ namespace NzbDrone.Core.Tv
|
|||
return pagingSpec;
|
||||
}
|
||||
|
||||
public PagingSpec<Episode> EpisodesWhereCutoffUnmet(PagingSpec<Episode> pagingSpec, List<QualitiesBelowCutoff> qualitiesBelowCutoff, List<LanguagesBelowCutoff> languagesBelowCutoff, bool includeSpecials)
|
||||
public PagingSpec<Episode> EpisodesWhereCutoffUnmet(PagingSpec<Episode> pagingSpec, List<QualitiesBelowCutoff> qualitiesBelowCutoff, bool includeSpecials)
|
||||
{
|
||||
var startingSeasonNumber = 1;
|
||||
|
||||
|
@ -133,10 +132,10 @@ namespace NzbDrone.Core.Tv
|
|||
startingSeasonNumber = 0;
|
||||
}
|
||||
|
||||
pagingSpec.Records = GetPagedRecords(EpisodesWhereCutoffUnmetBuilder(qualitiesBelowCutoff, languagesBelowCutoff, startingSeasonNumber), pagingSpec, PagedQuery);
|
||||
pagingSpec.Records = GetPagedRecords(EpisodesWhereCutoffUnmetBuilder(qualitiesBelowCutoff, startingSeasonNumber), pagingSpec, PagedQuery);
|
||||
|
||||
var countTemplate = $"SELECT COUNT(*) FROM (SELECT /**select**/ FROM \"{TableMapping.Mapper.TableNameMapping(typeof(Episode))}\" /**join**/ /**innerjoin**/ /**leftjoin**/ /**where**/ /**groupby**/ /**having**/) AS \"Inner\"";
|
||||
pagingSpec.TotalRecords = GetPagedRecordCount(EpisodesWhereCutoffUnmetBuilder(qualitiesBelowCutoff, languagesBelowCutoff, startingSeasonNumber).Select(typeof(Episode)), pagingSpec, countTemplate);
|
||||
pagingSpec.TotalRecords = GetPagedRecordCount(EpisodesWhereCutoffUnmetBuilder(qualitiesBelowCutoff, startingSeasonNumber).Select(typeof(Episode)), pagingSpec, countTemplate);
|
||||
|
||||
return pagingSpec;
|
||||
}
|
||||
|
@ -225,7 +224,7 @@ namespace NzbDrone.Core.Tv
|
|||
currentTime.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
|
||||
private SqlBuilder EpisodesWhereCutoffUnmetBuilder(List<QualitiesBelowCutoff> qualitiesBelowCutoff, List<LanguagesBelowCutoff> languagesBelowCutoff, int startingSeasonNumber) => Builder()
|
||||
private SqlBuilder EpisodesWhereCutoffUnmetBuilder(List<QualitiesBelowCutoff> qualitiesBelowCutoff, int startingSeasonNumber) => Builder()
|
||||
.Join<Episode, Series>((e, s) => e.SeriesId == s.Id)
|
||||
.LeftJoin<Episode, EpisodeFile>((e, ef) => e.EpisodeFileId == ef.Id)
|
||||
.Where<Episode>(e => e.EpisodeFileId != 0)
|
||||
|
|
Loading…
Reference in New Issue