1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-30 07:22:35 +01:00

New series will be added monitored and quality will be set to default quality.

Series now stores a QualityProfile instead of QualityType
This commit is contained in:
markus101 2011-02-14 19:48:39 -08:00
parent 9a7eb8d552
commit da79ad147e
2 changed files with 11 additions and 3 deletions

View File

@ -21,14 +21,16 @@ namespace NzbDrone.Core.Providers
private readonly IDiskProvider _diskProvider;
private readonly IRepository _sonioRepo;
private readonly ITvDbProvider _tvDb;
private readonly IQualityProvider _quality;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public SeriesProvider(IDiskProvider diskProvider, IConfigProvider configProvider, IRepository dataRepository, ITvDbProvider tvDbProvider)
public SeriesProvider(IDiskProvider diskProvider, IConfigProvider configProvider, IRepository dataRepository, ITvDbProvider tvDbProvider, IQualityProvider quality)
{
_diskProvider = diskProvider;
_config = configProvider;
_sonioRepo = dataRepository;
_tvDb = tvDbProvider;
_quality = quality;
}
#region ISeriesProvider Members
@ -55,7 +57,10 @@ namespace NzbDrone.Core.Providers
public bool QualityWanted(int seriesId, QualityTypes quality)
{
return _sonioRepo.Exists<Series>(s => s.SeriesId == seriesId && (QualityTypes)s.Quality == quality);
var series = _sonioRepo.Single<Series>(seriesId);
var profile = _quality.Find(series.QualityProfile.ProfileId);
return profile.Allowed.Contains(quality);
}
public Dictionary<Guid, String> GetUnmappedFolders()
@ -102,6 +107,8 @@ namespace NzbDrone.Core.Providers
repoSeries.Language = series.Language != null ? series.Language.Abbriviation : string.Empty;
repoSeries.Path = path;
repoSeries.CleanTitle = Parser.NormalizeTitle(series.SeriesName);
repoSeries.Monitored = true; //New shows should be monitored
repoSeries.QualityProfile = (QualityProfile) Enum.Parse(typeof (QualityProfile), _config.GetValue("Quality", 1, true));
_sonioRepo.Add(repoSeries);
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using NzbDrone.Core.Repository.Quality;
using SubSonic.SqlGeneration.Schema;
namespace NzbDrone.Core.Repository
@ -29,7 +30,7 @@ namespace NzbDrone.Core.Repository
public bool Monitored { get; set; }
public int Quality { get; set; }
public QualityProfile QualityProfile { get; set; }
[SubSonicToManyRelation]
public virtual List<Season> Seasons { get; private set; }