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:
Qstick
2018-03-21 20:43:10 -04:00
committed by GitHub
parent 9d7c6bc961
commit df4e1e9b26
18 changed files with 632 additions and 19 deletions
@@ -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});
}
}
}