mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-12 11:15:43 +02: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:
parent
9a7eb8d552
commit
da79ad147e
@ -21,14 +21,16 @@ public class SeriesProvider : ISeriesProvider
|
||||
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 @@ public bool IsMonitored(long id)
|
||||
|
||||
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 @@ public void AddSeries(string path, TvdbSeries series)
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -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 @@ public class Series
|
||||
|
||||
public bool Monitored { get; set; }
|
||||
|
||||
public int Quality { get; set; }
|
||||
public QualityProfile QualityProfile { get; set; }
|
||||
|
||||
[SubSonicToManyRelation]
|
||||
public virtual List<Season> Seasons { get; private set; }
|
||||
|
Loading…
Reference in New Issue
Block a user