Rename instances of Profile to QualityProfile

Closes #9337
This commit is contained in:
Bogdan 2023-11-01 12:28:14 +02:00
parent da41cb8840
commit 60d2df043b
9 changed files with 36 additions and 36 deletions

View File

@ -27,21 +27,21 @@ namespace NzbDrone.Core.IndexerSearch
private readonly IMakeDownloadDecision _makeDownloadDecision; private readonly IMakeDownloadDecision _makeDownloadDecision;
private readonly IMovieService _movieService; private readonly IMovieService _movieService;
private readonly IMovieTranslationService _movieTranslationService; private readonly IMovieTranslationService _movieTranslationService;
private readonly IQualityProfileService _profileService; private readonly IQualityProfileService _qualityProfileService;
private readonly Logger _logger; private readonly Logger _logger;
public ReleaseSearchService(IIndexerFactory indexerFactory, public ReleaseSearchService(IIndexerFactory indexerFactory,
IMakeDownloadDecision makeDownloadDecision, IMakeDownloadDecision makeDownloadDecision,
IMovieService movieService, IMovieService movieService,
IMovieTranslationService movieTranslationService, IMovieTranslationService movieTranslationService,
IQualityProfileService profileService, IQualityProfileService qualityProfileService,
Logger logger) Logger logger)
{ {
_indexerFactory = indexerFactory; _indexerFactory = indexerFactory;
_makeDownloadDecision = makeDownloadDecision; _makeDownloadDecision = makeDownloadDecision;
_movieService = movieService; _movieService = movieService;
_movieTranslationService = movieTranslationService; _movieTranslationService = movieTranslationService;
_profileService = profileService; _qualityProfileService = qualityProfileService;
_logger = logger; _logger = logger;
} }
@ -75,7 +75,7 @@ namespace NzbDrone.Core.IndexerSearch
InteractiveSearch = interactiveSearch InteractiveSearch = interactiveSearch
}; };
var wantedLanguages = _profileService.GetAcceptableLanguages(movie.QualityProfileId); var wantedLanguages = _qualityProfileService.GetAcceptableLanguages(movie.QualityProfileId);
var translations = _movieTranslationService.GetAllTranslationsForMovieMetadata(movie.MovieMetadataId); var translations = _movieTranslationService.GetAllTranslationsForMovieMetadata(movie.MovieMetadataId);
var queryTranslations = new List<string> var queryTranslations = new List<string>

View File

@ -16,18 +16,18 @@ namespace NzbDrone.Core.Movies
public class MovieCutoffService : IMovieCutoffService public class MovieCutoffService : IMovieCutoffService
{ {
private readonly IMovieRepository _movieRepository; private readonly IMovieRepository _movieRepository;
private readonly IQualityProfileService _profileService; private readonly IQualityProfileService _qualityProfileService;
public MovieCutoffService(IMovieRepository movieRepository, IQualityProfileService profileService, Logger logger) public MovieCutoffService(IMovieRepository movieRepository, IQualityProfileService qualityProfileService, Logger logger)
{ {
_movieRepository = movieRepository; _movieRepository = movieRepository;
_profileService = profileService; _qualityProfileService = qualityProfileService;
} }
public PagingSpec<Movie> MoviesWhereCutoffUnmet(PagingSpec<Movie> pagingSpec) public PagingSpec<Movie> MoviesWhereCutoffUnmet(PagingSpec<Movie> pagingSpec)
{ {
var qualitiesBelowCutoff = new List<QualitiesBelowCutoff>(); var qualitiesBelowCutoff = new List<QualitiesBelowCutoff>();
var profiles = _profileService.All(); var profiles = _qualityProfileService.All();
// Get all items less than the cutoff // Get all items less than the cutoff
foreach (var profile in profiles) foreach (var profile in profiles)

View File

@ -3,16 +3,16 @@ using NzbDrone.Core.Profiles.Qualities;
namespace NzbDrone.Core.Validation namespace NzbDrone.Core.Validation
{ {
public class ProfileExistsValidator : PropertyValidator public class QualityProfileExistsValidator : PropertyValidator
{ {
private readonly IQualityProfileService _profileService; private readonly IQualityProfileService _qualityProfileService;
public ProfileExistsValidator(IQualityProfileService profileService) public QualityProfileExistsValidator(IQualityProfileService qualityProfileService)
{ {
_profileService = profileService; _qualityProfileService = qualityProfileService;
} }
protected override string GetDefaultMessageTemplate() => "QualityProfile does not exist"; protected override string GetDefaultMessageTemplate() => "Quality Profile does not exist";
protected override bool IsValid(PropertyValidatorContext context) protected override bool IsValid(PropertyValidatorContext context)
{ {
@ -21,7 +21,7 @@ namespace NzbDrone.Core.Validation
return true; return true;
} }
return _profileService.Exists((int)context.PropertyValue); return _qualityProfileService.Exists((int)context.PropertyValue);
} }
} }
} }

View File

@ -11,7 +11,7 @@ namespace NzbDrone.Integration.Test.ApiTests
{ {
private void GivenExistingMovie() private void GivenExistingMovie()
{ {
WaitForCompletion(() => Profiles.All().Count > 0); WaitForCompletion(() => QualityProfiles.All().Count > 0);
foreach (var title in new[] { "The Dark Knight", "Pulp Fiction" }) foreach (var title in new[] { "The Dark Knight", "Pulp Fiction" })
{ {

View File

@ -46,7 +46,7 @@ namespace NzbDrone.Integration.Test
public LogsClient Logs; public LogsClient Logs;
public ClientBase<NamingConfigResource> NamingConfig; public ClientBase<NamingConfigResource> NamingConfig;
public NotificationClient Notifications; public NotificationClient Notifications;
public ClientBase<QualityProfileResource> Profiles; public ClientBase<QualityProfileResource> QualityProfiles;
public ReleaseClient Releases; public ReleaseClient Releases;
public ClientBase<RootFolderResource> RootFolders; public ClientBase<RootFolderResource> RootFolders;
public MovieClient Movies; public MovieClient Movies;
@ -108,7 +108,7 @@ namespace NzbDrone.Integration.Test
Logs = new LogsClient(RestClient, ApiKey); Logs = new LogsClient(RestClient, ApiKey);
NamingConfig = new ClientBase<NamingConfigResource>(RestClient, ApiKey, "config/naming"); NamingConfig = new ClientBase<NamingConfigResource>(RestClient, ApiKey, "config/naming");
Notifications = new NotificationClient(RestClient, ApiKey); Notifications = new NotificationClient(RestClient, ApiKey);
Profiles = new ClientBase<QualityProfileResource>(RestClient, ApiKey); QualityProfiles = new ClientBase<QualityProfileResource>(RestClient, ApiKey);
Releases = new ReleaseClient(RestClient, ApiKey); Releases = new ReleaseClient(RestClient, ApiKey);
RootFolders = new ClientBase<RootFolderResource>(RestClient, ApiKey); RootFolders = new ClientBase<RootFolderResource>(RestClient, ApiKey);
Movies = new MovieClient(RestClient, ApiKey); Movies = new MovieClient(RestClient, ApiKey);
@ -303,10 +303,10 @@ namespace NzbDrone.Integration.Test
return result.MovieFile; return result.MovieFile;
} }
public QualityProfileResource EnsureProfileCutoff(int profileId, Quality cutoff, bool upgradeAllowed) public QualityProfileResource EnsureQualityProfileCutoff(int profileId, Quality cutoff, bool upgradeAllowed)
{ {
var needsUpdate = false; var needsUpdate = false;
var profile = Profiles.Get(profileId); var profile = QualityProfiles.Get(profileId);
if (profile.Cutoff != cutoff.Id) if (profile.Cutoff != cutoff.Id)
{ {
@ -322,7 +322,7 @@ namespace NzbDrone.Integration.Test
if (needsUpdate) if (needsUpdate)
{ {
profile = Profiles.Put(profile); profile = QualityProfiles.Put(profile);
} }
return profile; return profile;

View File

@ -12,13 +12,13 @@ namespace Radarr.Api.V3.ImportLists
public static readonly ImportListResourceMapper ResourceMapper = new (); public static readonly ImportListResourceMapper ResourceMapper = new ();
public static readonly ImportListBulkResourceMapper BulkResourceMapper = new (); public static readonly ImportListBulkResourceMapper BulkResourceMapper = new ();
public ImportListController(IImportListFactory importListFactory, ProfileExistsValidator profileExistsValidator) public ImportListController(IImportListFactory importListFactory, QualityProfileExistsValidator qualityProfileExistsValidator)
: base(importListFactory, "importlist", ResourceMapper, BulkResourceMapper) : base(importListFactory, "importlist", ResourceMapper, BulkResourceMapper)
{ {
SharedValidator.RuleFor(c => c.RootFolderPath).IsValidPath(); SharedValidator.RuleFor(c => c.RootFolderPath).IsValidPath();
SharedValidator.RuleFor(c => c.MinimumAvailability).NotNull(); SharedValidator.RuleFor(c => c.MinimumAvailability).NotNull();
SharedValidator.RuleFor(c => c.QualityProfileId).ValidId(); SharedValidator.RuleFor(c => c.QualityProfileId).ValidId();
SharedValidator.RuleFor(c => c.QualityProfileId).SetValidator(profileExistsValidator); SharedValidator.RuleFor(c => c.QualityProfileId).SetValidator(qualityProfileExistsValidator);
} }
} }
} }

View File

@ -66,7 +66,7 @@ namespace Radarr.Api.V3.Movies
MovieAncestorValidator moviesAncestorValidator, MovieAncestorValidator moviesAncestorValidator,
RecycleBinValidator recycleBinValidator, RecycleBinValidator recycleBinValidator,
SystemFolderValidator systemFolderValidator, SystemFolderValidator systemFolderValidator,
ProfileExistsValidator profileExistsValidator, QualityProfileExistsValidator qualityProfileExistsValidator,
MovieFolderAsRootFolderValidator movieFolderAsRootFolderValidator, MovieFolderAsRootFolderValidator movieFolderAsRootFolderValidator,
Logger logger) Logger logger)
: base(signalRBroadcaster) : base(signalRBroadcaster)
@ -94,7 +94,7 @@ namespace Radarr.Api.V3.Movies
.SetValidator(systemFolderValidator) .SetValidator(systemFolderValidator)
.When(s => !s.Path.IsNullOrWhiteSpace()); .When(s => !s.Path.IsNullOrWhiteSpace());
SharedValidator.RuleFor(s => s.QualityProfileId).SetValidator(profileExistsValidator); SharedValidator.RuleFor(s => s.QualityProfileId).SetValidator(qualityProfileExistsValidator);
PostValidator.RuleFor(s => s.Path).IsValidPath().When(s => s.RootFolderPath.IsNullOrWhiteSpace()); PostValidator.RuleFor(s => s.Path).IsValidPath().When(s => s.RootFolderPath.IsNullOrWhiteSpace());
PostValidator.RuleFor(s => s.RootFolderPath) PostValidator.RuleFor(s => s.RootFolderPath)

View File

@ -14,12 +14,12 @@ namespace Radarr.Api.V3.Profiles.Quality
[V3ApiController] [V3ApiController]
public class QualityProfileController : RestController<QualityProfileResource> public class QualityProfileController : RestController<QualityProfileResource>
{ {
private readonly IQualityProfileService _profileService; private readonly IQualityProfileService _qualityProfileService;
private readonly ICustomFormatService _formatService; private readonly ICustomFormatService _formatService;
public QualityProfileController(IQualityProfileService profileService, ICustomFormatService formatService) public QualityProfileController(IQualityProfileService qualityProfileService, ICustomFormatService formatService)
{ {
_profileService = profileService; _qualityProfileService = qualityProfileService;
_formatService = formatService; _formatService = formatService;
SharedValidator.RuleFor(c => c.Name).NotEmpty(); SharedValidator.RuleFor(c => c.Name).NotEmpty();
@ -50,14 +50,14 @@ namespace Radarr.Api.V3.Profiles.Quality
public ActionResult<QualityProfileResource> Create(QualityProfileResource resource) public ActionResult<QualityProfileResource> Create(QualityProfileResource resource)
{ {
var model = resource.ToModel(); var model = resource.ToModel();
model = _profileService.Add(model); model = _qualityProfileService.Add(model);
return Created(model.Id); return Created(model.Id);
} }
[RestDeleteById] [RestDeleteById]
public void DeleteProfile(int id) public void DeleteProfile(int id)
{ {
_profileService.Delete(id); _qualityProfileService.Delete(id);
} }
[RestPutById] [RestPutById]
@ -65,20 +65,20 @@ namespace Radarr.Api.V3.Profiles.Quality
{ {
var model = resource.ToModel(); var model = resource.ToModel();
_profileService.Update(model); _qualityProfileService.Update(model);
return Accepted(model.Id); return Accepted(model.Id);
} }
protected override QualityProfileResource GetResourceById(int id) protected override QualityProfileResource GetResourceById(int id)
{ {
return _profileService.Get(id).ToResource(); return _qualityProfileService.Get(id).ToResource();
} }
[HttpGet] [HttpGet]
public List<QualityProfileResource> GetAll() public List<QualityProfileResource> GetAll()
{ {
return _profileService.All().ToResource(); return _qualityProfileService.All().ToResource();
} }
} }
} }

View File

@ -7,17 +7,17 @@ namespace Radarr.Api.V3.Profiles.Quality
[V3ApiController("qualityprofile/schema")] [V3ApiController("qualityprofile/schema")]
public class QualityProfileSchemaController : Controller public class QualityProfileSchemaController : Controller
{ {
private readonly IQualityProfileService _profileService; private readonly IQualityProfileService _qualityProfileService;
public QualityProfileSchemaController(IQualityProfileService profileService) public QualityProfileSchemaController(IQualityProfileService qualityProfileService)
{ {
_profileService = profileService; _qualityProfileService = qualityProfileService;
} }
[HttpGet] [HttpGet]
public QualityProfileResource GetSchema() public QualityProfileResource GetSchema()
{ {
var qualityProfile = _profileService.GetDefaultProfile(string.Empty); var qualityProfile = _qualityProfileService.GetDefaultProfile(string.Empty);
return qualityProfile.ToResource(); return qualityProfile.ToResource();
} }