Merge v0.6.4

This commit is contained in:
KZ
2015-09-06 22:52:52 +01:00
20 changed files with 2363 additions and 1903 deletions

View File

@@ -20,6 +20,7 @@ We were previously focused on TV but are working on extending searches to allow
#### Supported Trackers #### Supported Trackers
* [AlphaRatio](https://alpharatio.cc/) * [AlphaRatio](https://alpharatio.cc/)
* [AnimeBytes](https://animebytes.tv/) * [AnimeBytes](https://animebytes.tv/)
* [AnimeTorrents](http://animetorrents.me/)
* [Avistaz](https://avistaz.to/) * [Avistaz](https://avistaz.to/)
* [BakaBT](http://bakabt.me/) * [BakaBT](http://bakabt.me/)
* [bB](http://reddit.com/r/baconbits) * [bB](http://reddit.com/r/baconbits)
@@ -59,7 +60,7 @@ We were previously focused on TV but are working on extending searches to allow
* Debian/Ubunutu: apt-get install libcurl-dev * Debian/Ubunutu: apt-get install libcurl-dev
* Redhat/Fedora: yum install libcurl-devel * Redhat/Fedora: yum install libcurl-devel
* For other distros see the [Curl docs](http://curl.haxx.se/dlwiz/?type=devel). * For other distros see the [Curl docs](http://curl.haxx.se/dlwiz/?type=devel).
3. Download and extract the latest ```.tar.bz2``` release from the [website](http://jackett.net/Download) and run Jackett using mono with the command "mono JackettConsole.exe". 3. Download and extract the latest ```.tar.bz2``` release from the [website](http://jackett.net/Download) and run Jackett using mono with the command "mono JackettConsole.exe".
#### Installation on Windows #### Installation on Windows

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -121,25 +121,30 @@ namespace Jackett.Controllers
var potatoResponse = new TorrentPotatoResponse(); var potatoResponse = new TorrentPotatoResponse();
releases = TorznabUtil.FilterResultsToTitle(releases, torznabQuery.SanitizedSearchTerm, year); releases = TorznabUtil.FilterResultsToTitle(releases, torznabQuery.SanitizedSearchTerm, year);
releases = TorznabUtil.FilterResultsToImdb(releases, request.imdbid);
foreach (var r in releases) foreach (var r in releases)
{ {
var release = Mapper.Map<ReleaseInfo>(r); var release = Mapper.Map<ReleaseInfo>(r);
release.Link = serverService.ConvertToProxyLink(release.Link, serverUrl, indexerID); release.Link = serverService.ConvertToProxyLink(release.Link, serverUrl, indexerID);
potatoResponse.results.Add(new TorrentPotatoResponseItem() // Only accept torrent links, magnet is not supported
if (release.Link != null)
{ {
release_name = release.Title + "[" + indexer.DisplayName + "]", // Suffix the indexer so we can see which tracker we are using in CPS as it just says torrentpotato >.> potatoResponse.results.Add(new TorrentPotatoResponseItem()
torrent_id = release.Guid.ToString(), {
details_url = release.Comments.ToString(), release_name = release.Title + "[" + indexer.DisplayName + "]", // Suffix the indexer so we can see which tracker we are using in CPS as it just says torrentpotato >.>
download_url = release.Link.ToString(), torrent_id = release.Guid.ToString(),
// imdb_id = request.imdbid, details_url = release.Comments.ToString(),
freeleech = false, download_url = release.Link.ToString(),
type = "movie", imdb_id = release.Imdb.HasValue ? "tt" + release.Imdb : null,
size = (long)release.Size/ (1024 * 1024), // This is in MB freeleech = false,
leechers = (int)release.Peers - (int)release.Seeders, type = "movie",
seeders = (int)release.Seeders size = (long)release.Size / (1024 * 1024), // This is in MB
}); leechers = (int)release.Peers - (int)release.Seeders,
seeders = (int)release.Seeders
});
}
} }
// Log info // Log info

View File

@@ -0,0 +1,176 @@
using CsQuery;
using Jackett.Models;
using Jackett.Services;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using Jackett.Models.IndexerConfig;
using System.Collections.Specialized;
using System.Globalization;
namespace Jackett.Indexers
{
public class AnimeTorrents : BaseIndexer, IIndexer
{
private string LoginUrl { get { return SiteLink + "login.php"; } }
private string SearchUrl { get { return SiteLink + "ajax/torrents_data.php"; } }
private string SearchUrlReferer { get { return SiteLink + "torrents.php?cat=0&searchin=filename&search="; } }
new ConfigurationDataBasicLogin configData
{
get { return (ConfigurationDataBasicLogin)base.configData; }
set { base.configData = value; }
}
public AnimeTorrents(IIndexerManagerService i, HttpWebClient c, Logger l, IProtectionService ps)
: base(name: "AnimeTorrents",
description: "Definitive source for anime and manga",
link: "http://animetorrents.me/",
caps: new TorznabCapabilities(),
manager: i,
client: c, // Forced HTTP client for custom headers
logger: l,
p: ps,
configData: new ConfigurationDataBasicLogin())
{
AddCategoryMapping(1, TorznabCatType.MoviesSD); // Anime Movie
AddCategoryMapping(6, TorznabCatType.MoviesHD); // Anime Movie HD
AddCategoryMapping(2, TorznabCatType.TVAnime); // Anime Series
AddCategoryMapping(7, TorznabCatType.TVAnime); // Anime Series HD
AddCategoryMapping(5, TorznabCatType.XXXDVD); // Hentai (censored)
AddCategoryMapping(9, TorznabCatType.XXXDVD); // Hentai (censored) HD
AddCategoryMapping(4, TorznabCatType.XXXDVD); // Hentai (un-censored)
AddCategoryMapping(8, TorznabCatType.XXXDVD); // Hentai (un-censored) HD
AddCategoryMapping(13, TorznabCatType.BooksForeign); // Light Novel
AddCategoryMapping(3, TorznabCatType.BooksComics); // Manga
AddCategoryMapping(10, TorznabCatType.BooksComics); // Manga 18+
AddCategoryMapping(11, TorznabCatType.TVAnime); // OVA
AddCategoryMapping(12, TorznabCatType.TVAnime); // OVA HD
AddCategoryMapping(14, TorznabCatType.BooksComics); // Doujin Anime
AddCategoryMapping(15, TorznabCatType.XXXDVD); // Doujin Anime 18+
AddCategoryMapping(16, TorznabCatType.AudioForeign); // Doujin Music
AddCategoryMapping(17, TorznabCatType.BooksComics); // Doujinshi
AddCategoryMapping(18, TorznabCatType.BooksComics); // Doujinshi 18+
AddCategoryMapping(19, TorznabCatType.Audio); // OST
}
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
{
configData.LoadValuesFromJson(configJson);
var pairs = new Dictionary<string, string> {
{ "username", configData.Username.Value },
{ "password", configData.Password.Value },
{ "form", "login" },
{ "rememberme[]", "1" }
};
var loginPage = await RequestStringWithCookiesAndRetry(LoginUrl, null, null);
var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, loginPage.Cookies, true, SearchUrl, SiteLink);
await ConfigureIfOK(result.Cookies, result.Content != null && result.Content.Contains("logout.php"), () =>
{
CQ dom = result.Content;
var errorMessage = dom[".ui-state-error"].Text().Trim();
throw new ExceptionWithConfigData(errorMessage, configData);
});
return IndexerConfigurationStatus.RequiresTesting;
}
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
var releases = new List<ReleaseInfo>();
var searchString = query.GetQueryString();
var searchUrl = SearchUrl;
var queryCollection = new NameValueCollection();
queryCollection.Add("total", "146"); // Not sure what this is about but its required!
var cat = "0";
var queryCats = MapTorznabCapsToTrackers(query);
if (queryCats.Count == 1)
{
cat = queryCats.First().ToString();
}
queryCollection.Add("cat", cat);
queryCollection.Add("searchin", "filename");
queryCollection.Add("search", searchString);
queryCollection.Add("page", "1");
searchUrl += "?" + queryCollection.GetQueryString();
var extraHeaders = new Dictionary<string, string>()
{
{ "X-Requested-With", "XMLHttpRequest" }
};
var response = await RequestStringWithCookiesAndRetry(searchUrl, null, SearchUrlReferer, extraHeaders);
var results = response.Content;
try
{
CQ dom = results;
var rows = dom["tr"];
foreach (var row in rows.Skip(1))
{
var release = new ReleaseInfo();
var qRow = row.Cq();
var qTitleLink = qRow.Find("td:eq(1) a:eq(0)").First();
release.Title = qTitleLink.Find("strong").Text().Trim();
// If we search an get no results, we still get a table just with no info.
if (string.IsNullOrWhiteSpace(release.Title))
{
break;
}
release.Description = release.Title;
release.Guid = new Uri(qTitleLink.Attr("href"));
release.Comments = release.Guid;
var dateString = qRow.Find("td:eq(4)").Text();
release.PublishDate = DateTime.ParseExact(dateString, "dd MMM yy", CultureInfo.InvariantCulture);
var qLink = qRow.Find("td:eq(2) a");
release.Link = new Uri(qLink.Attr("href"));
var sizeStr = qRow.Find("td:eq(5)").Text();
release.Size = ReleaseInfo.GetBytes(sizeStr);
var connections = qRow.Find("td:eq(7)").Text().Trim().Split("/".ToCharArray(),StringSplitOptions.RemoveEmptyEntries);
release.Seeders = ParseUtil.CoerceInt(connections[0].Trim());
release.Peers = ParseUtil.CoerceInt(connections[1].Trim()) + release.Seeders;
var rCat = row.Cq().Find("td:eq(0) a").First().Attr("href");
var rCatIdx = rCat.IndexOf("cat=");
if (rCatIdx > -1)
{
rCat = rCat.Substring(rCatIdx + 4);
}
release.Category = MapTrackerCatToNewznab(rCat);
releases.Add(release);
}
}
catch (Exception ex)
{
OnParseError(results, ex);
}
return releases;
}
}
}

View File

@@ -246,14 +246,15 @@ namespace Jackett.Indexers
throw lastException; throw lastException;
} }
protected async Task<WebClientStringResult> RequestStringWithCookies(string url, string cookieOverride = null, string referer = null) protected async Task<WebClientStringResult> RequestStringWithCookies(string url, string cookieOverride = null, string referer = null, Dictionary<string, string> headers = null)
{ {
var request = new Utils.Clients.WebRequest() var request = new Utils.Clients.WebRequest()
{ {
Url = url, Url = url,
Type = RequestType.GET, Type = RequestType.GET,
Cookies = CookieHeader, Cookies = CookieHeader,
Referer = referer Referer = referer,
Headers = headers
}; };
if (cookieOverride != null) if (cookieOverride != null)
@@ -261,14 +262,14 @@ namespace Jackett.Indexers
return await webclient.GetString(request); return await webclient.GetString(request);
} }
protected async Task<WebClientStringResult> RequestStringWithCookiesAndRetry(string url, string cookieOverride = null, string referer = null) protected async Task<WebClientStringResult> RequestStringWithCookiesAndRetry(string url, string cookieOverride = null, string referer = null, Dictionary<string,string> headers = null)
{ {
Exception lastException = null; Exception lastException = null;
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
try try
{ {
return await RequestStringWithCookies(url, cookieOverride, referer); return await RequestStringWithCookies(url, cookieOverride, referer, headers);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@@ -0,0 +1,213 @@
using CsQuery;
using Jackett.Indexers;
using Jackett.Models;
using Jackett.Services;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.UI.WebControls;
using Jackett.Models.IndexerConfig;
namespace Jackett.Indexers
{
public class NxtGn : BaseIndexer, IIndexer
{
private string LoginUrl { get { return SiteLink + "login.php"; } }
private string SearchUrl { get { return SiteLink + "browse.php"; } }
private string ProfileUrl { get { return SiteLink + "my.php"; } }
new ConfigurationDataBasicLoginWithRSS configData
{
get { return (ConfigurationDataBasicLoginWithRSS)base.configData; }
set { base.configData = value; }
}
public NxtGn(IIndexerManagerService i, Logger l, IWebClient c, IProtectionService ps)
: base(name: "NextGen",
description: "A danish closed torrent tracker",
link: "https://nxtgn.org/",
caps: TorznabUtil.CreateDefaultTorznabTVCaps(),
manager: i,
client: c,
logger: l,
p: ps,
configData: new ConfigurationDataBasicLoginWithRSS())
{
AddCategoryMapping(47, TorznabCatType.Movies3D);
AddCategoryMapping(38, TorznabCatType.MoviesHD);
AddCategoryMapping(38, TorznabCatType.MoviesWEBDL);
AddCategoryMapping(38, TorznabCatType.MoviesBluRay);
AddCategoryMapping(5, TorznabCatType.MoviesSD);
AddCategoryMapping(23, TorznabCatType.MoviesForeign);
AddCategoryMapping(22, TorznabCatType.MoviesSD);
//AddCategoryMapping(4, TorznabCatType.TVFOREIGN);
//AddCategoryMapping(4, TorznabCatType.TVSD);
//AddCategoryMapping(4, TorznabCatType.TVDocumentary);
//AddCategoryMapping(4, TorznabCatType.TVSport);
//AddCategoryMapping(4, TorznabCatType.TV);
//AddCategoryMapping(31, TorznabCatType.TVHD);
//AddCategoryMapping(21, TorznabCatType.TVFOREIGN);
AddCategoryMapping(46, TorznabCatType.TV);
AddCategoryMapping(46, TorznabCatType.TVHD);
//AddCategoryMapping(45, TorznabCatType.TV);
//AddCategoryMapping(45, TorznabCatType.TVSD);
//AddCategoryMapping(24, TorznabCatType.TVFOREIGN);
AddCategoryMapping(26, TorznabCatType.TV);
AddCategoryMapping(26, TorznabCatType.TVHD);
AddCategoryMapping(26, TorznabCatType.TVWEBDL);
AddCategoryMapping(33, TorznabCatType.MoviesHD);
AddCategoryMapping(33, TorznabCatType.Movies);
AddCategoryMapping(17, TorznabCatType.MoviesForeign);
AddCategoryMapping(17, TorznabCatType.MoviesDVD);
AddCategoryMapping(9, TorznabCatType.MoviesHD);
AddCategoryMapping(9, TorznabCatType.Movies);
AddCategoryMapping(9, TorznabCatType.MoviesBluRay);
AddCategoryMapping(43, TorznabCatType.TV);
AddCategoryMapping(43, TorznabCatType.TVHD);
AddCategoryMapping(43, TorznabCatType.TVWEBDL);
}
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
{
var loginPage = await RequestStringWithCookies(LoginUrl);
CQ loginDom = loginPage.Content;
var loginPostUrl = loginDom["#login"].Attr("action");
configData.LoadValuesFromJson(configJson);
var pairs = new Dictionary<string, string> {
{ "username", configData.Username.Value },
{ "password", configData.Password.Value }
};
// Get inital cookies
CookieHeader = string.Empty;
var response = await RequestLoginAndFollowRedirect(SiteLink + loginPostUrl, pairs, CookieHeader, true, null, LoginUrl);
await ConfigureIfOK(response.Cookies, response.Content != null && response.Content.Contains("Velkommen tilbage"), () =>
{
CQ dom = response.Content;
var messageEl = dom["inputs"];
var errorMessage = messageEl.Text().Trim();
throw new ExceptionWithConfigData(errorMessage, configData);
});
var profilePage = await RequestStringWithCookies(ProfileUrl, response.Cookies);
CQ profileDom = profilePage.Content;
var passKey = profileDom["input[name=resetkey]"].Parent().Text();
passKey = passKey.Substring(0, passKey.IndexOf(' '));
configData.RSSKey.Value = passKey;
SaveConfig();
return IndexerConfigurationStatus.RequiresTesting;
}
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
var releases = new List<ReleaseInfo>();
var breakWhile = false;
var page = 0;
while (page < 3)
{
string episodeSearchUrl;
if (string.IsNullOrEmpty(query.GetQueryString()))
{
episodeSearchUrl = SearchUrl + "?page=" + page;
breakWhile = true;
}
else
{
var cats = MapTorznabCapsToTrackers(query);
var catsUrlPart = string.Join("&", cats.Select(c => $"c{c}=1"));
episodeSearchUrl = string.Format("{0}?search={1}&cat=0&incldead=0&{2}&page={3}", SearchUrl, HttpUtility.UrlEncode(query.GetQueryString()), catsUrlPart, page);
}
page++;
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{
CQ dom = results.Content;
var rows = dom["#torrent-table-wrapper > div"];
foreach (var row in rows.Skip(1))
{
var release = new ReleaseInfo();
var qRow = row.Cq();
var qLink = qRow.Find("#torrent-udgivelse2-users > a").First();
var qDesc = qRow.Find("#torrent-udgivelse2-users > p").FirstOrDefault();
var moviesCats = new[] { 47, 38, 5, 23, 22, 33, 17, 9 };
var seriesCats = new[] { 46, 26, 43 };
var catUrl = qRow.Find(".torrent-icon > a").Attr("href");
var cat = catUrl.Substring(catUrl.LastIndexOf('=') + 1);
var catNo = int.Parse(cat);
if (moviesCats.Contains(catNo))
release.Category = TorznabCatType.Movies.ID;
else if (seriesCats.Contains(catNo))
release.Category = TorznabCatType.TV.ID;
else
continue;
releases.Add(release);
var torrentUrl = qLink.Attr("href");
var torrentId = torrentUrl.Substring(torrentUrl.LastIndexOf('=') + 1);
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
release.Title = qLink.Attr("title");
release.Description = qDesc != null ? qDesc.InnerText : release.Title;
release.Guid = new Uri(SiteLink + torrentUrl);
release.Comments = new Uri(release.Guid + "#startcomments");
var downloadUrl = $"{SiteLink}download.php?id={torrentId}&rss&passkey={configData.RSSKey.Value}";
release.Link = new Uri(downloadUrl);
var qAdded = qRow.Find("#torrent-added").First();
var addedStr = qAdded.Text().Trim();
release.PublishDate = DateTime.ParseExact(addedStr, "dd-MM-yyyyHH:mm:ss", CultureInfo.InvariantCulture);
release.Seeders = ParseUtil.CoerceInt(qRow.Find("#torrent-seeders").Text().Trim());
release.Peers = ParseUtil.CoerceInt(qRow.Find("#torrent-leechers").Text().Trim()) + release.Seeders;
var sizeStr = qRow.Find("#torrent-size").First().Text();
release.Size = ReleaseInfo.GetBytes(sizeStr);
var infoLink = qRow.Find("#infolink");
var linkContainer = infoLink.Children().First().Children().First();
var url = linkContainer.Attr("href");
var img = linkContainer.Children().First();
var imgUrl = img.Attr("src");
if (imgUrl == "/pic/imdb.png")
{
release.Imdb = long.Parse(url.Substring(url.LastIndexOf('t') + 1));
}
else if (imgUrl == "/pic/TV.png")
{
release.TheTvDbId = long.Parse(url.Substring(url.LastIndexOf('=') + 1));
}
}
var nextPage = dom["#torrent-table-wrapper + p[align=center]"].Children().Last();
if (!nextPage.Is("a"))
breakWhile = true;
}
catch (Exception ex)
{
OnParseError(results.Content, ex);
}
if (breakWhile)
break;
}
return releases;
}
}
}

View File

@@ -117,6 +117,7 @@ namespace Jackett.Indexers
SaveConfig(); SaveConfig();
IsConfigured = true; IsConfigured = true;
return IndexerConfigurationStatus.Completed;
} }
catch (Exception e) catch (Exception e)
{ {

View File

@@ -185,6 +185,7 @@
<Compile Include="Indexers\BitMeTV.cs" /> <Compile Include="Indexers\BitMeTV.cs" />
<Compile Include="Indexers\Demonoid.cs" /> <Compile Include="Indexers\Demonoid.cs" />
<Compile Include="Indexers\FrenchTorrentDb.cs" /> <Compile Include="Indexers\FrenchTorrentDb.cs" />
<Compile Include="Indexers\NxtGn.cs" />
<Compile Include="Indexers\Freshon.cs" /> <Compile Include="Indexers\Freshon.cs" />
<Compile Include="Indexers\HDSpace.cs" /> <Compile Include="Indexers\HDSpace.cs" />
<Compile Include="Indexers\HDTorrents.cs" /> <Compile Include="Indexers\HDTorrents.cs" />
@@ -192,6 +193,7 @@
<Compile Include="Indexers\ImmortalSeed.cs" /> <Compile Include="Indexers\ImmortalSeed.cs" />
<Compile Include="Indexers\FileList.cs" /> <Compile Include="Indexers\FileList.cs" />
<Compile Include="Indexers\Abstract\AvistazTracker.cs" /> <Compile Include="Indexers\Abstract\AvistazTracker.cs" />
<Compile Include="Indexers\AnimeTorrents.cs" />
<Compile Include="Models\ManualSearchResult.cs" /> <Compile Include="Models\ManualSearchResult.cs" />
<Compile Include="Indexers\Rarbg.cs" /> <Compile Include="Indexers\Rarbg.cs" />
<Compile Include="Indexers\TVChaosUK.cs" /> <Compile Include="Indexers\TVChaosUK.cs" />
@@ -408,6 +410,9 @@
<Content Include="Content\logos\animebytes.png"> <Content Include="Content\logos\animebytes.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\logos\animetorrents.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\logos\avistaz.png"> <Content Include="Content\logos\avistaz.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@@ -444,6 +449,9 @@
<Content Include="Content\logos\ncore.png"> <Content Include="Content\logos\ncore.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\logos\nxtgn.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\logos\pretome.png"> <Content Include="Content\logos\pretome.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>

View File

@@ -21,6 +21,7 @@ namespace Jackett
var thisAssembly = typeof(JackettModule).Assembly; var thisAssembly = typeof(JackettModule).Assembly;
builder.RegisterAssemblyTypes(thisAssembly).Except<IIndexer>().AsImplementedInterfaces().SingleInstance(); builder.RegisterAssemblyTypes(thisAssembly).Except<IIndexer>().AsImplementedInterfaces().SingleInstance();
builder.RegisterApiControllers(thisAssembly).InstancePerRequest(); builder.RegisterApiControllers(thisAssembly).InstancePerRequest();
builder.RegisterType<HttpWebClient>();
// Register the best web client for the platform or the override // Register the best web client for the platform or the override
switch (Startup.ClientOverride) switch (Startup.ClientOverride)

View File

@@ -21,6 +21,7 @@ namespace Jackett.Models
public long? Size { get; set; } public long? Size { get; set; }
public string Description { get; set; } public string Description { get; set; }
public long? RageID { get; set; } public long? RageID { get; set; }
public long? TheTvDbId { get; set; }
public long? Imdb { get; set; } public long? Imdb { get; set; }
public int? Seeders { get; set; } public int? Seeders { get; set; }
public int? Peers { get; set; } public int? Peers { get; set; }

View File

@@ -81,6 +81,8 @@ namespace Jackett.Models
), ),
getTorznabElement("magneturl", r.MagnetUri), getTorznabElement("magneturl", r.MagnetUri),
getTorznabElement("rageid", r.RageID), getTorznabElement("rageid", r.RageID),
getTorznabElement("thetvdb", r.TheTvDbId),
getTorznabElement("imdb", r.Imdb),
getTorznabElement("seeders", r.Seeders), getTorznabElement("seeders", r.Seeders),
getTorznabElement("peers", r.Peers), getTorznabElement("peers", r.Peers),
getTorznabElement("infohash", r.InfoHash), getTorznabElement("infohash", r.InfoHash),

View File

@@ -12,7 +12,7 @@ namespace Jackett.Models
public string torrent_id { get; set; } public string torrent_id { get; set; }
public string details_url { get; set; } public string details_url { get; set; }
public string download_url { get; set; } public string download_url { get; set; }
// public string imdb_id { get; set; } public string imdb_id { get; set; }
public bool freeleech { get; set; } public bool freeleech { get; set; }
public string type { get; set; } public string type { get; set; }
public long size { get; set; } public long size { get; set; }

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.6.3.0")] [assembly: AssemblyVersion("0.6.4.0")]
[assembly: AssemblyFileVersion("0.6.3.0")] [assembly: AssemblyFileVersion("0.6.4.0")]

View File

@@ -11,7 +11,7 @@ using System.Threading.Tasks;
namespace Jackett.Utils.Clients namespace Jackett.Utils.Clients
{ {
class HttpWebClient : IWebClient public class HttpWebClient : IWebClient
{ {
private Logger logger; private Logger logger;
@@ -70,6 +70,14 @@ namespace Jackett.Utils.Clients
client.DefaultRequestHeaders.Add("User-Agent", BrowserUtil.ChromeUserAgent); client.DefaultRequestHeaders.Add("User-Agent", BrowserUtil.ChromeUserAgent);
HttpResponseMessage response = null; HttpResponseMessage response = null;
if (request.Headers != null)
{
foreach (var header in request.Headers)
{
client.DefaultRequestHeaders.Add(header.Key, header.Value);
}
}
if (request.Type == RequestType.POST) if (request.Type == RequestType.POST)
{ {
var content = new FormUrlEncodedContent(request.PostData); var content = new FormUrlEncodedContent(request.PostData);

View File

@@ -13,6 +13,7 @@ namespace Jackett.Utils.Clients
{ {
PostData = new List<KeyValuePair<string, string>>(); PostData = new List<KeyValuePair<string, string>>();
Type = RequestType.GET; Type = RequestType.GET;
Headers = new Dictionary<string, string>();
} }
public WebRequest(string url) public WebRequest(string url)
@@ -20,6 +21,7 @@ namespace Jackett.Utils.Clients
PostData = new List<KeyValuePair<string, string>>(); PostData = new List<KeyValuePair<string, string>>();
Type = RequestType.GET; Type = RequestType.GET;
Url = url; Url = url;
Headers = new Dictionary<string, string>();
} }
public string Url { get; set; } public string Url { get; set; }
@@ -28,6 +30,10 @@ namespace Jackett.Utils.Clients
public string Referer { get; set; } public string Referer { get; set; }
public RequestType Type { get; set; } public RequestType Type { get; set; }
/// <summary>
/// Warning this is only implemented on HTTPWebClient currently!
/// </summary>
public Dictionary<string, string> Headers { get; set; }
public override bool Equals(System.Object obj) public override bool Equals(System.Object obj)
{ {

View File

@@ -25,7 +25,7 @@ namespace Jackett.Utils
protected override async Task SerializeToStreamAsync(Stream stream, protected override async Task SerializeToStreamAsync(Stream stream,
TransportContext context) TransportContext context)
{ {
var json = JsonConvert.SerializeObject(_value, Formatting.Indented); var json = JsonConvert.SerializeObject(_value, Formatting.Indented, new JsonSerializerSettings {NullValueHandling = NullValueHandling.Ignore});
var writer = new StreamWriter(stream); var writer = new StreamWriter(stream);
writer.Write(json); writer.Write(json);
await writer.FlushAsync(); await writer.FlushAsync();

View File

@@ -12,6 +12,8 @@ namespace Jackett.Utils
{ {
static Regex reduceSpacesRegex = new Regex("\\s{2,}", RegexOptions.Compiled); static Regex reduceSpacesRegex = new Regex("\\s{2,}", RegexOptions.Compiled);
static Regex findYearRegex = new Regex(@"(?<=\[|\(|\s)(\d{4})(?=\]|\)|\s)", RegexOptions.Compiled);
public static TorznabCapabilities CreateDefaultTorznabTVCaps() public static TorznabCapabilities CreateDefaultTorznabTVCaps()
{ {
var caps = new TorznabCapabilities(); var caps = new TorznabCapabilities();
@@ -23,7 +25,22 @@ namespace Jackett.Utils
return caps; return caps;
} }
public static IEnumerable<ReleaseInfo> FilterResultsToTitle(IEnumerable<ReleaseInfo> results, string name, int year) private static int GetYearFromTitle(string title)
{
var match = findYearRegex.Match(title);
if (match.Success)
{
var year = ParseUtil.CoerceInt(match.Value);
if(year>1850 && year < 2100)
{
return year;
}
}
return 0;
}
public static IEnumerable<ReleaseInfo> FilterResultsToTitle(IEnumerable<ReleaseInfo> results, string name, int imdbYear)
{ {
if (string.IsNullOrWhiteSpace(name)) if (string.IsNullOrWhiteSpace(name))
return results; return results;
@@ -34,19 +51,35 @@ namespace Jackett.Utils
{ {
if (result.Title == null) if (result.Title == null)
continue; continue;
if (CleanTitle(result.Title).Contains(name) &&
(year ==0 || result.Title.Contains(year.ToString()))) // Match on title
if (CleanTitle(result.Title).Contains(name))
{ {
filteredResults.Add(result); // Match on year
var titleYear = GetYearFromTitle(result.Title);
if (imdbYear == 0 || titleYear == 0 || titleYear == imdbYear)
{
filteredResults.Add(result);
}
} }
} }
return filteredResults; return filteredResults;
} }
public static IEnumerable<ReleaseInfo> FilterResultsToImdb(IEnumerable<ReleaseInfo> results, string imdb)
{
if (string.IsNullOrWhiteSpace(imdb))
return results;
// Filter out releases that do have a valid imdb ID, that is not equal to the one we're searching for.
return
results.Where(
result => !result.Imdb.HasValue || result.Imdb.Value == 0 || ("tt" + result.Imdb.Value).Equals(imdb));
}
private static string CleanTitle(string title) private static string CleanTitle(string title)
{ {
title = title.Replace(':', ' ').Replace('.', ' ').Replace('-', ' ').Replace('_', ' ').Replace('+', ' '); title = title.Replace(':', ' ').Replace('.', ' ').Replace('-', ' ').Replace('_', ' ').Replace('+', ' ').Replace("'", "");
return reduceSpacesRegex.Replace(title, " ").ToLowerInvariant(); return reduceSpacesRegex.Replace(title, " ").ToLowerInvariant();
} }
} }

View File

@@ -22,13 +22,13 @@
Follow development, report issues and contribute on our <a href="https://github.com/zone117x/Jackett">Github page</a>. Follow development, report issues and contribute on our <a href="https://github.com/zone117x/Jackett">Github page</a>.
</div> </div>
<br /><br /> <br /><br />
<div class="col-xs-12"> <!--<div class="col-xs-12">
<a href="https://github.com/zone117x/Jackett"> <a href="https://github.com/zone117x/Jackett">
<img alt="stars" src="https://img.shields.io/github/stars/zone117x/Jackett.svg?style=social" /> <img alt="stars" src="https://img.shields.io/github/stars/zone117x/Jackett.svg?style=social" />
<img alt="followers" src="https://img.shields.io/github/followers/zone117x.svg?style=social" /> <img alt="followers" src="https://img.shields.io/github/followers/zone117x.svg?style=social" />
<img alt="forks" src="https://img.shields.io/github/forks/zone117x/Jackett.svg?style=social" /> <img alt="forks" src="https://img.shields.io/github/forks/zone117x/Jackett.svg?style=social" />
</a> </a>
</div> </div>-->
</div> </div>
</div> </div>
<div class="col-xs-4 center"> <div class="col-xs-4 center">

View File

@@ -2,6 +2,10 @@
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta NAME="description" CONTENT="Access your favorite torrent indexers with a single API.">
<meta NAME="keywords" CONTENT="jackett, torznab, torrent, indexer">
<meta NAME="robot" CONTENT="index,follow">
<meta NAME="language" CONTENT="en">
<link rel='shortcut icon' type='image/x-icon' href='~/content/favicon.ico' /> <link rel='shortcut icon' type='image/x-icon' href='~/content/favicon.ico' />
<script src="~/content/libs/jquery.min.js"></script> <script src="~/content/libs/jquery.min.js"></script>
<script src="~/content/libs/jquery.dataTables.min.js"></script> <script src="~/content/libs/jquery.dataTables.min.js"></script>
@@ -17,7 +21,7 @@
<link href="~/content/web/web.css" rel="stylesheet"> <link href="~/content/web/web.css" rel="stylesheet">
<link href="~/content/css/jquery.dataTables.css" rel="stylesheet"> <link href="~/content/css/jquery.dataTables.css" rel="stylesheet">
<link rel="stylesheet" href="~/content/css/font-awesome.min.css"> <link rel="stylesheet" href="~/content/css/font-awesome.min.css">
<title>Jackett</title> <title>Jackett Torznab Indexer</title>
</head> </head>
<body> <body>
<div id="page"> <div id="page">