mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-18 21:55:12 -04:00
77f146b262
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!
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using NzbDrone.Api.REST;
|
|
using NzbDrone.Core.CustomFormats;
|
|
|
|
namespace NzbDrone.Api.Qualities
|
|
{
|
|
public class CustomFormatResource : RestResource
|
|
{
|
|
public string Name { get; set; }
|
|
public List<string> FormatTags { get; set; }
|
|
public string Simplicity { get; set; }
|
|
}
|
|
|
|
public static class CustomFormatResourceMapper
|
|
{
|
|
public static CustomFormatResource ToResource(this CustomFormat model)
|
|
{
|
|
return new CustomFormatResource
|
|
{
|
|
Id = model.Id,
|
|
Name = model.Name,
|
|
FormatTags = model.FormatTags.Select(t => t.Raw.ToUpper()).ToList(),
|
|
};
|
|
}
|
|
|
|
public static CustomFormat ToModel(this CustomFormatResource resource)
|
|
{
|
|
return new CustomFormat
|
|
{
|
|
Id = resource.Id,
|
|
Name = resource.Name,
|
|
FormatTags = resource.FormatTags.Select(s => new FormatTag(s)).ToList(),
|
|
};
|
|
}
|
|
|
|
public static List<CustomFormatResource> ToResource(this IEnumerable<CustomFormat> models)
|
|
{
|
|
return models.Select(m => m.ToResource()).ToList();
|
|
}
|
|
}
|
|
}
|