diff --git a/src/Jackett/Indexers/AnimeBytes.cs b/src/Jackett/Indexers/AnimeBytes.cs index 968221237..46b744bc6 100644 --- a/src/Jackett/Indexers/AnimeBytes.cs +++ b/src/Jackett/Indexers/AnimeBytes.cs @@ -1,6 +1,7 @@ using CsQuery; using Newtonsoft.Json.Linq; using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -19,20 +20,18 @@ namespace Jackett.Indexers class ConfigurationDataBasicLoginAnimeBytes : ConfigurationDataBasicLogin { public BoolItem IncludeRaw { get; private set; } - public DisplayItem RageIdWarning { get; private set; } public DisplayItem DateWarning { get; private set; } public ConfigurationDataBasicLoginAnimeBytes() : base() { IncludeRaw = new BoolItem() { Name = "IncludeRaw", Value = false }; - RageIdWarning = new DisplayItem("Ensure rageid lookup is disabled in Sonarr for this tracker.") { Name = "RageWarning" }; DateWarning = new DisplayItem("This tracker does not supply upload dates so they are based off year of release.") { Name = "DateWarning" }; } public override Item[] GetItems() { - return new Item[] { Username, Password, IncludeRaw, RageIdWarning, DateWarning }; + return new Item[] { Username, Password, IncludeRaw, DateWarning }; } } @@ -196,12 +195,28 @@ namespace Jackett.Indexers public async Task PerformQuery(TorznabQuery query) { - // This tracker only deals with full seasons so chop off the episode/season number if we have it D: - if (!string.IsNullOrWhiteSpace(query.SearchTerm)) + // The result list + var releases = new ConcurrentBag(); + var titles = query.ShowTitles ?? new string[] { query.SearchTerm??string.Empty }; + + var tasks = titles.Select(async item => { - var splitindex = query.SearchTerm.LastIndexOf(' '); + foreach (var result in await GetResults(item)) + releases.Add(result); + }); + await Task.WhenAll(tasks); + + return releases.ToArray(); + } + + public async Task GetResults(string searchTerm) + { + // This tracker only deals with full seasons so chop off the episode/season number if we have it D: + if (!string.IsNullOrWhiteSpace(searchTerm)) + { + var splitindex = searchTerm.LastIndexOf(' '); if (splitindex > -1) - query.SearchTerm = query.SearchTerm.Substring(0, splitindex); + searchTerm = searchTerm.Substring(0, splitindex); } // The result list @@ -213,17 +228,16 @@ namespace Jackett.Indexers // Remove old cache items CleanCache(); - var cachedResult = cache.Where(i => i.Query == query.SearchTerm).FirstOrDefault(); + var cachedResult = cache.Where(i => i.Query == searchTerm).FirstOrDefault(); if (cachedResult != null) return cachedResult.Results.Select(s => (ReleaseInfo)s.Clone()).ToArray(); } var queryUrl = SearchUrl; // Only include the query bit if its required as hopefully the site caches the non query page - if (!string.IsNullOrWhiteSpace(query.SearchTerm)) + if (!string.IsNullOrWhiteSpace(searchTerm)) { - - queryUrl += "&action=advanced&search_type=title&sort=time_added&way=desc&anime%5Btv_series%5D=1&searchstr=" + WebUtility.UrlEncode(query.SearchTerm); + queryUrl += "&action=advanced&search_type=title&sort=time_added&way=desc&anime%5Btv_series%5D=1&searchstr=" + WebUtility.UrlEncode(searchTerm); } // Get the content from the tracker @@ -320,13 +334,15 @@ namespace Jackett.Indexers release.MinimumRatio = 1; release.MinimumSeedTime = 259200; var downloadLink = links.Get(0); - release.Guid = new Uri(BaseUrl + "/" + downloadLink.Attributes.GetAttribute("href") + "&nh=" + Hash(title)); // Sonarr should dedupe on this url - allow a url per name. - release.Link = release.Guid;// We dont know this so try to fake based on the release year + + // We dont know this so try to fake based on the release year release.PublishDate = new DateTime(year, 1, 1); release.PublishDate = release.PublishDate.AddDays(Math.Min(DateTime.Now.DayOfYear, 365) - 1); var infoLink = links.Get(1); release.Comments = new Uri(BaseUrl + "/" + infoLink.Attributes.GetAttribute("href")); + release.Guid = new Uri(BaseUrl + "/" + infoLink.Attributes.GetAttribute("href") + "&nh=" + Hash(title)); // Sonarr should dedupe on this url - allow a url per name. + release.Link = new Uri(BaseUrl + "/" + downloadLink.Attributes.GetAttribute("href")); // We dont actually have a release name >.> so try to create one var releaseTags = infoLink.InnerText.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); @@ -390,11 +406,10 @@ namespace Jackett.Indexers throw ex; } - // Add to the cache lock (cache) { - cache.Add(new CachedResult(query.SearchTerm, releases)); + cache.Add(new CachedResult(searchTerm, releases)); } return releases.Select(s => (ReleaseInfo)s.Clone()).ToArray(); diff --git a/src/Jackett/Indexers/HDTorrents.cs b/src/Jackett/Indexers/HDTorrents.cs index 075b78e6f..6d691d256 100644 --- a/src/Jackett/Indexers/HDTorrents.cs +++ b/src/Jackett/Indexers/HDTorrents.cs @@ -18,7 +18,7 @@ namespace Jackett.Indexers public event Action OnResultParsingError; - const string DefaultUrl = "http://hd-torrents.org"; + const string DefaultUrl = "http://hdts.ru"; // Of the accessible domains the .ru seems the most reliable. https://hdts.ru | https://hd-torrents.org | https://hd-torrents.net | https://hd-torrents.me string BaseUrl = DefaultUrl; static string chromeUserAgent = BrowserUtil.ChromeUserAgent; private string SearchUrl = DefaultUrl + "/torrents.php?search={0}&active=1&options=0&category%5B%5D=59&category%5B%5D=60&category%5B%5D=30&category%5B%5D=38&page={1}"; @@ -176,7 +176,7 @@ namespace Jackett.Indexers release.MinimumRatio = 1; release.MinimumSeedTime = 172800; - release.MagnetUri = new Uri(DefaultUrl + "/" + qRow.Find("td.mainblockcontent").Get(3).FirstChild.GetAttribute("href")); + int seeders, peers; if (ParseUtil.TryCoerceInt(qRow.Find("td").Get(9).FirstChild.FirstChild.InnerText, out seeders)) @@ -207,15 +207,14 @@ namespace Jackett.Indexers } release.Size = size; - release.Link = new Uri(DefaultUrl + "/" + qRow.Find("td.mainblockcontent b a").Attr("href")); - release.Guid = release.Link; + release.Guid = new Uri(DefaultUrl + "/" + qRow.Find("td.mainblockcontent b a").Attr("href")); + release.Link = new Uri(DefaultUrl + "/" + qRow.Find("td.mainblockcontent").Get(3).FirstChild.GetAttribute("href")); + release.Comments = new Uri(DefaultUrl + "/" + qRow.Find("td.mainblockcontent b a").Attr("href") + "#comments"); string[] dateSplit = qRow.Find("td.mainblockcontent").Get(5).InnerHTML.Split(','); string dateString = dateSplit[1].Substring(0, dateSplit[1].IndexOf('>')); release.PublishDate = DateTime.Parse(dateString, CultureInfo.InvariantCulture); - - release.Comments = new Uri(DefaultUrl + "/" + qRow.Find("td.mainblockcontent").Get(2).FirstChild.GetAttribute("href")); - + releases.Add(release); } } @@ -237,7 +236,7 @@ namespace Jackett.Indexers public Task Download(Uri link) { - throw new NotImplementedException(); + return client.GetByteArrayAsync(link); } } } diff --git a/src/Jackett/WebApi.cs b/src/Jackett/WebApi.cs index bb1702cbe..ef8f46c0e 100644 --- a/src/Jackett/WebApi.cs +++ b/src/Jackett/WebApi.cs @@ -276,7 +276,7 @@ namespace Jackett jsonReply["api_key"] = ApiKey.CurrentKey; jsonReply["app_version"] = Assembly.GetExecutingAssembly().GetName().Version.ToString(); JArray items = new JArray(); - foreach (var i in indexerManager.Indexers) + foreach (var i in indexerManager.Indexers.OrderBy(_=>_.Key)) { var indexer = i.Value; var item = new JObject(); diff --git a/src/Jackett/WebContent/custom.css b/src/Jackett/WebContent/custom.css index ee80f8369..3a275888c 100644 --- a/src/Jackett/WebContent/custom.css +++ b/src/Jackett/WebContent/custom.css @@ -25,18 +25,31 @@ border-radius: 6px; box-shadow: 1px 1px 5px 2px #cdcdcd; padding: 10px; - width: 260px; + width: 270px; display: inline-block; vertical-align: top; - margin: 10px; + margin: 5px; } +#indexers { + text-align: center; +} + + +#unconfigured-indexers{ + text-align: center; +} + + #unconfigured-indexers .card { + width: 200px; + } + .unconfigured-indexer { - height: 170px; + height: 120px; } .indexer { - height: 230px; + height: 180px; } .add-indexer { @@ -45,6 +58,7 @@ .indexer-logo { text-align: center; + padding-bottom: 5px; } .indexer-logo > img { diff --git a/src/Jackett/WebContent/index.html b/src/Jackett/WebContent/index.html index b31e95b70..37918e42b 100644 --- a/src/Jackett/WebContent/index.html +++ b/src/Jackett/WebContent/index.html @@ -42,6 +42,9 @@
+

+ To add a Jackett indexer in Sonarr go to Settings > Indexers > Add > Torznab > Custom. +

Jackett API Key:

Use this key when adding indexers to Sonarr. This key works for all indexers.

@@ -52,23 +55,13 @@
-
-

Configured Indexers

-
- - - -
- +

- - -