public PagingSpec <Episode> EpisodesWhereCutoffUnmet(PagingSpec <Episode> pagingSpec) { var qualitiesBelowCutoff = new List <QualitiesBelowCutoff>(); var languagesBelowCutoff = new List <LanguagesBelowCutoff>(); var profiles = _qualityProfileService.All(); var languageProfiles = _languageProfileService.All(); //Get all items less than the cutoff foreach (var profile in profiles) { var cutoffIndex = profile.GetIndex(profile.Cutoff); var belowCutoff = profile.Items.Take(cutoffIndex.Index).ToList(); if (belowCutoff.Any()) { qualitiesBelowCutoff.Add(new QualitiesBelowCutoff(profile.Id, belowCutoff.SelectMany(i => i.GetQualities().Select(q => q.Id)))); } } foreach (var profile in languageProfiles) { var languageCutoffIndex = profile.Languages.FindIndex(v => v.Language == profile.Cutoff); var belowLanguageCutoff = profile.Languages.Take(languageCutoffIndex).ToList(); if (belowLanguageCutoff.Any()) { languagesBelowCutoff.Add(new LanguagesBelowCutoff(profile.Id, belowLanguageCutoff.Select(l => l.Language.Id))); } } return(_episodeRepository.EpisodesWhereCutoffUnmet(pagingSpec, qualitiesBelowCutoff, languagesBelowCutoff, false)); }
private List <QualityProfileResource> GetAll() { var allProfiles = _qualityProfileService.All(); var profiles = allProfiles.Select(QualityToResource).ToList(); return(profiles); }
public PagingSpec <Episode> EpisodesWhereCutoffUnmet(PagingSpec <Episode> pagingSpec) { var qualitiesBelowCutoff = new List <QualitiesBelowCutoff>(); var qualityProfiles = _qualityProfileService.All(); //Get all items less than the cutoff foreach (var qualityProfile in qualityProfiles) { var cutoffIndex = qualityProfile.Items.FindIndex(v => v.Quality == qualityProfile.Cutoff); var belowCutoff = qualityProfile.Items.Take(cutoffIndex).ToList(); if (belowCutoff.Any()) { qualitiesBelowCutoff.Add(new QualitiesBelowCutoff(qualityProfile.Id, belowCutoff.Select(i => i.Quality.Id))); } } return(_episodeRepository.EpisodesWhereCutoffUnmet(pagingSpec, qualitiesBelowCutoff, false)); }
private List <QualityProfileResource> GetAll() { return(_qualityProfileService.All().ToResource()); }
private List <QualityProfileResource> GetAll() { var profiles = _qualityProfileService.All().InjectTo <List <QualityProfileResource> >(); return(profiles); }