mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-27 22:57:09 -04:00
Profiles
Indexes are created with the same uniqueness when copying a table New: Non-English episode support New: Renamed Quality Profiles to Profiles and made them more powerful New: Configurable wait time before grabbing a release to wait for a better quality
This commit is contained in:
@@ -1,28 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NLog;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Common.EnsureThat;
|
||||
using NzbDrone.Core.Profiles;
|
||||
|
||||
namespace NzbDrone.Core.Qualities
|
||||
{
|
||||
public class QualityModelComparer : IComparer<Quality>, IComparer<QualityModel>
|
||||
{
|
||||
private readonly QualityProfile _qualityProfile;
|
||||
private readonly Profile _profile;
|
||||
|
||||
public QualityModelComparer(QualityProfile qualityProfile)
|
||||
public QualityModelComparer(Profile profile)
|
||||
{
|
||||
Ensure.That(qualityProfile, () => qualityProfile).IsNotNull();
|
||||
Ensure.That(qualityProfile.Items, () => qualityProfile.Items).HasItems();
|
||||
Ensure.That(profile, () => profile).IsNotNull();
|
||||
Ensure.That(profile.Items, () => profile.Items).HasItems();
|
||||
|
||||
_qualityProfile = qualityProfile;
|
||||
_profile = profile;
|
||||
}
|
||||
|
||||
public int Compare(Quality left, Quality right)
|
||||
{
|
||||
int leftIndex = _qualityProfile.Items.FindIndex(v => v.Quality == left);
|
||||
int rightIndex = _qualityProfile.Items.FindIndex(v => v.Quality == right);
|
||||
int leftIndex = _profile.Items.FindIndex(v => v.Quality == left);
|
||||
int rightIndex = _profile.Items.FindIndex(v => v.Quality == right);
|
||||
|
||||
return leftIndex.CompareTo(rightIndex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user