mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-25 22:37:27 -04:00
Added: Ability to add custom formats, working similar to qualities. (#2669)
Originally called project metis, this feature allows you to do a lot of cool stuff, such as upgrading to a x265 encode, downloading releases with multiple languages, etc. Check out the wiki page at: https://github.com/Radarr/Radarr/wiki/Custom-Formats to learn more! Note: This feature is currently in "beta" and will get more tags and features in the future. Please let me know, if you have any issues and I hope this will allow for a lot of customization!
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.CustomFormats;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Profiles;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
@@ -9,11 +10,13 @@ namespace NzbDrone.Api.Profiles
|
||||
public class ProfileSchemaModule : NzbDroneRestModule<ProfileResource>
|
||||
{
|
||||
private readonly IQualityDefinitionService _qualityDefinitionService;
|
||||
private readonly ICustomFormatService _formatService;
|
||||
|
||||
public ProfileSchemaModule(IQualityDefinitionService qualityDefinitionService)
|
||||
public ProfileSchemaModule(IQualityDefinitionService qualityDefinitionService, ICustomFormatService formatService)
|
||||
: base("/profile/schema")
|
||||
{
|
||||
_qualityDefinitionService = qualityDefinitionService;
|
||||
_formatService = formatService;
|
||||
|
||||
GetResourceAll = GetAll;
|
||||
}
|
||||
@@ -25,12 +28,25 @@ namespace NzbDrone.Api.Profiles
|
||||
.Select(v => new ProfileQualityItem { Quality = v.Quality, Allowed = false })
|
||||
.ToList();
|
||||
|
||||
var formatItems = _formatService.All().Select(v => new ProfileFormatItem
|
||||
{
|
||||
Format = v, Allowed = true
|
||||
}).ToList();
|
||||
|
||||
formatItems.Insert(0, new ProfileFormatItem
|
||||
{
|
||||
Format = CustomFormat.None,
|
||||
Allowed = true
|
||||
});
|
||||
|
||||
var profile = new Profile();
|
||||
profile.Cutoff = Quality.Unknown;
|
||||
profile.Items = items;
|
||||
profile.FormatCutoff = CustomFormat.None;
|
||||
profile.FormatItems = formatItems;
|
||||
profile.Language = Language.English;
|
||||
|
||||
return new List<ProfileResource> { profile.ToResource() };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user