mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Fixed issues that came up after making changes to Episode and EpisodeFile.
This commit is contained in:
parent
738700537e
commit
891acfff44
5 changed files with 38 additions and 37 deletions
|
@ -94,37 +94,34 @@ namespace NzbDrone.Core.Providers
|
|||
|
||||
episode.EpisodeId = dbEpisode.EpisodeId;
|
||||
|
||||
var epWithFiles = _sonicRepo.All<EpisodeFile>().Where(c => c.EpisodeId == episode.EpisodeId);
|
||||
var file = _sonicRepo.Single<EpisodeFile>(c => c.FileId == dbEpisode.FileId);
|
||||
|
||||
if (epWithFiles != null)
|
||||
if (file != null)
|
||||
{
|
||||
//If not null we need to see if this episode has the quality as the download (or if it is better)
|
||||
foreach (var file in epWithFiles)
|
||||
if (file.Quality == episode.Quality)
|
||||
{
|
||||
if (file.Quality == episode.Quality)
|
||||
//If the episodeFile is a Proper we don't need to download again
|
||||
if (file.Proper)
|
||||
return false;
|
||||
}
|
||||
|
||||
//There will never be a time when the episode quality is less than what we have and we want it... ever.... I think.
|
||||
if (file.Quality > episode.Quality)
|
||||
return false;
|
||||
|
||||
//Now we need to handle upgrades and actually pay attention to the Cutoff Value
|
||||
if (file.Quality < episode.Quality)
|
||||
{
|
||||
var series = _series.GetSeries(episode.SeriesId);
|
||||
var quality = _quality.Find(series.QualityProfileId);
|
||||
|
||||
if (quality.Cutoff <= file.Quality)
|
||||
{
|
||||
//If the episodeFile is a Proper we don't need to download again
|
||||
if (file.Proper)
|
||||
return false;
|
||||
}
|
||||
|
||||
//There will never be a time when the episode quality is less than what we have and we want it... ever.... I think.
|
||||
if (file.Quality > episode.Quality)
|
||||
return false;
|
||||
|
||||
//Now we need to handle upgrades and actually pay attention to the Cutoff Value
|
||||
if (file.Quality < episode.Quality)
|
||||
{
|
||||
var series = _series.GetSeries(episode.SeriesId);
|
||||
var quality = _quality.Find(series.QualityProfileId);
|
||||
|
||||
if (quality.Cutoff <= file.Quality)
|
||||
{
|
||||
//If the episodeFile is a Proper we don't need to download again
|
||||
if (file.Proper)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue