diff --git a/src/Radarr.Api.V3/Indexers/ReleaseModule.cs b/src/Radarr.Api.V3/Indexers/ReleaseModule.cs index 7b2610706..65be669ed 100644 --- a/src/Radarr.Api.V3/Indexers/ReleaseModule.cs +++ b/src/Radarr.Api.V3/Indexers/ReleaseModule.cs @@ -11,6 +11,7 @@ using NzbDrone.Core.IndexerSearch; using NzbDrone.Core.Movies; using NzbDrone.Core.Parser.Model; +using NzbDrone.Core.Profiles; using NzbDrone.Core.Validation; using HttpStatusCode = System.Net.HttpStatusCode; @@ -35,7 +36,9 @@ public ReleaseModule(IFetchAndParseRss rssFetcherAndParser, IDownloadService downloadService, IMovieService movieService, ICacheManager cacheManager, + IProfileService qualityProfileService, Logger logger) + : base(qualityProfileService) { _rssFetcherAndParser = rssFetcherAndParser; _nzbSearchService = nzbSearchService; diff --git a/src/Radarr.Api.V3/Indexers/ReleaseModuleBase.cs b/src/Radarr.Api.V3/Indexers/ReleaseModuleBase.cs index 65ecadc5c..224d15f22 100644 --- a/src/Radarr.Api.V3/Indexers/ReleaseModuleBase.cs +++ b/src/Radarr.Api.V3/Indexers/ReleaseModuleBase.cs @@ -1,11 +1,19 @@ using System.Collections.Generic; using NzbDrone.Core.DecisionEngine; +using NzbDrone.Core.Profiles; using Radarr.Http; namespace Radarr.Api.V3.Indexers { public abstract class ReleaseModuleBase : RadarrRestModule { + private readonly Profile _qualityProfie; + + public ReleaseModuleBase(IProfileService qualityProfileService) + { + _qualityProfie = qualityProfileService.GetDefaultProfile(string.Empty); + } + protected virtual List MapDecisions(IEnumerable decisions) { var result = new List(); @@ -26,11 +34,7 @@ protected virtual ReleaseResource MapDecision(DownloadDecision decision, int ini release.ReleaseWeight = initialWeight; - if (decision.RemoteMovie.Movie != null) - { - release.QualityWeight = decision.RemoteMovie.Movie - .Profile.GetIndex(release.Quality.Quality).Index * 100; - } + release.QualityWeight = _qualityProfie.GetIndex(release.Quality.Quality).Index * 100; release.QualityWeight += release.Quality.Revision.Real * 10; release.QualityWeight += release.Quality.Revision.Version; diff --git a/src/Radarr.Api.V3/Indexers/ReleasePushModule.cs b/src/Radarr.Api.V3/Indexers/ReleasePushModule.cs index 63148d1c3..aef10580c 100644 --- a/src/Radarr.Api.V3/Indexers/ReleasePushModule.cs +++ b/src/Radarr.Api.V3/Indexers/ReleasePushModule.cs @@ -9,6 +9,7 @@ using NzbDrone.Core.Download; using NzbDrone.Core.Indexers; using NzbDrone.Core.Parser.Model; +using NzbDrone.Core.Profiles; namespace Radarr.Api.V3.Indexers { @@ -22,7 +23,9 @@ public class ReleasePushModule : ReleaseModuleBase public ReleasePushModule(IMakeDownloadDecision downloadDecisionMaker, IProcessDownloadDecisions downloadDecisionProcessor, IIndexerFactory indexerFactory, + IProfileService qualityProfileService, Logger logger) + : base(qualityProfileService) { _downloadDecisionMaker = downloadDecisionMaker; _downloadDecisionProcessor = downloadDecisionProcessor;