mirror of https://github.com/lidarr/Lidarr
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:
parent
9a7eb8d552
commit
da79ad147e
|
@ -21,14 +21,16 @@ namespace NzbDrone.Core.Providers
|
||||||
private readonly IDiskProvider _diskProvider;
|
private readonly IDiskProvider _diskProvider;
|
||||||
private readonly IRepository _sonioRepo;
|
private readonly IRepository _sonioRepo;
|
||||||
private readonly ITvDbProvider _tvDb;
|
private readonly ITvDbProvider _tvDb;
|
||||||
|
private readonly IQualityProvider _quality;
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
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;
|
_diskProvider = diskProvider;
|
||||||
_config = configProvider;
|
_config = configProvider;
|
||||||
_sonioRepo = dataRepository;
|
_sonioRepo = dataRepository;
|
||||||
_tvDb = tvDbProvider;
|
_tvDb = tvDbProvider;
|
||||||
|
_quality = quality;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region ISeriesProvider Members
|
#region ISeriesProvider Members
|
||||||
|
@ -55,7 +57,10 @@ namespace NzbDrone.Core.Providers
|
||||||
|
|
||||||
public bool QualityWanted(int seriesId, QualityTypes quality)
|
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()
|
public Dictionary<Guid, String> GetUnmappedFolders()
|
||||||
|
@ -102,6 +107,8 @@ namespace NzbDrone.Core.Providers
|
||||||
repoSeries.Language = series.Language != null ? series.Language.Abbriviation : string.Empty;
|
repoSeries.Language = series.Language != null ? series.Language.Abbriviation : string.Empty;
|
||||||
repoSeries.Path = path;
|
repoSeries.Path = path;
|
||||||
repoSeries.CleanTitle = Parser.NormalizeTitle(series.SeriesName);
|
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);
|
_sonioRepo.Add(repoSeries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using NzbDrone.Core.Repository.Quality;
|
||||||
using SubSonic.SqlGeneration.Schema;
|
using SubSonic.SqlGeneration.Schema;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Repository
|
namespace NzbDrone.Core.Repository
|
||||||
|
@ -29,7 +30,7 @@ namespace NzbDrone.Core.Repository
|
||||||
|
|
||||||
public bool Monitored { get; set; }
|
public bool Monitored { get; set; }
|
||||||
|
|
||||||
public int Quality { get; set; }
|
public QualityProfile QualityProfile { get; set; }
|
||||||
|
|
||||||
[SubSonicToManyRelation]
|
[SubSonicToManyRelation]
|
||||||
public virtual List<Season> Seasons { get; private set; }
|
public virtual List<Season> Seasons { get; private set; }
|
||||||
|
|
Loading…
Reference in New Issue