mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
parent
e5c5a3f91c
commit
fde276f000
10 changed files with 50 additions and 18 deletions
|
@ -7,7 +7,7 @@ namespace Lidarr.Api.V1.ImportLists
|
|||
public bool EnableAutomaticAdd { get; set; }
|
||||
public bool ShouldMonitor { get; set; }
|
||||
public string RootFolderPath { get; set; }
|
||||
public int ProfileId { get; set; }
|
||||
public int QualityProfileId { get; set; }
|
||||
public int LanguageProfileId { get; set; }
|
||||
public int MetadataProfileId { get; set; }
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace Lidarr.Api.V1.ImportLists
|
|||
resource.EnableAutomaticAdd = definition.EnableAutomaticAdd;
|
||||
resource.ShouldMonitor = definition.ShouldMonitor;
|
||||
resource.RootFolderPath = definition.RootFolderPath;
|
||||
resource.ProfileId = definition.ProfileId;
|
||||
resource.QualityProfileId = definition.ProfileId;
|
||||
resource.LanguageProfileId = definition.LanguageProfileId;
|
||||
resource.MetadataProfileId = definition.MetadataProfileId;
|
||||
|
||||
|
@ -45,7 +45,7 @@ namespace Lidarr.Api.V1.ImportLists
|
|||
definition.EnableAutomaticAdd = resource.EnableAutomaticAdd;
|
||||
definition.ShouldMonitor = resource.ShouldMonitor;
|
||||
definition.RootFolderPath = resource.RootFolderPath;
|
||||
definition.ProfileId = resource.ProfileId;
|
||||
definition.ProfileId = resource.QualityProfileId;
|
||||
definition.LanguageProfileId = resource.LanguageProfileId;
|
||||
definition.MetadataProfileId = resource.MetadataProfileId;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.ImportLists;
|
||||
using NzbDrone.Core.Lifecycle;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Languages;
|
||||
|
@ -22,12 +23,14 @@ namespace NzbDrone.Core.Profiles.Languages
|
|||
{
|
||||
private readonly ILanguageProfileRepository _profileRepository;
|
||||
private readonly IArtistService _artistService;
|
||||
private readonly IImportListFactory _importListFactory;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public LanguageProfileService(ILanguageProfileRepository profileRepository, IArtistService artistService, Logger logger)
|
||||
public LanguageProfileService(ILanguageProfileRepository profileRepository, IArtistService artistService, IImportListFactory importListFactory, Logger logger)
|
||||
{
|
||||
_profileRepository = profileRepository;
|
||||
_artistService = artistService;
|
||||
_importListFactory = importListFactory;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
@ -43,7 +46,7 @@ namespace NzbDrone.Core.Profiles.Languages
|
|||
|
||||
public void Delete(int id)
|
||||
{
|
||||
if (_artistService.GetAllArtists().Any(c => c.LanguageProfileId == id))
|
||||
if (_artistService.GetAllArtists().Any(c => c.LanguageProfileId == id) || _importListFactory.All().Any(c => c.LanguageProfileId == id))
|
||||
{
|
||||
var profile = _profileRepository.Get(id);
|
||||
throw new LanguageProfileInUseException(profile.Name);
|
||||
|
|
|
@ -4,6 +4,7 @@ using NzbDrone.Core.Messaging.Events;
|
|||
using NzbDrone.Core.Music;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.ImportLists;
|
||||
|
||||
namespace NzbDrone.Core.Profiles.Metadata
|
||||
{
|
||||
|
@ -21,12 +22,17 @@ namespace NzbDrone.Core.Profiles.Metadata
|
|||
{
|
||||
private readonly IMetadataProfileRepository _profileRepository;
|
||||
private readonly IArtistService _artistService;
|
||||
private readonly IImportListFactory _importListFactory;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public MetadataProfileService(IMetadataProfileRepository profileRepository, IArtistService artistService, Logger logger)
|
||||
public MetadataProfileService(IMetadataProfileRepository profileRepository,
|
||||
IArtistService artistService,
|
||||
IImportListFactory importListFactory,
|
||||
Logger logger)
|
||||
{
|
||||
_profileRepository = profileRepository;
|
||||
_artistService = artistService;
|
||||
_importListFactory = importListFactory;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
@ -42,7 +48,7 @@ namespace NzbDrone.Core.Profiles.Metadata
|
|||
|
||||
public void Delete(int id)
|
||||
{
|
||||
if (_artistService.GetAllArtists().Any(c => c.MetadataProfileId == id))
|
||||
if (_artistService.GetAllArtists().Any(c => c.MetadataProfileId == id) || _importListFactory.All().Any(c => c.MetadataProfileId == id))
|
||||
{
|
||||
var profile = _profileRepository.Get(id);
|
||||
throw new MetadataProfileInUseException(profile.Name);
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Linq;
|
|||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Http.Dispatchers;
|
||||
using NzbDrone.Core.ImportLists;
|
||||
using NzbDrone.Core.Lifecycle;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
@ -26,12 +27,14 @@ namespace NzbDrone.Core.Profiles.Qualities
|
|||
{
|
||||
private readonly IProfileRepository _profileRepository;
|
||||
private readonly IArtistService _artistService;
|
||||
private readonly IImportListFactory _importListFactory;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public ProfileService(IProfileRepository profileRepository, IArtistService artistService, Logger logger)
|
||||
public ProfileService(IProfileRepository profileRepository, IArtistService artistService, IImportListFactory importListFactory, Logger logger)
|
||||
{
|
||||
_profileRepository = profileRepository;
|
||||
_artistService = artistService;
|
||||
_importListFactory = importListFactory;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
@ -47,7 +50,7 @@ namespace NzbDrone.Core.Profiles.Qualities
|
|||
|
||||
public void Delete(int id)
|
||||
{
|
||||
if (_artistService.GetAllArtists().Any(c => c.ProfileId == id))
|
||||
if (_artistService.GetAllArtists().Any(c => c.ProfileId == id) || _importListFactory.All().Any(c => c.ProfileId == id))
|
||||
{
|
||||
var profile = _profileRepository.Get(id);
|
||||
throw new ProfileInUseException(profile.Name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue