mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Fixed curl not being referenced correctly, fixed missing Strike.cs file
This commit is contained in:
@@ -30,6 +30,7 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<ConsolePause>false</ConsolePause>
|
<ConsolePause>false</ConsolePause>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DefineConstants>LINUX</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
161
src/Jackett/Indexers/Strike.cs
Normal file
161
src/Jackett/Indexers/Strike.cs
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
|
namespace Jackett.Indexers
|
||||||
|
{
|
||||||
|
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 string DisplayName
|
||||||
|
{
|
||||||
|
get { return "Strike"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string DisplayDescription
|
||||||
|
{
|
||||||
|
get { return "Torrent search engine"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Uri SiteLink
|
||||||
|
{
|
||||||
|
get { return new Uri(DefaultUrl); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsConfigured { get; private set; }
|
||||||
|
|
||||||
|
const string DefaultUrl = "https://getstrike.net";
|
||||||
|
|
||||||
|
const string DownloadUrl = "/api/v2/torrents/download/?hash={0}";
|
||||||
|
const string SearchUrl = "/api/v2/torrents/search/?category=TV&phrase={0}";
|
||||||
|
string BaseUrl;
|
||||||
|
|
||||||
|
CookieContainer cookies;
|
||||||
|
HttpClientHandler handler;
|
||||||
|
HttpClient client;
|
||||||
|
|
||||||
|
public Strike()
|
||||||
|
{
|
||||||
|
IsConfigured = false;
|
||||||
|
cookies = new CookieContainer();
|
||||||
|
handler = new HttpClientHandler
|
||||||
|
{
|
||||||
|
CookieContainer = cookies,
|
||||||
|
AllowAutoRedirect = true,
|
||||||
|
UseCookies = true,
|
||||||
|
};
|
||||||
|
client = new HttpClient(handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<ConfigurationData> GetConfigurationForSetup()
|
||||||
|
{
|
||||||
|
var config = new StrikeConfig();
|
||||||
|
return Task.FromResult<ConfigurationData>(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task ApplyConfiguration(JToken configJson)
|
||||||
|
{
|
||||||
|
var config = new StrikeConfig();
|
||||||
|
config.LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
|
var uri = new Uri(config.Url.Value);
|
||||||
|
var formattedUrl = string.Format("{0}://{1}", uri.Scheme, uri.Host);
|
||||||
|
var releases = await PerformQuery(new TorznabQuery(), formattedUrl);
|
||||||
|
if (releases.Length == 0)
|
||||||
|
throw new Exception("Could not find releases from this URL");
|
||||||
|
|
||||||
|
BaseUrl = formattedUrl;
|
||||||
|
|
||||||
|
var configSaveData = new JObject();
|
||||||
|
configSaveData["base_url"] = BaseUrl;
|
||||||
|
|
||||||
|
if (OnSaveConfigurationRequested != null)
|
||||||
|
OnSaveConfigurationRequested(this, configSaveData);
|
||||||
|
|
||||||
|
IsConfigured = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadFromSavedConfiguration(JToken jsonConfig)
|
||||||
|
{
|
||||||
|
BaseUrl = (string)jsonConfig["base_url"];
|
||||||
|
IsConfigured = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ReleaseInfo[]> PerformQuery(TorznabQuery query, string baseUrl)
|
||||||
|
{
|
||||||
|
List<ReleaseInfo> releases = new List<ReleaseInfo>();
|
||||||
|
|
||||||
|
foreach (var title in query.ShowTitles ?? new string[] { "2015" })
|
||||||
|
{
|
||||||
|
var searchString = title + " " + query.GetEpisodeSearchString();
|
||||||
|
var episodeSearchUrl = baseUrl + string.Format(SearchUrl, HttpUtility.UrlEncode(searchString.Trim()));
|
||||||
|
var results = await client.GetStringAsync(episodeSearchUrl);
|
||||||
|
var jResults = JObject.Parse(results);
|
||||||
|
foreach (JObject result in (JArray)jResults["torrents"])
|
||||||
|
{
|
||||||
|
var release = new ReleaseInfo();
|
||||||
|
|
||||||
|
release.MinimumRatio = 1;
|
||||||
|
release.MinimumSeedTime = 172800;
|
||||||
|
|
||||||
|
release.Title = (string)result["torrent_title"];
|
||||||
|
release.Description = release.Title;
|
||||||
|
release.Seeders = (int)result["seeds"];
|
||||||
|
release.Peers = (int)result["leeches"] + release.Seeders;
|
||||||
|
release.Size = (long)result["size"];
|
||||||
|
|
||||||
|
// "Apr 2, 2015", "Apr 12, 2015" (note the spacing)
|
||||||
|
var dateString = string.Join(" ", ((string)result["upload_date"]).Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries));
|
||||||
|
release.PublishDate = DateTime.ParseExact(dateString, "MMM d, yyyy", CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
|
release.Guid = new Uri((string)result["page"]);
|
||||||
|
release.Comments = release.Guid;
|
||||||
|
|
||||||
|
release.InfoHash = (string)result["torrent_hash"];
|
||||||
|
release.MagnetUri = new Uri((string)result["magnet_uri"]);
|
||||||
|
release.Link = new Uri(string.Format("{0}{1}{2}", baseUrl, DownloadUrl, release.InfoHash));
|
||||||
|
|
||||||
|
releases.Add(release);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return releases.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ReleaseInfo[]> PerformQuery(TorznabQuery query)
|
||||||
|
{
|
||||||
|
return await PerformQuery(query, BaseUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<byte[]> Download(Uri link)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -139,6 +139,9 @@
|
|||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Include="WebContent\logos\torrentshack.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="jacket_large.ico" />
|
<Content Include="jacket_large.ico" />
|
||||||
<Content Include="WebContent\animate.css">
|
<Content Include="WebContent\animate.css">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
@@ -63,7 +63,7 @@ namespace Jackett
|
|||||||
if (ex.ErrorCode == 5)
|
if (ex.ErrorCode == 5)
|
||||||
{
|
{
|
||||||
var errorStr = "App must be ran as admin for permission to use port "
|
var errorStr = "App must be ran as admin for permission to use port "
|
||||||
+ Port + Environment.NewLine + "Restart app with admin privileges?";
|
+ Port + Environment.NewLine + "Restart app with admin privileges?";
|
||||||
if (Program.IsWindows)
|
if (Program.IsWindows)
|
||||||
{
|
{
|
||||||
var dialogResult = MessageBox.Show(errorStr, "Error", MessageBoxButtons.YesNo);
|
var dialogResult = MessageBox.Show(errorStr, "Error", MessageBoxButtons.YesNo);
|
||||||
@@ -89,16 +89,6 @@ namespace Jackett
|
|||||||
|
|
||||||
Program.LoggerInstance.Info("Server started on port " + Port);
|
Program.LoggerInstance.Info("Server started on port " + Port);
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
#if !DEBUG
|
|
||||||
Process.Start("http://127.0.0.1:" + Port);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
Exception error = null;
|
Exception error = null;
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
margin-bottom: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container-fluid {
|
.container-fluid {
|
||||||
|
Reference in New Issue
Block a user