mirror of https://github.com/Jackett/Jackett
137 lines
3.1 KiB
Plaintext
137 lines
3.1 KiB
Plaintext
<#@ template debug="false" hostspecific="false" language="C#" #>
|
|
<#@ assembly name="System.Core" #>
|
|
<#@ import namespace="System.Linq" #>
|
|
<#@ import namespace="System.Collections.Generic" #>
|
|
<#@ output extension=".generated.cs" #>
|
|
<# string data = @"
|
|
|
|
1000: Console
|
|
1010: Console/NDS
|
|
1020: Console/PSP
|
|
1030: Console/Wii
|
|
1040: Console/Xbox
|
|
1050: Console/Xbox 360
|
|
1060: Console/Wiiware/VC
|
|
1070: Console/XBOX 360 DLC
|
|
1080: Console/PS3
|
|
1090: Console/Other
|
|
1110: Console/3DS
|
|
1120: Console/PS Vita
|
|
1130: Console/WiiU
|
|
1140: Console/Xbox One
|
|
1180: Console/PS4
|
|
2000: Movies
|
|
2010: Movies/Foreign
|
|
2020: Movies/Other
|
|
2030: Movies/SD
|
|
2040: Movies/HD
|
|
2045: Movies/UHD
|
|
2050: Movies/3D
|
|
2060: Movies/BluRay
|
|
2070: Movies/DVD
|
|
2080: Movies/WEBDL
|
|
3000: Audio
|
|
3010: Audio/MP3
|
|
3020: Audio/Video
|
|
3030: Audio/Audiobook
|
|
3040: Audio/Lossless
|
|
3050: Audio/Other
|
|
3060: Audio/Foreign
|
|
4000: PC
|
|
4010: PC/0day
|
|
4020: PC/ISO
|
|
4030: PC/Mac
|
|
4040: PC/Phone-Other
|
|
4050: PC/Games
|
|
4060: PC/Phone-IOS
|
|
4070: PC/Phone-Android
|
|
5000: TV
|
|
5010: TV/WEB-DL
|
|
5020: TV/FOREIGN
|
|
5030: TV/SD
|
|
5040: TV/HD
|
|
5045: TV/UHD
|
|
5050: TV/OTHER
|
|
5060: TV/Sport
|
|
5070: TV/Anime
|
|
5080: TV/Documentary
|
|
6000: XXX
|
|
6010: XXX/DVD
|
|
6020: XXX/WMV
|
|
6030: XXX/XviD
|
|
6040: XXX/x264
|
|
6050: XXX/Other
|
|
6060: XXX/Imageset
|
|
6070: XXX/Packs
|
|
7000: Other
|
|
7010: Other/Misc
|
|
7020: Other/Hashed
|
|
8000: Books
|
|
8010: Books/Ebook
|
|
8020: Books/Comics
|
|
8030: Books/Magazines
|
|
8040: Books/Technical
|
|
8050: Books/Other
|
|
8060: Books/Foreign
|
|
|
|
"; #>
|
|
using System.Collections.Generic;
|
|
|
|
namespace Jackett.Common.Models
|
|
{
|
|
|
|
public static partial class TorznabCatType
|
|
{
|
|
<#
|
|
var items = data.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
|
|
var cats = new List<CatStub>();
|
|
foreach (var item in items)
|
|
{
|
|
var parts = item.Split(new string[] { ": " }, StringSplitOptions.RemoveEmptyEntries);
|
|
var num = int.Parse(parts[0]);
|
|
var memberName = parts[1].Replace("/", "").Replace(" ", "").Replace("-", "");
|
|
cats.Add(new CatStub { Number = num, MemberName = memberName, Name = parts[1] });
|
|
}
|
|
|
|
foreach(var cat in cats)
|
|
{ #>
|
|
|
|
public static readonly TorznabCategory <#= cat.MemberName #> = new TorznabCategory(<#= cat.Number #>, "<#= cat.Name #>");
|
|
<#
|
|
} #>
|
|
|
|
public static readonly TorznabCategory[] AllCats = new TorznabCategory[] { <#= string.Join(", ", cats.Select(c => c.MemberName)) #> };
|
|
|
|
static TorznabCatType()
|
|
{
|
|
<#
|
|
foreach (var cat in cats)
|
|
{
|
|
if (cat.Name.Contains("/"))
|
|
{
|
|
var parentName = cat.Name.Split('/')[0];
|
|
var parentCat = cats.FirstOrDefault<CatStub>(c => c.Name == parentName);
|
|
parentCat.Children.Add(cat);
|
|
}
|
|
}
|
|
|
|
foreach (var parentCat in cats.Where<CatStub>(c => c.Children.Count > 0))
|
|
{ #>
|
|
<#= parentCat.MemberName #>.SubCategories.AddRange(new List<TorznabCategory> { <#= string.Join(", ", parentCat.Children.Select(t => t.MemberName)) #> });
|
|
<# }
|
|
|
|
#>
|
|
}
|
|
}
|
|
}
|
|
|
|
<#+
|
|
class CatStub
|
|
{
|
|
public int Number;
|
|
public string Name;
|
|
public string MemberName;
|
|
public List<CatStub> Children = new List<CatStub>();
|
|
}
|
|
#>
|