mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-24 22:35:39 -04:00
Added: Add Release Status to Metadata Profile, Default to Official Only (#250)
* Added: Add Release Status to Metadata Profile, Default to Official Only * Fixed: Unit Test and Comparison
This commit is contained in:
@@ -9,6 +9,7 @@ namespace NzbDrone.Core.Profiles.Metadata
|
||||
public string Name { get; set; }
|
||||
public List<ProfilePrimaryAlbumTypeItem> PrimaryAlbumTypes { get; set; }
|
||||
public List<ProfileSecondaryAlbumTypeItem> SecondaryAlbumTypes { get; set; }
|
||||
public List<ProfileReleaseStatusItem> ReleaseStatuses { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,23 +66,29 @@ namespace NzbDrone.Core.Profiles.Metadata
|
||||
return _profileRepository.Exists(id);
|
||||
}
|
||||
|
||||
private void AddDefaultProfile(string name, List<PrimaryAlbumType> primAllowed, List<SecondaryAlbumType> secAllowed)
|
||||
private void AddDefaultProfile(string name, List<PrimaryAlbumType> primAllowed, List<SecondaryAlbumType> secAllowed, List<ReleaseStatus> relAllowed)
|
||||
{
|
||||
var primaryTypes = PrimaryAlbumType.All
|
||||
.OrderByDescending(l => l.Name)
|
||||
.Select(v => new ProfilePrimaryAlbumTypeItem { PrimaryAlbumType = v, Allowed = primAllowed.Contains(v) })
|
||||
.ToList();
|
||||
.OrderByDescending(l => l.Name)
|
||||
.Select(v => new ProfilePrimaryAlbumTypeItem {PrimaryAlbumType = v, Allowed = primAllowed.Contains(v)})
|
||||
.ToList();
|
||||
|
||||
var secondaryTypes = SecondaryAlbumType.All
|
||||
.OrderByDescending(l => l.Name)
|
||||
.Select(v => new ProfileSecondaryAlbumTypeItem { SecondaryAlbumType = v, Allowed = secAllowed.Contains(v) })
|
||||
.ToList();
|
||||
.OrderByDescending(l => l.Name)
|
||||
.Select(v => new ProfileSecondaryAlbumTypeItem {SecondaryAlbumType = v, Allowed = secAllowed.Contains(v)})
|
||||
.ToList();
|
||||
|
||||
var releaseStatues = ReleaseStatus.All
|
||||
.OrderByDescending(l => l.Name)
|
||||
.Select(v => new ProfileReleaseStatusItem {ReleaseStatus = v, Allowed = relAllowed.Contains(v)})
|
||||
.ToList();
|
||||
|
||||
var profile = new MetadataProfile
|
||||
{
|
||||
Name = name,
|
||||
PrimaryAlbumTypes = primaryTypes,
|
||||
SecondaryAlbumTypes = secondaryTypes
|
||||
SecondaryAlbumTypes = secondaryTypes,
|
||||
ReleaseStatuses = releaseStatues
|
||||
};
|
||||
|
||||
Add(profile);
|
||||
@@ -97,7 +103,7 @@ namespace NzbDrone.Core.Profiles.Metadata
|
||||
|
||||
_logger.Info("Setting up default metadata profile");
|
||||
|
||||
AddDefaultProfile("Standard", new List<PrimaryAlbumType>{PrimaryAlbumType.Album}, new List<SecondaryAlbumType>{ SecondaryAlbumType.Studio });
|
||||
AddDefaultProfile("Standard", new List<PrimaryAlbumType>{PrimaryAlbumType.Album}, new List<SecondaryAlbumType>{ SecondaryAlbumType.Studio }, new List<ReleaseStatus>{ReleaseStatus.Official});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Music;
|
||||
|
||||
namespace NzbDrone.Core.Profiles.Metadata
|
||||
{
|
||||
public class ProfileReleaseStatusItem : IEmbeddedDocument
|
||||
{
|
||||
public ReleaseStatus ReleaseStatus { get; set; }
|
||||
public bool Allowed { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user