diff --git a/src/Jackett/Indexers/AlphaRatio.cs b/src/Jackett/Indexers/AlphaRatio.cs index be0b17b4b..44f5d3cea 100644 --- a/src/Jackett/Indexers/AlphaRatio.cs +++ b/src/Jackett/Indexers/AlphaRatio.cs @@ -49,9 +49,9 @@ namespace Jackett.Indexers AddCategoryMapping(15, TorznabCatType.ConsoleWii); AddCategoryMapping(16, TorznabCatType.PC); AddCategoryMapping(17, TorznabCatType.PCMac); - AddCategoryMapping(19, TorznabCatType.PCMobileOther); - AddCategoryMapping(21, TorznabCatType.EBooks); - AddCategoryMapping(22, TorznabCatType.AudioBooks); + AddCategoryMapping(19, TorznabCatType.PCPhoneOther); + AddCategoryMapping(21, TorznabCatType.BooksEbook); + AddCategoryMapping(22, TorznabCatType.AudioAudiobook); AddCategoryMapping(23, TorznabCatType.Audio); } diff --git a/src/Jackett/Indexers/AnimeBytes.cs b/src/Jackett/Indexers/AnimeBytes.cs index b9908c9a7..d88d41438 100644 --- a/src/Jackett/Indexers/AnimeBytes.cs +++ b/src/Jackett/Indexers/AnimeBytes.cs @@ -39,7 +39,7 @@ namespace Jackett.Indexers description: "Powered by Tentacles", manager: i, client: client, - caps: new TorznabCapabilities(TorznabCatType.Anime), + caps: new TorznabCapabilities(TorznabCatType.TVAnime), logger: l, p: ps, configData: new ConfigurationDataAnimeBytes()) diff --git a/src/Jackett/Indexers/BB.cs b/src/Jackett/Indexers/BB.cs index 688f70638..6c6e673a5 100644 --- a/src/Jackett/Indexers/BB.cs +++ b/src/Jackett/Indexers/BB.cs @@ -46,10 +46,10 @@ namespace Jackett.Indexers { AddCategoryMapping(1, TorznabCatType.Audio); AddCategoryMapping(2, TorznabCatType.PC); - AddCategoryMapping(3, TorznabCatType.EBooks); - AddCategoryMapping(4, TorznabCatType.AudioBooks); - AddCategoryMapping(6, TorznabCatType.Comic); - AddCategoryMapping(8, TorznabCatType.Anime); + AddCategoryMapping(3, TorznabCatType.BooksEbook); + AddCategoryMapping(4, TorznabCatType.AudioAudiobook); + AddCategoryMapping(6, TorznabCatType.BooksComics); + AddCategoryMapping(8, TorznabCatType.TVAnime); AddCategoryMapping(9, TorznabCatType.Movies); AddCategoryMapping(10, TorznabCatType.TVHD); AddCategoryMapping(10, TorznabCatType.TVSD); diff --git a/src/Jackett/Indexers/BakaBT.cs b/src/Jackett/Indexers/BakaBT.cs index 484650666..aa42a3bc4 100644 --- a/src/Jackett/Indexers/BakaBT.cs +++ b/src/Jackett/Indexers/BakaBT.cs @@ -32,7 +32,7 @@ namespace Jackett.Indexers : base(name: "BakaBT", description: "Anime Community", link: "http://bakabt.me/", - caps: new TorznabCapabilities(TorznabCatType.Anime), + caps: new TorznabCapabilities(TorznabCatType.TVAnime), manager: i, client: wc, logger: l, diff --git a/src/Jackett/Indexers/BeyondHD.cs b/src/Jackett/Indexers/BeyondHD.cs index f2e72ad9a..12057f136 100644 --- a/src/Jackett/Indexers/BeyondHD.cs +++ b/src/Jackett/Indexers/BeyondHD.cs @@ -54,12 +54,12 @@ namespace Jackett.Indexers AddCategoryMapping("77", TorznabCatType.MoviesHD); AddCategoryMapping("71", TorznabCatType.Movies3D); AddCategoryMapping("78", TorznabCatType.MoviesHD); - AddCategoryMapping("37", TorznabCatType.MoviesBlueRay); + AddCategoryMapping("37", TorznabCatType.MoviesBluRay); AddCategoryMapping("54", TorznabCatType.MoviesHD); AddCategoryMapping("55,56,42,36,69", TorznabCatType.Audio); AddCategoryMapping("36", TorznabCatType.AudioLossless); - AddCategoryMapping("69", TorznabCatType.AudioLossy); + AddCategoryMapping("69", TorznabCatType.AudioMP3); } public async Task ApplyConfiguration(JToken configJson) @@ -97,7 +97,7 @@ namespace Jackett.Indexers { cats.AddRange(cat.Split(',')); } - foreach (var cat in cats) + foreach (var cat in cats.Distinct()) { queryCollection.Add("c" + cat, "1"); } diff --git a/src/Jackett/Indexers/FileList.cs b/src/Jackett/Indexers/FileList.cs index d67c06237..acfc371ae 100644 --- a/src/Jackett/Indexers/FileList.cs +++ b/src/Jackett/Indexers/FileList.cs @@ -41,28 +41,28 @@ namespace Jackett.Indexers p: ps, configData: new ConfigurationDataFileList()) { - AddCategoryMapping(24, TorznabCatType.Anime); + AddCategoryMapping(24, TorznabCatType.TVAnime); AddCategoryMapping(11, TorznabCatType.Audio); AddCategoryMapping(15, TorznabCatType.TV); //AddCategoryMapping(18, TorznabCatType.); Other - AddCategoryMapping(16, TorznabCatType.TVDocs); + AddCategoryMapping(16, TorznabCatType.TVDocumentary); AddCategoryMapping(25, TorznabCatType.Movies3D); - AddCategoryMapping(20, TorznabCatType.MoviesBlueRay); + AddCategoryMapping(20, TorznabCatType.MoviesBluRay); AddCategoryMapping(2, TorznabCatType.MoviesSD); AddCategoryMapping(3, TorznabCatType.MoviesForeign); //RO AddCategoryMapping(4, TorznabCatType.MoviesHD); AddCategoryMapping(19, TorznabCatType.MoviesForeign); // RO AddCategoryMapping(1, TorznabCatType.MoviesSD); - AddCategoryMapping(10, TorznabCatType.Consoles); + AddCategoryMapping(10, TorznabCatType.Console); AddCategoryMapping(9, TorznabCatType.PCGames); //AddCategoryMapping(17, TorznabCatType); Linux No cat - AddCategoryMapping(22, TorznabCatType.AppsMobile); //Apps/mobile - AddCategoryMapping(8, TorznabCatType.Apps); + AddCategoryMapping(22, TorznabCatType.PCPhoneOther); //Apps/mobile + AddCategoryMapping(8, TorznabCatType.PC); AddCategoryMapping(21, TorznabCatType.TVHD); AddCategoryMapping(23, TorznabCatType.TVSD); AddCategoryMapping(13, TorznabCatType.TVSport); AddCategoryMapping(14, TorznabCatType.TV); - AddCategoryMapping(12, TorznabCatType.AudioMusicVideos); + AddCategoryMapping(12, TorznabCatType.AudioVideo); AddCategoryMapping(7, TorznabCatType.XXX); } diff --git a/src/Jackett/Indexers/IPTorrents.cs b/src/Jackett/Indexers/IPTorrents.cs index 536dfb4ec..589461dbf 100644 --- a/src/Jackett/Indexers/IPTorrents.cs +++ b/src/Jackett/Indexers/IPTorrents.cs @@ -76,11 +76,11 @@ namespace Jackett.Indexers AddCategoryMapping(80, TorznabCatType.AudioLossless); AddCategoryMapping(93, TorznabCatType.Audio); - AddCategoryMapping(60, TorznabCatType.Anime); - AddCategoryMapping(1, TorznabCatType.Apps); - AddCategoryMapping(64, TorznabCatType.AudioBooks); + AddCategoryMapping(60, TorznabCatType.TVAnime); + AddCategoryMapping(1, TorznabCatType.PC); + AddCategoryMapping(64, TorznabCatType.AudioAudiobook); AddCategoryMapping(35, TorznabCatType.Books); - AddCategoryMapping(94, TorznabCatType.Comic); + AddCategoryMapping(94, TorznabCatType.BooksComics); } public async Task ApplyConfiguration(JToken configJson) diff --git a/src/Jackett/Indexers/ImmortalSeed.cs b/src/Jackett/Indexers/ImmortalSeed.cs index e624e09c4..66dc50412 100644 --- a/src/Jackett/Indexers/ImmortalSeed.cs +++ b/src/Jackett/Indexers/ImmortalSeed.cs @@ -41,7 +41,7 @@ namespace Jackett.Indexers p: ps, configData: new ConfigurationDataBasicLogin()) { - AddCategoryMapping(32, TorznabCatType.Anime); + AddCategoryMapping(32, TorznabCatType.TVAnime); AddCategoryMapping(47, TorznabCatType.TVSD); AddCategoryMapping(8, TorznabCatType.TVHD); AddCategoryMapping(48, TorznabCatType.TVHD); @@ -50,8 +50,8 @@ namespace Jackett.Indexers AddCategoryMapping(6, TorznabCatType.TVSD); AddCategoryMapping(22, TorznabCatType.Books); - AddCategoryMapping(41, TorznabCatType.Comic); - AddCategoryMapping(23, TorznabCatType.Apps); + AddCategoryMapping(41, TorznabCatType.BooksComics); + AddCategoryMapping(23, TorznabCatType.PC); AddCategoryMapping(16, TorznabCatType.MoviesHD); AddCategoryMapping(17, TorznabCatType.MoviesSD); @@ -62,8 +62,8 @@ namespace Jackett.Indexers AddCategoryMapping(34, TorznabCatType.Audio); AddCategoryMapping(37, TorznabCatType.AudioLossless); - AddCategoryMapping(35, TorznabCatType.AudioBooks); - AddCategoryMapping(36, TorznabCatType.AudioLossy); + AddCategoryMapping(35, TorznabCatType.AudioAudiobook); + AddCategoryMapping(36, TorznabCatType.AudioMP3); } diff --git a/src/Jackett/Indexers/RUTor.cs b/src/Jackett/Indexers/RUTor.cs index 1cae8b856..296cea65f 100644 --- a/src/Jackett/Indexers/RUTor.cs +++ b/src/Jackett/Indexers/RUTor.cs @@ -43,7 +43,7 @@ namespace Jackett.Indexers p: ps, configData: new ConfigurationDataRuTor(defaultSiteLink)) { - TorznabCaps.Categories.Add(TorznabCatType.Anime); + TorznabCaps.Categories.Add(TorznabCatType.TVAnime); TorznabCaps.Categories.Add(TorznabCatType.Movies); TorznabCaps.Categories.Add(TorznabCatType.Audio); TorznabCaps.Categories.Add(TorznabCatType.Books); @@ -57,7 +57,7 @@ namespace Jackett.Indexers await ConfigureIfOK(string.Empty, releases.Count() > 0, () => { - configData = oldConfig; + configData = oldConfig; throw new Exception("Could not find releases from this URL"); }); } @@ -78,20 +78,20 @@ namespace Jackett.Indexers private readonly int CAT_ANY = 0; private readonly int CAT_FOREIGN_MOVIE = 1; - // private readonly int CAT_OUR_MOVIES = 5; - // private readonly int CAT_POP_SCIFI_MOVIES = 12; + // private readonly int CAT_OUR_MOVIES = 5; + // private readonly int CAT_POP_SCIFI_MOVIES = 12; private readonly int CAT_TV_SERIES = 4; - // private readonly int CAT_TV = 6; - // private readonly int CAT_ANIMATION = 7; + // private readonly int CAT_TV = 6; + // private readonly int CAT_ANIMATION = 7; private readonly int CAT_ANIME = 10; private readonly int CAT_MUSIC = 2; - // private readonly int CAT_GAMES = 8; - // private readonly int CAT_SOFTWARE = 9; - // private readonly int CAT_SPORTS_HEALTH = 13; - // private readonly int CAT_HUMOR = 15; - // private readonly int CAT_ECONOMY_LIFE = 14; + // private readonly int CAT_GAMES = 8; + // private readonly int CAT_SOFTWARE = 9; + // private readonly int CAT_SPORTS_HEALTH = 13; + // private readonly int CAT_HUMOR = 15; + // private readonly int CAT_ECONOMY_LIFE = 14; private readonly int CAT_BOOKS = 11; - // private readonly int CAT_OTHER = 3; + // private readonly int CAT_OTHER = 3; public async Task> PerformQuery(TorznabQuery query) { @@ -99,9 +99,10 @@ namespace Jackett.Indexers var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString(); var searchCategory = CAT_ANY; - if(query.Categories.Contains(TorznabCatType.TV.ID) || - query.Categories.Contains(TorznabCatType.TVHD.ID)|| - query.Categories.Contains(TorznabCatType.TVSD.ID)){ + if (query.Categories.Contains(TorznabCatType.TV.ID) || + query.Categories.Contains(TorznabCatType.TVHD.ID) || + query.Categories.Contains(TorznabCatType.TVSD.ID)) + { searchCategory = CAT_TV_SERIES; } @@ -114,8 +115,8 @@ namespace Jackett.Indexers searchCategory = CAT_FOREIGN_MOVIE; } - if ((searchCategory == CAT_ANY) && - (query.Categories.Contains(TorznabCatType.Anime.ID))) + if ((searchCategory == CAT_ANY) && + (query.Categories.Contains(TorznabCatType.TVAnime.ID))) { searchCategory = CAT_ANIME; } @@ -129,7 +130,7 @@ namespace Jackett.Indexers if ((searchCategory == CAT_ANY) && (query.Categories.Contains(TorznabCatType.Audio.ID) || query.Categories.Contains(TorznabCatType.AudioLossless.ID) || - query.Categories.Contains(TorznabCatType.AudioLossy.ID))) + query.Categories.Contains(TorznabCatType.AudioMP3.ID))) { searchCategory = CAT_MUSIC; } @@ -138,7 +139,8 @@ namespace Jackett.Indexers if (string.IsNullOrWhiteSpace(searchString)) { queryUrl = string.Format(BrowseUrl, searchCategory); - } else + } + else { queryUrl = string.Format(SearchUrl, searchCategory, HttpUtility.UrlEncode(searchString.Trim())); } @@ -176,7 +178,7 @@ namespace Jackett.Indexers if (hasTorrent) titleIndex++; - release.Title = row.Cq().Find("td:eq("+ titleIndex+")").Text().Trim(); + release.Title = row.Cq().Find("td:eq(" + titleIndex + ")").Text().Trim(); if (configData.StripRussian.Value) { var split = release.Title.IndexOf('/'); @@ -194,14 +196,14 @@ namespace Jackett.Indexers if (hasComments) sizeCol++; - var sizeStr = StringUtil.StripRegex(row.Cq().Find("td:eq("+ sizeCol + ")").Text(), "[^a-zA-Z0-9\\. -]", " ").Trim(); + var sizeStr = StringUtil.StripRegex(row.Cq().Find("td:eq(" + sizeCol + ")").Text(), "[^a-zA-Z0-9\\. -]", " ").Trim(); string[] sizeSplit = sizeStr.Split(' '); release.Size = ReleaseInfo.GetBytes(sizeSplit[1].ToLower(), ParseUtil.CoerceFloat(sizeSplit[0])); release.Seeders = ParseUtil.CoerceInt(row.Cq().Find(".green").Text().Trim()); release.Peers = ParseUtil.CoerceInt(row.Cq().Find(".red").Text().Trim()) + release.Seeders; - - release.Guid = new Uri(configData.Url.Value + row.Cq().Find("td:eq(1) a:eq("+ titleIndex+")").Attr("href").Substring(1)); + + release.Guid = new Uri(configData.Url.Value + row.Cq().Find("td:eq(1) a:eq(" + titleIndex + ")").Attr("href").Substring(1)); release.Comments = release.Guid; if (hasTorrent) @@ -213,7 +215,7 @@ namespace Jackett.Indexers { release.MagnetUri = new Uri(row.Cq().Find("td:eq(1) a:eq(0)").Attr("href")); } - + releases.Add(release); } } diff --git a/src/Jackett/Indexers/TVChaosUK.cs b/src/Jackett/Indexers/TVChaosUK.cs index 37c6e5a85..24b01d184 100644 --- a/src/Jackett/Indexers/TVChaosUK.cs +++ b/src/Jackett/Indexers/TVChaosUK.cs @@ -47,9 +47,9 @@ namespace Jackett.Indexers p: ps, configData: new ConfigurationDataBasicLoginWithRSS()) { - AddCategoryMapping(72, TorznabCatType.Apps); + AddCategoryMapping(72, TorznabCatType.PC); AddCategoryMapping(86, TorznabCatType.Audio); - AddCategoryMapping(87, TorznabCatType.AudioBooks); + AddCategoryMapping(87, TorznabCatType.AudioAudiobook); AddCategoryMapping(88, TorznabCatType.Audio); AddCategoryMapping(83, TorznabCatType.Movies); @@ -58,13 +58,13 @@ namespace Jackett.Indexers AddCategoryMapping(181, TorznabCatType.Movies); AddCategoryMapping(182, TorznabCatType.Movies); - AddCategoryMapping(75, TorznabCatType.TVDocs); - AddCategoryMapping(189, TorznabCatType.TVDocs); - AddCategoryMapping(224, TorznabCatType.TVDocs); - AddCategoryMapping(174, TorznabCatType.TVDocs); - AddCategoryMapping(113, TorznabCatType.TVDocs); - AddCategoryMapping(100, TorznabCatType.TVDocs); - AddCategoryMapping(98, TorznabCatType.TVDocs); + AddCategoryMapping(75, TorznabCatType.TVDocumentary); + AddCategoryMapping(189, TorznabCatType.TVDocumentary); + AddCategoryMapping(224, TorznabCatType.TVDocumentary); + AddCategoryMapping(174, TorznabCatType.TVDocumentary); + AddCategoryMapping(113, TorznabCatType.TVDocumentary); + AddCategoryMapping(100, TorznabCatType.TVDocumentary); + AddCategoryMapping(98, TorznabCatType.TVDocumentary); AddCategoryMapping(176, TorznabCatType.TVHD); AddCategoryMapping(175, TorznabCatType.TVHD); @@ -75,10 +75,10 @@ namespace Jackett.Indexers AddCategoryMapping(221, TorznabCatType.TVHD); // RSS Textual categories - AddCategoryMapping("Appz", TorznabCatType.Apps); + AddCategoryMapping("Appz", TorznabCatType.PC); AddCategoryMapping("Radio/Audio", TorznabCatType.Audio); - AddCategoryMapping("Audio Books", TorznabCatType.AudioBooks); - AddCategoryMapping("Radio Comedy", TorznabCatType.AudioBooks); + AddCategoryMapping("Audio Books", TorznabCatType.AudioAudiobook); + AddCategoryMapping("Radio Comedy", TorznabCatType.AudioAudiobook); AddCategoryMapping("TV Aired Movies", TorznabCatType.Movies); AddCategoryMapping("Classic Movies", TorznabCatType.Movies); @@ -86,13 +86,13 @@ namespace Jackett.Indexers AddCategoryMapping("Made for TV", TorznabCatType.Movies); AddCategoryMapping("TV Aired Movies", TorznabCatType.Movies); - AddCategoryMapping("Documentary & News", TorznabCatType.TVDocs); - AddCategoryMapping("Docudrama", TorznabCatType.TVDocs); - AddCategoryMapping("Documentary", TorznabCatType.TVDocs); - AddCategoryMapping("HD Documentary", TorznabCatType.TVDocs); - AddCategoryMapping("Historical", TorznabCatType.TVDocs); - AddCategoryMapping("True Crime", TorznabCatType.TVDocs); - AddCategoryMapping("Wildlife/Nature", TorznabCatType.TVDocs); + AddCategoryMapping("Documentary & News", TorznabCatType.TVDocumentary); + AddCategoryMapping("Docudrama", TorznabCatType.TVDocumentary); + AddCategoryMapping("Documentary", TorznabCatType.TVDocumentary); + AddCategoryMapping("HD Documentary", TorznabCatType.TVDocumentary); + AddCategoryMapping("Historical", TorznabCatType.TVDocumentary); + AddCategoryMapping("True Crime", TorznabCatType.TVDocumentary); + AddCategoryMapping("Wildlife/Nature", TorznabCatType.TVDocumentary); AddCategoryMapping("HD Sci-Fi", TorznabCatType.TVHD); AddCategoryMapping("HD Drama", TorznabCatType.TVHD); diff --git a/src/Jackett/Indexers/TorrentBytes.cs b/src/Jackett/Indexers/TorrentBytes.cs index 3ffcd6e7d..0946adbb2 100644 --- a/src/Jackett/Indexers/TorrentBytes.cs +++ b/src/Jackett/Indexers/TorrentBytes.cs @@ -58,17 +58,17 @@ namespace Jackett.Indexers AddCategoryMapping(43, TorznabCatType.Audio); AddCategoryMapping(48, TorznabCatType.AudioLossless); - AddCategoryMapping(6, TorznabCatType.AudioLossy); + AddCategoryMapping(6, TorznabCatType.AudioMP3); AddCategoryMapping(46, TorznabCatType.Movies); - AddCategoryMapping(1, TorznabCatType.Apps); - AddCategoryMapping(2, TorznabCatType.Apps); - AddCategoryMapping(23, TorznabCatType.Anime); + AddCategoryMapping(1, TorznabCatType.PC); + AddCategoryMapping(2, TorznabCatType.PC); + AddCategoryMapping(23, TorznabCatType.TVAnime); AddCategoryMapping(21, TorznabCatType.XXX); - AddCategoryMapping(9, TorznabCatType.XXXSD); - AddCategoryMapping(39, TorznabCatType.XXXHD); - AddCategoryMapping(29, TorznabCatType.XXXSD); - AddCategoryMapping(24, TorznabCatType.XXXImg); + AddCategoryMapping(9, TorznabCatType.XXXXviD); + AddCategoryMapping(39, TorznabCatType.XXXx264); + AddCategoryMapping(29, TorznabCatType.XXXXviD); + AddCategoryMapping(24, TorznabCatType.XXXImageset); } public async Task ApplyConfiguration(JToken configJson) diff --git a/src/Jackett/Indexers/TorrentDay.cs b/src/Jackett/Indexers/TorrentDay.cs index b4d8ad8c1..5bd773647 100644 --- a/src/Jackett/Indexers/TorrentDay.cs +++ b/src/Jackett/Indexers/TorrentDay.cs @@ -43,11 +43,11 @@ namespace Jackett.Indexers configData: new ConfigurationDataRecaptchaLogin()) { - AddCategoryMapping(29, TorznabCatType.Anime); - AddCategoryMapping(28, TorznabCatType.Apps); - AddCategoryMapping(28, TorznabCatType.AudioBooks); + AddCategoryMapping(29, TorznabCatType.TVAnime); + AddCategoryMapping(28, TorznabCatType.PC); + AddCategoryMapping(28, TorznabCatType.AudioAudiobook); AddCategoryMapping(20, TorznabCatType.Books); - AddCategoryMapping(30, TorznabCatType.TVDocs); + AddCategoryMapping(30, TorznabCatType.TVDocumentary); //Freelech //Mac @@ -118,7 +118,7 @@ namespace Jackett.Indexers SaveConfig(); IsConfigured = true; } - catch(Exception e) + catch (Exception e) { IsConfigured = false; throw new Exception("Your cookie did not work: " + e.Message); @@ -153,7 +153,7 @@ namespace Jackett.Indexers queryCollection.Add("search", searchString); foreach (var cat in MapTorznabCapsToTrackers(query)) - queryCollection.Add("c"+cat,"1"); + queryCollection.Add("c" + cat, "1"); if (queryCollection.Count > 0) queryUrl += "?" + queryCollection.GetQueryString(); @@ -177,9 +177,9 @@ namespace Jackett.Indexers release.MinimumSeedTime = 172800; release.Title = qRow.Find(".torrentName").Text(); release.Description = release.Title; - release.Guid = new Uri(SiteLink + qRow.Find(".torrentName").Attr("href")); + release.Guid = new Uri(SiteLink + qRow.Find(".torrentName").Attr("href")); release.Comments = release.Guid; - release.Link = new Uri(SiteLink + qRow.Find(".dlLinksInfo > a").Attr("href")); + release.Link = new Uri(SiteLink + qRow.Find(".dlLinksInfo > a").Attr("href")); var sizeStr = qRow.Find(".sizeInfo").Text(); release.Size = ReleaseInfo.GetBytes(sizeStr); diff --git a/src/Jackett/Jackett.csproj b/src/Jackett/Jackett.csproj index 1db72cf45..be6d23442 100644 --- a/src/Jackett/Jackett.csproj +++ b/src/Jackett/Jackett.csproj @@ -232,12 +232,12 @@ - + + True True - TorznabCats.tt + TorznabCatType.tt - @@ -531,9 +531,9 @@ PreserveNewest - + TextTemplatingFileGenerator - TorznabCats.cs + TorznabCatType.generated.cs diff --git a/src/Jackett/Models/TorznabCatType.cs b/src/Jackett/Models/TorznabCatType.cs index e498bd10f..edef9cc1f 100644 --- a/src/Jackett/Models/TorznabCatType.cs +++ b/src/Jackett/Models/TorznabCatType.cs @@ -1,81 +1,16 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Linq; namespace Jackett.Models { - class TorznabCatType + public static partial class TorznabCatType { - private static Dictionary cats = new Dictionary(); - - static TorznabCatType() - { - cats.Add(1000, "Consoles"); - cats.Add(1010, "Consoles/DS"); - cats.Add(1020, "Consoles/PSP"); - cats.Add(1030, "Consoles/Wii"); - cats.Add(1040, "Consoles/Xbox"); - cats.Add(1050, "Consoles/360"); - cats.Add(1080, "Consoles/PS3"); - - cats.Add(2000, "Movies"); - cats.Add(2010, "Movies/Foreign"); - cats.Add(2020, "Movies/Other"); - cats.Add(2040, "Movies/HD"); - cats.Add(2030, "Movies/SD"); - cats.Add(2050, "Movies/3D"); - cats.Add(2060, "Movies/BluRay"); - - cats.Add(3000, "Audio"); - cats.Add(3010, "Audio/Lossy"); - cats.Add(3020, "Audio/Video"); - cats.Add(3030, "Audio/Audiobook"); - cats.Add(3040, "Audio/Lossless"); - - cats.Add(4000, "PC"); - cats.Add(4010, "PC/Apps"); - cats.Add(4020, "PC/ISO"); - cats.Add(4030, "PC/Mac"); - cats.Add(4040, "PC/Mobile"); - cats.Add(4050, "PC/Games"); - cats.Add(4060, "PC/Mobile/IOS"); - cats.Add(4070, "PC/Mobile/Android"); - - cats.Add(5000, "TV"); - cats.Add(5020, "TV/Foreign"); - cats.Add(5030, "TV/SD"); - cats.Add(5040, "TV/HD"); - cats.Add(5060, "TV/Sport"); - cats.Add(5070, "TV/Anime"); - cats.Add(5080, "TV/Documentary"); - - cats.Add(6000, "XXX"); - cats.Add(6010, "XXX/DVD"); - cats.Add(6040, "XXX/x264"); - cats.Add(6060, "XXX/Imageset"); - - cats.Add(8000, "Books"); - cats.Add(8010, "Books/Ebook"); - cats.Add(8020, "Books/Comics"); - } public static bool QueryContainsParentCategory(int[] queryCats, int releaseCat) { - if (cats.ContainsKey(releaseCat) && queryCats != null) + var cat = AllCats.FirstOrDefault(c => c.ID == releaseCat); + if (cat != null && queryCats != null) { - var ncab = cats[releaseCat]; - var split = ncab.IndexOf("/"); - if (split > -1) - { - string parentCatName = ncab.Substring(0, split); - if (cats.ContainsValue(parentCatName)) - { - var parentCat = cats.Where(c => c.Value == parentCatName).First().Key; - return queryCats.Contains(parentCat); - } - } + return cat.SubCategories.Any(c => queryCats.Contains(c.ID)); } return false; @@ -83,237 +18,14 @@ namespace Jackett.Models public static string GetCatDesc(int newznabcat) { - if (cats.ContainsKey(newznabcat)) + var cat = AllCats.FirstOrDefault(c => c.ID == newznabcat); + if (cat != null) { - return cats[newznabcat]; + return cat.Name; } return string.Empty; } - private static TorznabCategory GetCat(int id) - { - return new TorznabCategory() - { - ID = id, - Name = cats.ContainsKey(id) ? cats[id] : string.Empty - }; - } - - public static TorznabCategory Anime - { - get { return GetCat(5070); } - } - - public static TorznabCategory TV - { - get { return GetCat(5000); } - } - - public static TorznabCategory TVDocs - { - get { return GetCat(5080); } - } - - public static TorznabCategory TVSD - { - get { return GetCat(5030); } - } - - public static TorznabCategory TVHD - { - get { return GetCat(5040); } - } - - public static TorznabCategory TVSport - { - get { return GetCat(5060); } - } - - public static TorznabCategory TVForeign - { - get { return GetCat(5020); } - } - - public static TorznabCategory Books - { - get { return GetCat(8000); } - } - - public static TorznabCategory EBooks - { - get { return GetCat(8020); } - } - - public static TorznabCategory Comic - { - get { return GetCat(8020); } - } - - public static TorznabCategory Apps - { - get { return GetCat(4010); } - } - - public static TorznabCategory AppsMobile - { - get { return GetCat(4040); } - } - - public static TorznabCategory Movies - { - get { return GetCat(2000); } - } - - public static TorznabCategory MoviesForeign - { - get { return GetCat(2010); } - } - - public static TorznabCategory MoviesOther - { - get { return GetCat(2020); } - } - - public static TorznabCategory MoviesHD - { - get { return GetCat(2040); } - } - - public static TorznabCategory MoviesSD - { - get { return GetCat(2030); } - } - - public static TorznabCategory MoviesBlueRay - { - get { return GetCat(2060); } - } - - public static TorznabCategory Movies3D - { - get { return GetCat(2050); } - } - - public static TorznabCategory Audio - { - get { return GetCat(3000); } - } - - public static TorznabCategory AudioBooks - { - get { return GetCat(3030); } - } - - public static TorznabCategory AudioLossless - { - get { return GetCat(3040); } - } - - public static TorznabCategory AudioLossy - { - get { return GetCat(3010); } - } - - - public static TorznabCategory AudioMusicVideos - { - get { return GetCat(3020); } - } - - public static TorznabCategory XXX - { - get { return GetCat(6000); } - } - - public static TorznabCategory XXXHD - { - get { return GetCat(6040); } - } - - public static TorznabCategory XXXSD - { - get { return GetCat(6010); } - } - - public static TorznabCategory XXXImg - { - get { return GetCat(6060); } - } - - public static TorznabCategory PC - { - get { return GetCat(4000); } - } - - public static TorznabCategory PC0Day - { - get { return GetCat(4010); } - } - - public static TorznabCategory PCIso - { - get { return GetCat(4020); } - } - - public static TorznabCategory PCMac - { - get { return GetCat(4030); } - } - - public static TorznabCategory PCGames - { - get { return GetCat(4050); } - } - - public static TorznabCategory PCMobileOther - { - get { return GetCat(4040); } - } - - public static TorznabCategory PCMobileIos - { - get { return GetCat(4060); } - } - - public static TorznabCategory PCMobileAndroid - { - get { return GetCat(4070); } - } - - public static TorznabCategory Consoles - { - get { return GetCat(1000); } - } - - public static TorznabCategory ConsoleDS - { - get { return GetCat(1010); } - } - - public static TorznabCategory ConsolePSP - { - get { return GetCat(1020); } - } - - public static TorznabCategory ConsoleXbox - { - get { return GetCat(1040); } - } - - public static TorznabCategory ConsoleXbox360 - { - get { return GetCat(1050); } - } - - public static TorznabCategory ConsoleWii - { - get { return GetCat(1030); } - } - - public static TorznabCategory ConsolePS3 - { - get { return GetCat(1080); } - } } } diff --git a/src/Jackett/Models/TorznabCats.cs b/src/Jackett/Models/TorznabCatType.generated.cs similarity index 89% rename from src/Jackett/Models/TorznabCats.cs rename to src/Jackett/Models/TorznabCatType.generated.cs index b9122ef43..d6914fd8d 100644 --- a/src/Jackett/Models/TorznabCats.cs +++ b/src/Jackett/Models/TorznabCatType.generated.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; -using Jackett.Models; -public static class TorznabCats +namespace Jackett.Models { + public static partial class TorznabCatType + { + public static readonly TorznabCategory Console = new TorznabCategory(1000, "Console"); public static readonly TorznabCategory ConsoleNDS = new TorznabCategory(1010, "Console/NDS"); @@ -137,7 +139,9 @@ public static class TorznabCats public static readonly TorznabCategory BooksForeign = new TorznabCategory(8060, "Books/Foreign"); - static TorznabCats() + public static readonly TorznabCategory[] AllCats = new TorznabCategory[] { Console, ConsoleNDS, ConsolePSP, ConsoleWii, ConsoleXbox, ConsoleXbox360, ConsoleWiiwareVC, ConsoleXBOX360DLC, ConsolePS3, ConsoleOther, Console3DS, ConsolePSVita, ConsoleWiiU, ConsoleXboxOne, ConsolePS4, Movies, MoviesForeign, MoviesOther, MoviesSD, MoviesHD, Movies3D, MoviesBluRay, MoviesDVD, MoviesWEBDL, Audio, AudioMP3, AudioVideo, AudioAudiobook, AudioLossless, AudioOther, AudioForeign, PC, PC0day, PCISO, PCMac, PCPhoneOther, PCGames, PCPhoneIOS, PCPhoneAndroid, TV, TVWEBDL, TVFOREIGN, TVSD, TVHD, TVOTHER, TVSport, TVAnime, TVDocumentary, XXX, XXXDVD, XXXWMV, XXXXviD, XXXx264, XXXOther, XXXImageset, XXXPacks, Other, OtherMisc, OtherHashed, Books, BooksEbook, BooksComics, BooksMagazines, BooksTechnical, BooksOther, BooksForeign }; + + static TorznabCatType() { Console.SubCategories.AddRange(new List { ConsoleNDS, ConsolePSP, ConsoleWii, ConsoleXbox, ConsoleXbox360, ConsoleWiiwareVC, ConsoleXBOX360DLC, ConsolePS3, ConsoleOther, Console3DS, ConsolePSVita, ConsoleWiiU, ConsoleXboxOne, ConsolePS4 }); @@ -157,6 +161,6 @@ public static class TorznabCats Books.SubCategories.AddRange(new List { BooksEbook, BooksComics, BooksMagazines, BooksTechnical, BooksOther, BooksForeign }); } - + } } diff --git a/src/Jackett/Models/TorznabCats.tt b/src/Jackett/Models/TorznabCatType.tt similarity index 91% rename from src/Jackett/Models/TorznabCats.tt rename to src/Jackett/Models/TorznabCatType.tt index 30dc82b4b..d55cf48cd 100644 --- a/src/Jackett/Models/TorznabCats.tt +++ b/src/Jackett/Models/TorznabCatType.tt @@ -3,7 +3,7 @@ <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> -<#@ output extension=".cs" #> +<#@ output extension=".generated.cs" #> <# string data = @" 1000: Console @@ -75,10 +75,12 @@ "; #> using System.Collections.Generic; -using Jackett.Models; -public static class TorznabCats +namespace Jackett.Models { + + public static partial class TorznabCatType + { <# var items = data.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); var cats = new List(); @@ -97,7 +99,9 @@ public static class TorznabCats <# } #> - static TorznabCats() + public static readonly TorznabCategory[] AllCats = new TorznabCategory[] { <#= string.Join(", ", cats.Select(c => c.MemberName)) #> }; + + static TorznabCatType() { <# foreach (var cat in cats) @@ -117,7 +121,7 @@ public static class TorznabCats #> } - + } } <#+