mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
broadcasthenet: add requestDelay, MST, infohash and fix trailer description
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Jackett.Common.Extensions;
|
||||||
using Jackett.Common.Models;
|
using Jackett.Common.Models;
|
||||||
using Jackett.Common.Models.IndexerConfig;
|
using Jackett.Common.Models.IndexerConfig;
|
||||||
using Jackett.Common.Services.Interfaces;
|
using Jackett.Common.Services.Interfaces;
|
||||||
@@ -48,6 +49,7 @@ namespace Jackett.Common.Indexers
|
|||||||
cacheService: cs,
|
cacheService: cs,
|
||||||
configData: new ConfigurationDataAPIKey())
|
configData: new ConfigurationDataAPIKey())
|
||||||
{
|
{
|
||||||
|
webclient.requestDelay = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TorznabCapabilities SetCapabilities()
|
private TorznabCapabilities SetCapabilities()
|
||||||
@@ -66,7 +68,7 @@ namespace Jackett.Common.Indexers
|
|||||||
caps.Categories.AddCategoryMapping("720p", TorznabCatType.TVHD, "720p");
|
caps.Categories.AddCategoryMapping("720p", TorznabCatType.TVHD, "720p");
|
||||||
caps.Categories.AddCategoryMapping("1080p", TorznabCatType.TVHD, "1080p");
|
caps.Categories.AddCategoryMapping("1080p", TorznabCatType.TVHD, "1080p");
|
||||||
caps.Categories.AddCategoryMapping("1080i", TorznabCatType.TVHD, "1080i");
|
caps.Categories.AddCategoryMapping("1080i", TorznabCatType.TVHD, "1080i");
|
||||||
caps.Categories.AddCategoryMapping("2160p", TorznabCatType.TVHD, "2160p");
|
caps.Categories.AddCategoryMapping("2160p", TorznabCatType.TVUHD, "2160p");
|
||||||
caps.Categories.AddCategoryMapping("Portable Device", TorznabCatType.TVSD, "Portable Device");
|
caps.Categories.AddCategoryMapping("Portable Device", TorznabCatType.TVSD, "Portable Device");
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
@@ -81,7 +83,9 @@ namespace Jackett.Common.Indexers
|
|||||||
{
|
{
|
||||||
var results = await PerformQuery(new TorznabQuery());
|
var results = await PerformQuery(new TorznabQuery());
|
||||||
if (!results.Any())
|
if (!results.Any())
|
||||||
|
{
|
||||||
throw new Exception("Testing returned no results!");
|
throw new Exception("Testing returned no results!");
|
||||||
|
}
|
||||||
|
|
||||||
IsConfigured = true;
|
IsConfigured = true;
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
@@ -110,14 +114,23 @@ namespace Jackett.Common.Indexers
|
|||||||
searchString = Regex.Replace(searchString, @"(?i)\bS0*(\d+)\b", "Season $1");
|
searchString = Regex.Replace(searchString, @"(?i)\bS0*(\d+)\b", "Season $1");
|
||||||
var btnResults = query.Limit;
|
var btnResults = query.Limit;
|
||||||
if (btnResults == 0)
|
if (btnResults == 0)
|
||||||
|
{
|
||||||
btnResults = (int)TorznabCaps.LimitsDefault;
|
btnResults = (int)TorznabCaps.LimitsDefault;
|
||||||
|
}
|
||||||
|
|
||||||
var btnOffset = query.Offset;
|
var btnOffset = query.Offset;
|
||||||
var releases = new List<ReleaseInfo>();
|
var releases = new List<ReleaseInfo>();
|
||||||
var searchParam = new Dictionary<string, string>();
|
var searchParam = new Dictionary<string, string>();
|
||||||
|
|
||||||
if (query.IsTvdbQuery)
|
if (query.IsTvdbQuery)
|
||||||
searchParam["tvdb"] = string.Format("{0}", query.TvdbID);
|
{
|
||||||
searchParam["search"] = searchString.Replace(" ", "%");
|
searchParam["tvdb"] = $"{query.TvdbID}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (searchString.IsNotNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
searchParam["search"] = searchString.Replace(" ", "%");
|
||||||
|
}
|
||||||
|
|
||||||
var parameters = new JArray
|
var parameters = new JArray
|
||||||
{
|
{
|
||||||
@@ -145,50 +158,84 @@ namespace Jackett.Common.Indexers
|
|||||||
{
|
{
|
||||||
var btnResult = itemKey.Value;
|
var btnResult = itemKey.Value;
|
||||||
var descriptions = new List<string>();
|
var descriptions = new List<string>();
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(btnResult.Series))
|
if (!string.IsNullOrWhiteSpace(btnResult.Series))
|
||||||
|
{
|
||||||
descriptions.Add("Series: " + btnResult.Series);
|
descriptions.Add("Series: " + btnResult.Series);
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(btnResult.GroupName))
|
if (!string.IsNullOrWhiteSpace(btnResult.GroupName))
|
||||||
|
{
|
||||||
descriptions.Add("Group Name: " + btnResult.GroupName);
|
descriptions.Add("Group Name: " + btnResult.GroupName);
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(btnResult.Source))
|
if (!string.IsNullOrWhiteSpace(btnResult.Source))
|
||||||
|
{
|
||||||
descriptions.Add("Source: " + btnResult.Source);
|
descriptions.Add("Source: " + btnResult.Source);
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(btnResult.Container))
|
if (!string.IsNullOrWhiteSpace(btnResult.Container))
|
||||||
|
{
|
||||||
descriptions.Add("Container: " + btnResult.Container);
|
descriptions.Add("Container: " + btnResult.Container);
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(btnResult.Codec))
|
if (!string.IsNullOrWhiteSpace(btnResult.Codec))
|
||||||
|
{
|
||||||
descriptions.Add("Codec: " + btnResult.Codec);
|
descriptions.Add("Codec: " + btnResult.Codec);
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(btnResult.Resolution))
|
if (!string.IsNullOrWhiteSpace(btnResult.Resolution))
|
||||||
|
{
|
||||||
descriptions.Add("Resolution: " + btnResult.Resolution);
|
descriptions.Add("Resolution: " + btnResult.Resolution);
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(btnResult.Origin))
|
if (!string.IsNullOrWhiteSpace(btnResult.Origin))
|
||||||
|
{
|
||||||
descriptions.Add("Origin: " + btnResult.Origin);
|
descriptions.Add("Origin: " + btnResult.Origin);
|
||||||
if (!string.IsNullOrWhiteSpace(btnResult.Series))
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(btnResult.YoutubeTrailer))
|
||||||
|
{
|
||||||
descriptions.Add("Youtube Trailer: <a href=\"" + btnResult.YoutubeTrailer + "\">" + btnResult.YoutubeTrailer + "</a>");
|
descriptions.Add("Youtube Trailer: <a href=\"" + btnResult.YoutubeTrailer + "\">" + btnResult.YoutubeTrailer + "</a>");
|
||||||
|
}
|
||||||
|
|
||||||
var imdb = ParseUtil.GetImdbId(btnResult.ImdbID);
|
var imdb = ParseUtil.GetImdbId(btnResult.ImdbID);
|
||||||
var link = new Uri(btnResult.DownloadURL);
|
var link = new Uri(btnResult.DownloadURL);
|
||||||
var details = new Uri($"{SiteLink}torrents.php?id={btnResult.GroupID}&torrentid={btnResult.TorrentID}");
|
var details = new Uri($"{SiteLink}torrents.php?id={btnResult.GroupID}&torrentid={btnResult.TorrentID}");
|
||||||
var publishDate = DateTimeUtil.UnixTimestampToDateTime(btnResult.Time);
|
var publishDate = DateTimeUtil.UnixTimestampToDateTime(btnResult.Time);
|
||||||
|
|
||||||
var release = new ReleaseInfo
|
var release = new ReleaseInfo
|
||||||
{
|
{
|
||||||
Category = MapTrackerCatToNewznab(btnResult.Resolution),
|
|
||||||
Details = details,
|
|
||||||
Guid = link,
|
Guid = link,
|
||||||
|
Details = details,
|
||||||
Link = link,
|
Link = link,
|
||||||
MinimumRatio = 1,
|
Title = btnResult.ReleaseName,
|
||||||
PublishDate = publishDate,
|
Description = string.Join("<br />\n", descriptions),
|
||||||
RageID = btnResult.TvrageID,
|
Category = MapTrackerCatToNewznab(btnResult.Resolution),
|
||||||
|
InfoHash = btnResult.InfoHash,
|
||||||
|
Size = btnResult.Size,
|
||||||
|
Grabs = btnResult.Snatched,
|
||||||
Seeders = btnResult.Seeders,
|
Seeders = btnResult.Seeders,
|
||||||
Peers = btnResult.Seeders + btnResult.Leechers,
|
Peers = btnResult.Seeders + btnResult.Leechers,
|
||||||
Size = btnResult.Size,
|
PublishDate = publishDate,
|
||||||
TVDBId = btnResult.TvdbID,
|
TVDBId = btnResult.TvdbID,
|
||||||
Title = btnResult.ReleaseName,
|
RageID = btnResult.TvrageID,
|
||||||
UploadVolumeFactor = 1,
|
Imdb = imdb,
|
||||||
DownloadVolumeFactor = 0, // ratioless
|
DownloadVolumeFactor = 0, // ratioless
|
||||||
Grabs = btnResult.Snatched,
|
UploadVolumeFactor = 1,
|
||||||
Description = string.Join("<br />\n", descriptions),
|
MinimumRatio = 1,
|
||||||
Imdb = imdb
|
MinimumSeedTime = btnResult.Category.ToUpperInvariant() == "SEASON" ? 432000 : 86400 // 120 hours for seasons and 24 hours for episodes
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(btnResult.SeriesBanner))
|
if (!string.IsNullOrEmpty(btnResult.SeriesBanner))
|
||||||
|
{
|
||||||
release.Poster = new Uri(btnResult.SeriesBanner);
|
release.Poster = new Uri(btnResult.SeriesBanner);
|
||||||
|
}
|
||||||
|
|
||||||
if (!release.Category.Any()) // default to TV
|
if (!release.Category.Any()) // default to TV
|
||||||
|
{
|
||||||
release.Category.Add(TorznabCatType.TV.ID);
|
release.Category.Add(TorznabCatType.TV.ID);
|
||||||
|
}
|
||||||
|
|
||||||
releases.Add(release);
|
releases.Add(release);
|
||||||
}
|
}
|
||||||
@@ -198,6 +245,7 @@ namespace Jackett.Common.Indexers
|
|||||||
{
|
{
|
||||||
OnParseError(response.ContentString, ex);
|
OnParseError(response.ContentString, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return releases;
|
return releases;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user