mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
cleaned up handling of Unknown quality type.
This commit is contained in:
parent
3c53e6009d
commit
c1bbd0bd5d
@ -28,14 +28,14 @@ public static class ValueInjectorExtensions
|
||||
|
||||
foreach (var sourceItem in (IEnumerable)source)
|
||||
{
|
||||
var e = Activator.CreateInstance(listSubType).InjectFrom(sourceItem);
|
||||
var e = Activator.CreateInstance(listSubType).InjectFrom<CloneInjection>(sourceItem);
|
||||
addMethod.Invoke(result, new[] { e });
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return (TTarget)new TTarget().InjectFrom(source);
|
||||
return (TTarget)new TTarget().InjectFrom<CloneInjection>(source);
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,6 @@ namespace NzbDrone.Api.Qualities
|
||||
{
|
||||
public class QualityProfileResource : RestResource
|
||||
{
|
||||
public Int32 Id { get; set; }
|
||||
public String Name { get; set; }
|
||||
public QualityResource Cutoff { get; set; }
|
||||
public List<QualityResource> Qualities { get; set; }
|
||||
@ -15,7 +14,6 @@ public class QualityProfileResource : RestResource
|
||||
|
||||
public class QualityResource : RestResource
|
||||
{
|
||||
public Int32 Id { get; set; }
|
||||
public Int32 Weight { get; set; }
|
||||
public String Name { get; set; }
|
||||
}
|
||||
|
@ -8,16 +8,16 @@
|
||||
namespace NzbDrone.Core.Test.Qualities
|
||||
{
|
||||
[TestFixture]
|
||||
|
||||
|
||||
public class QualitySizeServiceFixture : CoreTest<QualitySizeService>
|
||||
{
|
||||
[Test]
|
||||
public void Init_should_add_all_sizes()
|
||||
{
|
||||
Subject.Handle(new ApplicationStartedEvent());
|
||||
|
||||
|
||||
Mocker.GetMock<IQualitySizeRepository>()
|
||||
.Verify(v => v.Insert(It.IsAny<QualitySize>()), Times.Exactly(Quality.All().Count - 1));
|
||||
.Verify(v => v.Insert(It.IsAny<QualitySize>()), Times.Exactly(Quality.All().Count));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -33,7 +33,7 @@ public void Init_should_insert_any_missing_sizes()
|
||||
Subject.Handle(new ApplicationStartedEvent());
|
||||
|
||||
Mocker.GetMock<IQualitySizeRepository>()
|
||||
.Verify(v => v.Insert(It.IsAny<QualitySize>()), Times.Exactly(Quality.All().Count - 2));
|
||||
.Verify(v => v.Insert(It.IsAny<QualitySize>()), Times.Exactly(Quality.All().Count - 1));
|
||||
}
|
||||
}
|
||||
}
|
@ -152,7 +152,6 @@ public static List<Quality> All()
|
||||
{
|
||||
return new List<Quality>
|
||||
{
|
||||
Unknown,
|
||||
SDTV,
|
||||
WEBDL480p,
|
||||
DVD,
|
||||
@ -168,6 +167,8 @@ public static List<Quality> All()
|
||||
|
||||
public static Quality FindById(int id)
|
||||
{
|
||||
if (id == 0) return Unknown;
|
||||
|
||||
var quality = All().SingleOrDefault(q => q.Id == id);
|
||||
|
||||
if (quality == null)
|
||||
|
@ -45,18 +45,13 @@ public virtual QualitySize Get(int qualityId)
|
||||
return _qualitySizeRepository.GetByQualityId(qualityId);
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Handle(ApplicationStartedEvent message)
|
||||
{
|
||||
var existing = All();
|
||||
|
||||
_logger.Debug("Setting up default quality sizes");
|
||||
|
||||
foreach (var quality in Quality.All().Where(q => q.Id > 0))
|
||||
foreach (var quality in Quality.All())
|
||||
{
|
||||
if (!existing.Any(s => s.QualityId == quality.Id))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user