mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Potential bug fixes and code cleanup
This commit is contained in:
@@ -109,7 +109,6 @@ namespace Jackett.Indexers
|
|||||||
{
|
{
|
||||||
List<ReleaseInfo> releases = new List<ReleaseInfo>();
|
List<ReleaseInfo> releases = new List<ReleaseInfo>();
|
||||||
|
|
||||||
|
|
||||||
foreach (var title in query.ShowTitles ?? new string[] { string.Empty })
|
foreach (var title in query.ShowTitles ?? new string[] { string.Empty })
|
||||||
{
|
{
|
||||||
var searchString = title + " " + query.GetEpisodeSearchString();
|
var searchString = title + " " + query.GetEpisodeSearchString();
|
||||||
@@ -145,8 +144,8 @@ namespace Jackett.Indexers
|
|||||||
var sizeUnit = sizeCol.ChildNodes[2].NodeValue;
|
var sizeUnit = sizeCol.ChildNodes[2].NodeValue;
|
||||||
release.Size = ReleaseInfo.GetBytes(sizeUnit, float.Parse(sizeVal));
|
release.Size = ReleaseInfo.GetBytes(sizeUnit, float.Parse(sizeVal));
|
||||||
|
|
||||||
release.Seeders = int.Parse(qRow.Children().ElementAt(8).Cq().Text().Trim());
|
release.Seeders = int.Parse(qRow.Children().ElementAt(8).Cq().Text().Trim(), NumberStyles.AllowThousands);
|
||||||
release.Peers = int.Parse(qRow.Children().ElementAt(9).Cq().Text().Trim()) + release.Seeders;
|
release.Peers = int.Parse(qRow.Children().ElementAt(9).Cq().Text().Trim(), NumberStyles.AllowThousands) + release.Seeders;
|
||||||
|
|
||||||
releases.Add(release);
|
releases.Add(release);
|
||||||
}
|
}
|
||||||
|
@@ -172,8 +172,8 @@ namespace Jackett
|
|||||||
var sizeUnit = sizeCol.ChildNodes[2].NodeValue;
|
var sizeUnit = sizeCol.ChildNodes[2].NodeValue;
|
||||||
release.Size = ReleaseInfo.GetBytes(sizeUnit, sizeVal);
|
release.Size = ReleaseInfo.GetBytes(sizeUnit, sizeVal);
|
||||||
|
|
||||||
release.Seeders = int.Parse(row.ChildElements.ElementAt(8).Cq().Text());
|
release.Seeders = int.Parse(row.ChildElements.ElementAt(8).Cq().Text(), NumberStyles.AllowThousands);
|
||||||
release.Peers = int.Parse(row.ChildElements.ElementAt(9).Cq().Text()) + release.Seeders;
|
release.Peers = int.Parse(row.ChildElements.ElementAt(9).Cq().Text(), NumberStyles.AllowThousands) + release.Seeders;
|
||||||
|
|
||||||
if (!release.Title.ToLower().Contains(title.ToLower()))
|
if (!release.Title.ToLower().Contains(title.ToLower()))
|
||||||
continue;
|
continue;
|
||||||
|
@@ -164,8 +164,8 @@ namespace Jackett
|
|||||||
pubDate = DateTime.ParseExact(dateString, "d-MMM-yyyy HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal).ToLocalTime();
|
pubDate = DateTime.ParseExact(dateString, "d-MMM-yyyy HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal).ToLocalTime();
|
||||||
release.PublishDate = pubDate;
|
release.PublishDate = pubDate;
|
||||||
|
|
||||||
release.Seeders = int.Parse(qRow.Find("td.table_seeders").Text().Trim());
|
release.Seeders = int.Parse(qRow.Find("td.table_seeders").Text().Trim(), NumberStyles.AllowThousands);
|
||||||
release.Peers = int.Parse(qRow.Find("td.table_leechers").Text().Trim()) + release.Seeders;
|
release.Peers = int.Parse(qRow.Find("td.table_leechers").Text().Trim(), NumberStyles.AllowThousands) + release.Seeders;
|
||||||
|
|
||||||
var sizeCol = qRow.Find("td.table_size")[0];
|
var sizeCol = qRow.Find("td.table_size")[0];
|
||||||
var sizeVal = float.Parse(sizeCol.ChildNodes[0].NodeValue.Trim());
|
var sizeVal = float.Parse(sizeCol.ChildNodes[0].NodeValue.Trim());
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
@@ -27,7 +28,6 @@ namespace Jackett.Indexers
|
|||||||
|
|
||||||
static string chromeUserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36";
|
static string chromeUserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36";
|
||||||
|
|
||||||
|
|
||||||
static string BaseUrl = "https://iptorrents.com";
|
static string BaseUrl = "https://iptorrents.com";
|
||||||
|
|
||||||
string SearchUrl = BaseUrl + "/t?q=";
|
string SearchUrl = BaseUrl + "/t?q=";
|
||||||
@@ -177,8 +177,8 @@ namespace Jackett.Indexers
|
|||||||
var sizeUnit = sizeStr.Split(' ')[1];
|
var sizeUnit = sizeStr.Split(' ')[1];
|
||||||
release.Size = ReleaseInfo.GetBytes(sizeUnit, sizeVal);
|
release.Size = ReleaseInfo.GetBytes(sizeUnit, sizeVal);
|
||||||
|
|
||||||
release.Seeders = int.Parse(qRow.Find(".t_seeders").Text().Trim());
|
release.Seeders = int.Parse(qRow.Find(".t_seeders").Text().Trim(), NumberStyles.AllowThousands);
|
||||||
release.Peers = int.Parse(qRow.Find(".t_leechers").Text().Trim()) + release.Seeders;
|
release.Peers = int.Parse(qRow.Find(".t_leechers").Text().Trim(), NumberStyles.AllowThousands) + release.Seeders;
|
||||||
|
|
||||||
releases.Add(release);
|
releases.Add(release);
|
||||||
}
|
}
|
||||||
|
@@ -14,22 +14,6 @@ namespace Jackett.Indexers
|
|||||||
public class Strike : IndexerInterface
|
public class Strike : IndexerInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
class StrikeConfig : ConfigurationData
|
|
||||||
{
|
|
||||||
public StringItem Url { get; private set; }
|
|
||||||
|
|
||||||
public StrikeConfig()
|
|
||||||
{
|
|
||||||
Url = new StringItem { Name = "Url", Value = DefaultUrl };
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Item[] GetItems()
|
|
||||||
{
|
|
||||||
return new Item[] { Url };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
|
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
|
||||||
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
|
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
|
||||||
|
|
||||||
@@ -75,17 +59,16 @@ namespace Jackett.Indexers
|
|||||||
|
|
||||||
public Task<ConfigurationData> GetConfigurationForSetup()
|
public Task<ConfigurationData> GetConfigurationForSetup()
|
||||||
{
|
{
|
||||||
var config = new StrikeConfig();
|
var config = new ConfigurationDataUrl(DefaultUrl);
|
||||||
return Task.FromResult<ConfigurationData>(config);
|
return Task.FromResult<ConfigurationData>(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ApplyConfiguration(JToken configJson)
|
public async Task ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
var config = new StrikeConfig();
|
var config = new ConfigurationDataUrl(DefaultUrl);
|
||||||
config.LoadValuesFromJson(configJson);
|
config.LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var uri = new Uri(config.Url.Value);
|
var formattedUrl = config.GetFormattedHostUrl();
|
||||||
var formattedUrl = string.Format("{0}://{1}", uri.Scheme, uri.Host);
|
|
||||||
var releases = await PerformQuery(new TorznabQuery(), formattedUrl);
|
var releases = await PerformQuery(new TorznabQuery(), formattedUrl);
|
||||||
if (releases.Length == 0)
|
if (releases.Length == 0)
|
||||||
throw new Exception("Could not find releases from this URL");
|
throw new Exception("Could not find releases from this URL");
|
||||||
|
@@ -16,21 +16,6 @@ namespace Jackett.Indexers
|
|||||||
public class ThePirateBay : IndexerInterface
|
public class ThePirateBay : IndexerInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
class ThePirateBayConfig : ConfigurationData
|
|
||||||
{
|
|
||||||
public StringItem Url { get; private set; }
|
|
||||||
|
|
||||||
public ThePirateBayConfig()
|
|
||||||
{
|
|
||||||
Url = new StringItem { Name = "Url", Value = DefaultUrl };
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Item[] GetItems()
|
|
||||||
{
|
|
||||||
return new Item[] { Url };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
|
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
|
||||||
|
|
||||||
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
|
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
|
||||||
@@ -54,7 +39,6 @@ namespace Jackett.Indexers
|
|||||||
HttpClientHandler handler;
|
HttpClientHandler handler;
|
||||||
HttpClient client;
|
HttpClient client;
|
||||||
|
|
||||||
|
|
||||||
public ThePirateBay()
|
public ThePirateBay()
|
||||||
{
|
{
|
||||||
IsConfigured = false;
|
IsConfigured = false;
|
||||||
@@ -70,17 +54,16 @@ namespace Jackett.Indexers
|
|||||||
|
|
||||||
public Task<ConfigurationData> GetConfigurationForSetup()
|
public Task<ConfigurationData> GetConfigurationForSetup()
|
||||||
{
|
{
|
||||||
var config = new ThePirateBayConfig();
|
var config = new ConfigurationDataUrl(DefaultUrl);
|
||||||
return Task.FromResult<ConfigurationData>(config);
|
return Task.FromResult<ConfigurationData>(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ApplyConfiguration(JToken configJson)
|
public async Task ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
var config = new ThePirateBayConfig();
|
var config = new ConfigurationDataUrl(DefaultUrl);
|
||||||
config.LoadValuesFromJson(configJson);
|
config.LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var uri = new Uri(config.Url.Value);
|
var formattedUrl = config.GetFormattedHostUrl();
|
||||||
var formattedUrl = string.Format("{0}://{1}", uri.Scheme, uri.Host);
|
|
||||||
var releases = await PerformQuery(new TorznabQuery(), formattedUrl);
|
var releases = await PerformQuery(new TorznabQuery(), formattedUrl);
|
||||||
if (releases.Length == 0)
|
if (releases.Length == 0)
|
||||||
throw new Exception("Could not find releases from this URL");
|
throw new Exception("Could not find releases from this URL");
|
||||||
@@ -94,7 +77,6 @@ namespace Jackett.Indexers
|
|||||||
OnSaveConfigurationRequested(this, configSaveData);
|
OnSaveConfigurationRequested(this, configSaveData);
|
||||||
|
|
||||||
IsConfigured = true;
|
IsConfigured = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadFromSavedConfiguration(JToken jsonConfig)
|
public void LoadFromSavedConfiguration(JToken jsonConfig)
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
@@ -125,6 +126,7 @@ namespace Jackett.Indexers
|
|||||||
release.MinimumRatio = 1;
|
release.MinimumRatio = 1;
|
||||||
release.MinimumSeedTime = 172800;
|
release.MinimumSeedTime = 172800;
|
||||||
release.Title = qRow.Find(".torrentName").Text();
|
release.Title = qRow.Find(".torrentName").Text();
|
||||||
|
release.Description = release.Title;
|
||||||
release.Guid = new Uri(BaseUrl + "/" + qRow.Find(".torrentName").Attr("href"));
|
release.Guid = new Uri(BaseUrl + "/" + qRow.Find(".torrentName").Attr("href"));
|
||||||
release.Comments = release.Guid;
|
release.Comments = release.Guid;
|
||||||
release.Link = new Uri(BaseUrl + "/" + qRow.Find(".dlLinksInfo > a").Attr("href"));
|
release.Link = new Uri(BaseUrl + "/" + qRow.Find(".dlLinksInfo > a").Attr("href"));
|
||||||
@@ -153,8 +155,8 @@ namespace Jackett.Indexers
|
|||||||
ts = TimeSpan.FromDays(dateValue * 365);
|
ts = TimeSpan.FromDays(dateValue * 365);
|
||||||
release.PublishDate = DateTime.Now - ts;
|
release.PublishDate = DateTime.Now - ts;
|
||||||
|
|
||||||
release.Seeders = int.Parse(qRow.Find(".seedersInfo").Text());
|
release.Seeders = int.Parse(qRow.Find(".seedersInfo").Text(), NumberStyles.AllowThousands);
|
||||||
release.Peers = int.Parse(qRow.Find(".leechersInfo").Text()) + release.Seeders;
|
release.Peers = int.Parse(qRow.Find(".leechersInfo").Text(), NumberStyles.AllowThousands) + release.Seeders;
|
||||||
|
|
||||||
releases.Add(release);
|
releases.Add(release);
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
@@ -127,6 +128,7 @@ namespace Jackett.Indexers
|
|||||||
release.MinimumRatio = 1;
|
release.MinimumRatio = 1;
|
||||||
release.MinimumSeedTime = 172800;
|
release.MinimumSeedTime = 172800;
|
||||||
release.Title = qRow.Find(".torrent_name_link").Text();
|
release.Title = qRow.Find(".torrent_name_link").Text();
|
||||||
|
release.Description = release.Title;
|
||||||
release.Guid = new Uri(BaseUrl + "/" + qRow.Find(".torrent_name_link").Parent().Attr("href"));
|
release.Guid = new Uri(BaseUrl + "/" + qRow.Find(".torrent_name_link").Parent().Attr("href"));
|
||||||
release.Comments = release.Guid;
|
release.Comments = release.Guid;
|
||||||
release.Link = new Uri(BaseUrl + "/" + qRow.Find(".torrent_handle_links > a").First().Attr("href"));
|
release.Link = new Uri(BaseUrl + "/" + qRow.Find(".torrent_handle_links > a").First().Attr("href"));
|
||||||
@@ -154,8 +156,8 @@ namespace Jackett.Indexers
|
|||||||
var sizeStr = qRow.Find(".size")[0].ChildNodes[0].NodeValue.Trim();
|
var sizeStr = qRow.Find(".size")[0].ChildNodes[0].NodeValue.Trim();
|
||||||
var sizeParts = sizeStr.Split(' ');
|
var sizeParts = sizeStr.Split(' ');
|
||||||
release.Size = ReleaseInfo.GetBytes(sizeParts[1], float.Parse(sizeParts[0]));
|
release.Size = ReleaseInfo.GetBytes(sizeParts[1], float.Parse(sizeParts[0]));
|
||||||
release.Seeders = int.Parse(qRow.Children().ElementAt(6).InnerText.Trim());
|
release.Seeders = int.Parse(qRow.Children().ElementAt(6).InnerText.Trim(), NumberStyles.AllowThousands);
|
||||||
release.Peers = int.Parse(qRow.Children().ElementAt(7).InnerText.Trim()) + release.Seeders;
|
release.Peers = int.Parse(qRow.Children().ElementAt(7).InnerText.Trim(), NumberStyles.AllowThousands) + release.Seeders;
|
||||||
|
|
||||||
releases.Add(release);
|
releases.Add(release);
|
||||||
}
|
}
|
||||||
|
@@ -84,6 +84,7 @@
|
|||||||
<Compile Include="ChannelInfo.cs" />
|
<Compile Include="ChannelInfo.cs" />
|
||||||
<Compile Include="ConfigurationData.cs" />
|
<Compile Include="ConfigurationData.cs" />
|
||||||
<Compile Include="ConfigurationDataBasicLogin.cs" />
|
<Compile Include="ConfigurationDataBasicLogin.cs" />
|
||||||
|
<Compile Include="ConfigurationDataUrl.cs" />
|
||||||
<Compile Include="CookieContainerExtensions.cs" />
|
<Compile Include="CookieContainerExtensions.cs" />
|
||||||
<Compile Include="DataUrl.cs" />
|
<Compile Include="DataUrl.cs" />
|
||||||
<Compile Include="ExceptionWithConfigData.cs" />
|
<Compile Include="ExceptionWithConfigData.cs" />
|
||||||
@@ -94,6 +95,7 @@
|
|||||||
<Compile Include="Indexers\Freshon.cs" />
|
<Compile Include="Indexers\Freshon.cs" />
|
||||||
<Compile Include="Indexers\IPTorrents.cs" />
|
<Compile Include="Indexers\IPTorrents.cs" />
|
||||||
<Compile Include="Indexers\MoreThanTV.cs" />
|
<Compile Include="Indexers\MoreThanTV.cs" />
|
||||||
|
<Compile Include="Indexers\Rarbg.cs" />
|
||||||
<Compile Include="Indexers\Strike.cs" />
|
<Compile Include="Indexers\Strike.cs" />
|
||||||
<Compile Include="Indexers\ThePirateBay.cs" />
|
<Compile Include="Indexers\ThePirateBay.cs" />
|
||||||
<Compile Include="Indexers\TorrentDay.cs" />
|
<Compile Include="Indexers\TorrentDay.cs" />
|
||||||
|
@@ -69,16 +69,16 @@ namespace Jackett
|
|||||||
select new XElement("item",
|
select new XElement("item",
|
||||||
new XElement("title", r.Title),
|
new XElement("title", r.Title),
|
||||||
new XElement("guid", r.Guid),
|
new XElement("guid", r.Guid),
|
||||||
new XElement("comments", r.Comments.ToString()),
|
r.Comments == null ? null : new XElement("comments", r.Comments.ToString()),
|
||||||
new XElement("pubDate", xmlDateFormat(r.PublishDate)),
|
r.PublishDate == DateTime.MinValue ? null : new XElement("pubDate", xmlDateFormat(r.PublishDate)),
|
||||||
new XElement("size", r.Size),
|
r.Size == null ? null : new XElement("size", r.Size),
|
||||||
new XElement("description", r.Description),
|
new XElement("description", r.Description),
|
||||||
new XElement("link", r.Link ?? r.MagnetUri),
|
new XElement("link", r.Link ?? r.MagnetUri),
|
||||||
r.Category == null ? null : new XElement("category", r.Category),
|
r.Category == null ? null : new XElement("category", r.Category),
|
||||||
new XElement(
|
new XElement(
|
||||||
"enclosure",
|
"enclosure",
|
||||||
new XAttribute("url", r.Link ?? r.MagnetUri),
|
new XAttribute("url", r.Link ?? r.MagnetUri),
|
||||||
new XAttribute("length", r.Size),
|
r.Size == null ? null : new XAttribute("length", r.Size),
|
||||||
new XAttribute("type", "application/x-bittorrent")
|
new XAttribute("type", "application/x-bittorrent")
|
||||||
),
|
),
|
||||||
getTorznabElement("magneturl", r.MagnetUri),
|
getTorznabElement("magneturl", r.MagnetUri),
|
||||||
|
Reference in New Issue
Block a user