diff --git a/src/Jackett.Console/Jackett.Console.csproj b/src/Jackett.Console/Jackett.Console.csproj index f5063bb4f..022bbaee6 100644 --- a/src/Jackett.Console/Jackett.Console.csproj +++ b/src/Jackett.Console/Jackett.Console.csproj @@ -16,7 +16,7 @@ - x64 + AnyCPU true full false @@ -42,8 +42,8 @@ - False - ..\packages\Autofac.3.5.0\lib\net40\Autofac.dll + ..\packages\Autofac.3.5.2\lib\net40\Autofac.dll + True ..\packages\Autofac.Owin.3.1.0\lib\net45\Autofac.Integration.Owin.dll @@ -70,15 +70,15 @@ ..\packages\Microsoft.Owin.FileSystems.3.0.1\lib\net45\Microsoft.Owin.FileSystems.dll True - - ..\packages\Microsoft.Owin.Host.HttpListener.2.0.2\lib\net45\Microsoft.Owin.Host.HttpListener.dll + + ..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll True ..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll - - ..\packages\Microsoft.Owin.Hosting.2.0.2\lib\net45\Microsoft.Owin.Hosting.dll + + ..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll True diff --git a/src/Jackett.Console/packages.config b/src/Jackett.Console/packages.config index 30ec668de..b883a0e51 100644 --- a/src/Jackett.Console/packages.config +++ b/src/Jackett.Console/packages.config @@ -1,6 +1,6 @@  - + @@ -16,9 +16,9 @@ - + - + diff --git a/src/Jackett.Service/Jackett.Service.csproj b/src/Jackett.Service/Jackett.Service.csproj index acb3cd7a6..ff213d5cd 100644 --- a/src/Jackett.Service/Jackett.Service.csproj +++ b/src/Jackett.Service/Jackett.Service.csproj @@ -39,8 +39,8 @@ - False - ..\packages\Autofac.3.5.0\lib\net40\Autofac.dll + ..\packages\Autofac.3.5.2\lib\net40\Autofac.dll + True ..\packages\Autofac.Owin.3.1.0\lib\net45\Autofac.Integration.Owin.dll @@ -63,9 +63,9 @@ ..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll - - False - ..\packages\Microsoft.Owin.Hosting.2.0.2\lib\net45\Microsoft.Owin.Hosting.dll + + ..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll + True False diff --git a/src/Jackett.Service/packages.config b/src/Jackett.Service/packages.config index 15edf0448..c3b90ef09 100644 --- a/src/Jackett.Service/packages.config +++ b/src/Jackett.Service/packages.config @@ -1,6 +1,6 @@  - + @@ -15,7 +15,7 @@ - + diff --git a/src/Jackett.Test/Indexers/BakaBTTests.cs b/src/Jackett.Test/Indexers/BakaBTTests.cs new file mode 100644 index 000000000..a514ea4e1 --- /dev/null +++ b/src/Jackett.Test/Indexers/BakaBTTests.cs @@ -0,0 +1,176 @@ +using Jackett.Utils.Clients; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Autofac; +using Jackett.Indexers; +using FluentAssertions; +using Newtonsoft.Json.Linq; +using Jackett; +using Newtonsoft.Json; + +namespace JackettTest.Indexers +{ + [TestFixture] + class BakaBTTests : TestBase + { + [Test] + public async void should_return_be_able_to_login_successfully() + { + // Do Login + TestUtil.RegisterStringCall(new WebRequest() + { + Url = "http://bakabt.me/login.php", + Cookies = "bbtid=b", + Type = RequestType.POST, + Referer = "http://bakabt.me/", + PostData = new Dictionary() + { + {"username", "user" }, + {"password", "pwd" }, + {"returnto", "/index.php" } + } + }, (req) => { + return new WebClientStringResult() + { + Status = System.Net.HttpStatusCode.Found, + Cookies = "bbtid=c", + }; + }); + + // Get login form + TestUtil.RegisterStringCall(new WebRequest() + { + Url = "http://bakabt.me/login.php", + Type = RequestType.GET + }, (req) => { + return new WebClientStringResult() + { + Cookies = "bbtid=b", + Status = System.Net.HttpStatusCode.Found + }; + }); + + // Get logged in page + TestUtil.RegisterStringCall(new WebRequest() + { + Cookies = "bbtid=c", + Type = RequestType.GET, + Url = "http://bakabt.me/browse.php?only=0&hentai=1&incomplete=1&lossless=1&hd=1&multiaudio=1&bonus=1&c1=1&reorder=1&q=" + }, (req) => { + return new WebClientStringResult() + { + Content = TestUtil.GetResource("Indexers/BakaBTTestsSearchPage.html"), + Status = System.Net.HttpStatusCode.OK + }; + }); + + var indexer = TestUtil.Container.ResolveNamed(BakaBT.GetIndexerID(typeof(BakaBT))) as BakaBT; + + indexer.DisplayName.Should().Be("BakaBT"); + indexer.DisplayDescription.Should().Be("Anime Community"); + indexer.ID.Should().Be("bakabt"); + + indexer.LoginUrl.Should().Be("http://bakabt.me/login.php"); + + var token = JObject.Parse("{\"username\":\"user\",\"password\":\"pwd\"}"); + await indexer.ApplyConfiguration(token); + indexer.IsConfigured.Should().Be(true); + + ((string)TestUtil.IndexManager.LastSavedConfig["cookies"]).Should().Be("bbtid=c"); + } + + [Test] + public async void should_return_be_able_to_login_unsuccessfully() + { + // Do Login + TestUtil.RegisterStringCall(new WebRequest() + { + Url = "http://bakabt.me/login.php", + Cookies = "bbtid=b", + Type = RequestType.POST, + Referer = "http://bakabt.me/", + PostData = new Dictionary() + { + {"username", "user" }, + {"password", "pwd" }, + {"returnto", "/index.php" } + } + }, (req) => { + return new WebClientStringResult() + { + Status = System.Net.HttpStatusCode.OK, + Cookies = "bbtid=c", + Content = TestUtil.GetResource("Indexers/BakaBTTestsLoginError.html"), + }; + }); + + // Get login form + TestUtil.RegisterStringCall(new WebRequest() + { + Url = "http://bakabt.me/login.php", + Type = RequestType.GET + }, (req) => { + return new WebClientStringResult() + { + Cookies = "bbtid=b", + Status = System.Net.HttpStatusCode.Found + }; + }); + + var indexer = TestUtil.Container.ResolveNamed(BakaBT.GetIndexerID(typeof(BakaBT))) as BakaBT; + + var token = JObject.Parse("{\"username\":\"user\",\"password\":\"pwd\"}"); + try { + await indexer.ApplyConfiguration(token); + } + catch(ExceptionWithConfigData e) + { + e.Message.Should().Be("Username or password is incorrect"); + } + + indexer.IsConfigured.Should().Be(false); + } + + [Test] + public async void should_return_be_able_to_scrape_the_search_page() + { + // Do Search + TestUtil.RegisterStringCall(new WebRequest() + { + Url = "http://bakabt.me/browse.php?only=0&hentai=1&incomplete=1&lossless=1&hd=1&multiaudio=1&bonus=1&c1=1&reorder=1&q=Series", + Cookies = "bbtid=c", + Type = RequestType.GET + }, (req) => { + return new WebClientStringResult() + { + Status = System.Net.HttpStatusCode.OK, + Cookies = "bbtid=c", + Content = TestUtil.GetResource("Indexers/BakaBTTestsSearchPage.html"), + }; + }); + + var indexer = TestUtil.Container.ResolveNamed(BakaBT.GetIndexerID(typeof(BakaBT))) as BakaBT; + + indexer.LoadFromSavedConfiguration(JObject.Parse("{\"cookies\":\"bbtid=c\"}")); + var results = await indexer.PerformQuery(new Jackett.Models.TorznabQuery() { SanitizedSearchTerm = "Series S1", Season = 1 }); + + results.Length.Should().Be(44); + results[0].Title.Should().Be("Golden Time Season 1 (BD 720p) [FFF]"); + results[0].Guid.Should().Be("http://bakabt.me/torrent/180302/golden-time-bd-720p-fff"); + results[0].Comments.Should().Be("http://bakabt.me/torrent/180302/golden-time-bd-720p-fff"); + results[0].Size.Should().Be(10307921920); + results[0].Description.Should().Be("Golden Time Season 1 (BD 720p) [FFF]"); + results[0].Link.Should().Be("http://bakabt.me/torrent/180302/golden-time-bd-720p-fff"); + results[0].Peers.Should().Be(161); + results[0].Seeders.Should().Be(151); + + results[1].Title.Should().Be("Yowamushi Pedal Season 1 (BD 720p) [Commie]"); + results[4].Title.Should().Be("Dungeon ni Deai o Motomeru no wa Machigatte Iru Darouka: Familia Myth Season 1 (480p) [HorribleSubs]"); + results[5].Title.Should().Be("Is It Wrong to Try to Pick Up Girls in a Dungeon? Season 1 (480p) [HorribleSubs]"); + } + } +} diff --git a/src/Jackett.Test/Indexers/BakaBTTestsLoginError.html b/src/Jackett.Test/Indexers/BakaBTTestsLoginError.html new file mode 100644 index 000000000..e3f20d4ba --- /dev/null +++ b/src/Jackett.Test/Indexers/BakaBTTestsLoginError.html @@ -0,0 +1,59 @@ + + + + Login - BakaBT + + + + + + + + + + +
+ +
+ +
+
+
+ + + + +
+ + + + \ No newline at end of file diff --git a/src/Jackett.Test/Indexers/BakaBTTestsSearchPage.html b/src/Jackett.Test/Indexers/BakaBTTestsSearchPage.html new file mode 100644 index 000000000..8b61d013a --- /dev/null +++ b/src/Jackett.Test/Indexers/BakaBTTestsSearchPage.html @@ -0,0 +1,1312 @@ + + + + + + Browse - BakaBT + + + + + + + +
+
+
+ +
+ +
+
+
+
+
    +
  • + Tags + +
      +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    +
  • +
  • + Category: + +
  • + +
  • +
    + Searchcloud: + 1080p akira anal berserk bleach borderline hentai comedy dragon ball ecchi evangelion fairy tail fakku fantasy fate futanari Gender Bender Ghibli ghost in the shell Gigantic Breasts gintama gundam Harem horror hunter x hunter incest jojo kill la kill large breasts Lolicon macross mecha monogatari monster naruto no game no life ntr nudity one piece pokemon psycho pass rape romance Sci-Fi Seinen sword art online to love-ru tokyo ghoul uncensored yaoi yuri +
    +
  • +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Category + + Name + + Added + + Size + + DSL +
+
+ +
+
+
+ Golden Time (BD 720p) [FFF] College, Comedy, Coming of Age, Slice of Life, Love Polygon, Romance, FFF, Hi10P, 720p, J C STAFF + + + 22 Jul '15 + 9.60 GB + 323 / 151 / 10 +
Alternative versions:
+ Golden Time (480p) [HorribleSubs] Comedy, Coming of Age, College, Daily Life, Love Polygon, Romance, Seinen, HorribleSubs, J C STAFF + + 28 Ma '14 + 3.44 GB + 3984 / 49 / 1 +
+
+ +
+
+
+ Yowamushi Pedal (BD 720p) [Commie] Comedy, Drama, School, Shounen, Sports, 720p, Commie, BluRay + + + 8 Jul '15 + 22.6 GB + 318 / 73 / 9 +
Alternative versions:
+ Yowamushi Pedal (480p) [HorribleSubs] Comedy, Drama, School, Shounen, Sports, HorribleSubs + + 31 Oct '14 + 5.49 GB + 1219 / 41 / 1 +
+
+ +
+
+
+ Etotama (480p) [HorribleSubs] Action, Comedy, Fantasy, HorribleSubs, Catgirls + + + 8 Jul '15 + 1.73 GB + 741 / 112 / 4 +
+
+ +
+
+
+ Grisaia no Kajitsu (480p) [HorribleSubs] Drama, Romance, School, Harem, Psychological, Visual Novel, 8bit (Production co.), HorribleSubs + + + 8 Jul '15 + 1.86 GB + 775 / 131 / 2 +
+
+ +
+
+
+ Dungeon ni Deai o Motomeru no wa Machigatte Iru Darouka: Familia Myth | Is It Wrong to Try to Pick Up Girls in a Dungeon? | DanMachi (480p) [HorribleSubs] Action, Adventure, Fantasy, Ecchi, Harem, Romance, Supernatural, HorribleSubs, J C STAFF + + + 5 Jul '15 + 1.86 GB + 1823 / 276 / 7 +
+
+ +
+
+
+ Yahari Ore no Seishun Lovecome wa Machigatte Iru. Zoku | My Teen Romantic Comedy: SNAFU Too! | Oregairu 2 (480p) [HorribleSubs] Romance, High School, School Life, Schoolgirls, Seinen, Feel, HorribleSubs + + + 5 Jul '15 + 1.90 GB + 830 / 107 / 7 +
+
+ +
+
+
+ Yamada-kun to 7-nin no Majo | Yamada-kun and the Seven Witches (480p) [HorribleSubs] Romance, Harem, School Life, Schoolgirls, Shounen, HorribleSubs + + + 5 Jul '15 + 1.79 GB + 850 / 125 / 3 +
+
+ +
+
+
+ Kyoshin Gorg | Giant Gorg (480p) [TSHS, mSubs, BBT-RMX] Action, Adventure, Mecha, Sci-Fi, Sunrise, TSHS, mSubs, Remux + + + 26 Jun '15 + 7.36 GB + 429 / 44 / 4 +
+
+ +
+
+
+ Inuyasha [RUELL-Next] Action, Adventure, Comedy, Contemporary Fantasy, Demons, Fantasy, Love Polygon, Magic, Martial Arts, Romance, Shounen, Super Power, Sunrise, Time Travel + + + 26 Jun '15 + 39.8 GB + 457 / 103 / 16 +
Alternative versions:
+ Inuyasha [Anime-Supreme] Action, Adventure, Fantasy, Demons, Shounen, Super Power, Swordplay, Time Travel, Sunrise, a-S, TAKAHASHI Rumiko + + 1 Jan '11 + 33.4 GB + 15k / 124 / 21 +
+ Inuyasha Season 4 [Ani-Kraze] Action, Adventure, Comedy, Contemporary Fantasy, Demons, Fantasy, Love Polygon, Magic, Martial Arts, Romance, Shounen, Super Power, Ani-Kraze, Sunrise + + 12 Ma '10 + 5.34 GB + 316 / 3 / 0 +
+ Inuyasha Season 5 [Ani-Kraze] Action, Adventure, Comedy, Contemporary Fantasy, Demons, Fantasy, Love Polygon, Magic, Martial Arts, Romance, Shounen, Super Power, Swordplay, Ani-Kraze, Sunrise + + 10 Ma '10 + 5.22 GB + 394 / 4 / 0 +
+ Inuyasha Season 6 [Ani-Kraze] Action, Adventure, Comedy, Contemporary Fantasy, Demons, Fantasy, Magic, Martial Arts, Romance, Shounen, Slapstick, Super Power, Time Travel, Ani-Kraze, Sunrise + + 9 Nov '04 + 5.31 GB + 518 / 4 / 0 +
+
+ +
+
+
+ Hello!! Kin'iro Mosaic | Kinmosa 2 (480p) [HorribleSubs] Comedy, Seinen, Daily Life, School Life, Schoolgirls, Studio Gokumi, HorribleSubs + + + 26 Jun '15 + 1.71 GB + 360 / 52 / 0 +
+
+ +
+
+
+ Cybersix (480p) [Bakayaros] (Eng Dub) Action, Adventure, Comedy, Cyborgs, Human Enhancement, Romance, School Life, Sci-Fi, Seinen, Shounen, Super Power, Thriller, Violence, TMS, Bakayaros + + + 14 Jun '15 + 3.93 GB + 523 / 36 / 0 +
+
+ +
+
+
+ Triage X (480p) [HorribleSubs] Action, Harem, School Life, Schoolgirls, Large Breasts, Shounen, Romance, Ecchi, XEBEC, HorribleSubs, SATOU Shouji + + + 13 Jun '15 + 1.42 GB + 1729 / 156 / 2 +
+
+ +
+
+
+ Yami Shibai 2 | Yamishibai: Japanese Ghost Stories 2 (720p) [WhyNot-Migoto] Horror, Short Episodes, WhyNot, Migoto, Supernatural, Hi10P, 720p + + + 9 Jun '15 + 1.68 GB + 431 / 51 / 1 +
+
+ +
+
+
+ Shigatsu wa Kimi no Uso | Your Lie in April (480p) [HorribleSubs] Drama, Music, Sports, Shounen, HorribleSubs, Psychological, Romance, Tragedy + + + 4 Jun '15 + 3.05 GB + 1273 / 111 / 4 +
+
+ +
+
+
+ Ojamajo Doremi | Magical DoReMi (480p) [Doremi] Mahou Shoujo, Comedy, School Life, Fantasy, Magic, Doremi, Elementary School, Shoujo + + + 2 Jun '15 + 10.9 GB + 164 / 16 / 1 +
+
+ +
+
+
+ Diamond no Ace | Ace of the Diamond (720p) [Commie] Baseball, Sports, Commie, Comedy, School, Shounen, MADHOUSE + + + 30 May '15 + 23.6 GB + 454 / 44 / 5 +
Alternative versions:
+ Diamond no Ace | Ace of the Diamond (480p) [HorribleSubs] Baseball, Comedy, School, Shounen, Sports, MADHOUSE, Production IG, HorribleSubs + + 29 Ma '15 + 10.9 GB + 648 / 26 / 2 +
+
+ +
+
+
+ Deltora Quest (480p) [E-D] (Eng Dub) Action, Adventure, Comedy, Drama, Fantasy, Shounen, Swordplay, OLM, E-D + + + 30 May '15 + 14.1 GB + 645 / 60 / 2 +
+
+ +
+
+
+ Kakumeiki Valvrave | Valvrave the Liberator (BD 720p) [FFF] Action, Angst, Love Polygon, Mecha, Piloted Robots, School Life, Sci-Fi, Space, Robots, Tragedy, Violence, Sunrise, BluRay, Hi10P, 720p + + + 25 May '15 + 17.6 GB + 1098 / 136 / 10 +
Alternative versions:
+ Kakumeiki Valvrave | Valvrave The Liberator (480p) [HorribleSubs] Mecha, HorribleSubs, Robots, Piloted Robots, Angst, Action, Sci-Fi, Sunrise, Space, Love Polygon, School Life, Violence, Tragedy + + 6 Jan '14 + 3.56 GB + 2103 / 32 / 1 +
+
+ +
+
+
+ Jigoku Shoujo | Hell Girl (DVD 480p) [E-D] Angst, Contemporary Fantasy, Demons, Drama, Horror, Seinen, Tragedy, Violence, Aniplex, Studio DEEN, E-D + + + 25 May '15 + 8.62 GB + 724 / 73 / 3 +
+
+ +
+
+
+ Majin Bone (480p) [HorribleSubs] Action, Game, Battles, Sci-Fi, Shounen, HorribleSubs, Toei Animation, Bandai Visual, Crunchyroll + + + 17 May '15 + 6.93 GB + 256 / 28 / 0 +
+
+ +
+
+
+ Xenosaga The Animation (DVD 480p) [ColdFusion] Action, Airforce, Aliens, Androids, Gunfights, Humanoid, Mecha, Military, Parasites, Piloted Robots, Sci-Fi, Space Travel, Hi10P, Namco Bandai, Toei Animation + + + 16 May '15 + 2.68 GB + 1169 / 87 / 1 +
+
+ +
+
+
+ 009-1 (DVD 480p) [E-D] Action, Conspiracy, Cyborgs, Ecchi, Sci-Fi, Tragedy, Spy, E-D + + + 16 May '15 + 4.32 GB + 1656 / 121 / 2 +
+
+ +
+
+
+ HappinessCharge Precure! (Pretty Cure) [Doremi] Toei Animation, Shoujo, Mahou Shoujo, Magic, Super Power, Contemporary Fantasy, School Life, Love Polygon, 720p, Doremi + + + 9 May '15 + 17.4 GB + 165 / 20 / 0 +
+
+ +
+
+
+ D.C.III ~Da Capo III~ (BD 1080p) [- -`] Harem, High School, Female Students, Clubs, Magic, Romance, School Life, Visual Novel, 1080p, Circus, Drama, Ecchi, Boing, Hi10P, BluRay + + + 2 May '15 + 12.3 GB + 472 / 56 / 4 +
Alternative versions:
+ D.C.III ~Da Capo III~ (720p) [ASF-Oyatsu] Harem, High School, Female Students, Clubs, Magic, Romance, School Life, Visual Novel, 720p, Circus, Drama, Ecchi, Boing + + 16 Apr '15 + 3.71 GB + 457 / 22 / 0 +
+ D.C.III ~Da Capo III~ (480p) [HorribleSubs] Boing, Clubs, Comedy, Female Students, Harem, High School, Magic, Romance, School Life, Circus, HorribleSubs + + 14 Ma '14 + 1.86 GB + 1231 / 18 / 1 +
+
+ +
+
+
+ PriPara - Season 1 (720p) [naisho] Idols, Music, Kids, Shoujo, Slice of Life, Tatsunoko Prod., naisho, 720p, Hi10P + + + 2 May '15 + 21.4 GB + 164 / 21 / 0 +
+
+ +
+
+
+ Fushigi na Melmo | Marvelous Melmo [DivX5, 480p][Saiei&Viki] Fantasy, Magic, Mahou Shoujo, Educational, Action, Violence, Comedy, Coming of Age, Ecchi, Nudity, Shoujo, Viki, Tezuka Productions, TEZUKA Osamu + + + 28 Apr '15 + 4.74 GB + 430 / 17 / 0 +
+
+ +
+
+
+ HeartCatch Precure! (Pretty Cure) [BSS-Commie] Toei Animation, Shoujo, Mahou Shoujo, Super Power, Magic, School Life, Clubs, Action, Contemporary Fantasy, Hi10P, 720p, Commie + + + 27 Apr '15 + 30.7 GB + 219 / 31 / 5 +
Alternative versions:
+ Heartcatch Precure! (Pretty Cure) (xvid) [Doremi] Toei Animation, Mahou Shoujo, Magic, School Life, Doremi + + 2 Feb '11 + 8.39 GB + 816 / 3 / 0 +
+
+ +
+
+
+ Hunter x Hunter (2011) (BD 1080p) [Coalgirls] Action, Adventure, Fantasy, Super Power, Tragedy, Shounen, Violence, MADHOUSE, 1080p, Hi10P, Coalgirls + + + 25 Apr '15 + 158 GB + 505 / 102 / 13 +
Alternative versions:
+ Hunter x Hunter (2011) (BD 720p) [Coalgirls] Action, Adventure, Fantasy, Super Power, Tragedy, Shounen, Violence, MADHOUSE, 720p, Hi10P, Coalgirls + + 9 Ma '15 + 78.1 GB + 1038 / 88 / 19 +
+ Hunter x Hunter (2011) (480p) [HorribleSubs] Action, Adventure, Comedy, Drama, Fantasy, Tournament, Shounen, Super Power, Tragedy, Violence, HorribleSubs, MADHOUSE + + 27 Sept '14 + 21.1 GB + 1107 / 30 / 3 +
+
+ +
+
+
+ Log Horizon (BD 1080p) [Zurako] Action, Magic, Fantasy, Comedy, Virtual Reality, Shounen, Zurako, 1080p, BluRay, Hi10P + + + 21 Apr '15 + 40.4 GB + 763 / 93 / 1 +
Alternative versions:
+ Log Horizon (BD 1080p) [deanzel] Action, Magic, Fantasy, Comedy, Virtual Reality, Shounen, BluRay, Hi10P, 1080p, Commie, NHK, Satelight + + 26 Apr '15 + 24.7 GB + 542 / 52 / 3 +
+ Log Horizon (BD 720p) [SallySubs] Action, Comedy, Fantasy, Magic, Virtual Reality, Shounen, 720p, Hi10P + + 21 Apr '15 + 9.27 GB + 626 / 41 / 2 +
+ Log Horizon (BD 720p) [deanzel] Action, Magic, Fantasy, Comedy, Virtual Reality, Shounen, BluRay, Hi10P, 720p, Commie, NHK, Satelight + + 26 Apr '15 + 10.3 GB + 439 / 27 / 2 +
+ Log Horizon (480p) [HorribleSubs] Action, Adventure, Comedy, Fantasy, Magic, Shounen, Sci-Fi, Virtual Reality, Satelight, NHK, HorribleSubs + + 24 Ma '14 + 3.71 GB + 5250 / 60 / 0 +
+
+ +
+
+
+ Rail Wars! (BD 1080p) [FFF] Harem, Large Breasts, Special Squads, Law and Order, BluRay, FFF, 1080p, Hi10P + + + 21 Apr '15 + 16.2 GB + 1239 / 114 / 4 +
Alternative versions:
+ Rail Wars! (BD 720p) [FFF] Harem, Large Breasts, Special Squads, Law and Order, BluRay, Hi10P, 720p, FFF + + 21 Apr '15 + 6.61 GB + 1072 / 72 / 0 +
+ Rail Wars! (480p) [HorribleSubs] Harem, Large Breasts, Special Squads, Law and Order, Romance, HorribleSubs + + 9 Nov '14 + 1.75 GB + 2389 / 58 / 1 +
+
+ +
+
+
+ + +
+ + + + + \ No newline at end of file diff --git a/src/Jackett.Test/Jackett.Test.csproj b/src/Jackett.Test/Jackett.Test.csproj new file mode 100644 index 000000000..8d0bbc459 --- /dev/null +++ b/src/Jackett.Test/Jackett.Test.csproj @@ -0,0 +1,212 @@ + + + + Debug + AnyCPU + {E75D4F15-5DA3-4332-ADB1-28FB673DAE56} + Library + Properties + JackettTest + JackettTest + v4.5.2 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Autofac.3.5.2\lib\net40\Autofac.dll + True + + + ..\packages\Autofac.Owin.3.1.0\lib\net45\Autofac.Integration.Owin.dll + True + + + ..\packages\Autofac.WebApi2.3.4.0\lib\net45\Autofac.Integration.WebApi.dll + True + + + ..\packages\Autofac.WebApi2.Owin.3.2.0\lib\net45\Autofac.Integration.WebApi.Owin.dll + True + + + ..\packages\CsQuery.1.3.4\lib\net40\CsQuery.dll + True + + + ..\packages\FluentAssertions.3.4.1\lib\net45\FluentAssertions.dll + True + + + ..\packages\FluentAssertions.3.4.1\lib\net45\FluentAssertions.Core.dll + True + + + ..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll + True + + + ..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll + True + + + ..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll + True + + + ..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll + True + + + ..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll + True + + + ..\packages\NLog.4.0.1\lib\net45\NLog.dll + True + + + ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll + True + + + ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll + True + + + ..\packages\NUnit.2.6.4\lib\nunit.framework.dll + True + + + ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.util.dll + True + + + ..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll + True + + + ..\packages\Owin.1.0\lib\net40\Owin.dll + True + + + + + ..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll + True + + + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll + True + + + ..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll + True + + + + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll + True + + + ..\packages\Microsoft.AspNet.WebApi.Owin.5.2.3\lib\net45\System.Web.Http.Owin.dll + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {e636d5f8-68b4-4903-b4ed-ccfd9c9e899f} + Jackett + + + + + + + + + + + + + False + + + False + + + False + + + False + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/src/Jackett.Test/Properties/AssemblyInfo.cs b/src/Jackett.Test/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..245a83e54 --- /dev/null +++ b/src/Jackett.Test/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Jackett.Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Jackett.Test")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("e75d4f15-5da3-4332-adb1-28fb673dae56")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Jackett.Test/TestBase.cs b/src/Jackett.Test/TestBase.cs new file mode 100644 index 000000000..babb28d07 --- /dev/null +++ b/src/Jackett.Test/TestBase.cs @@ -0,0 +1,18 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JackettTest +{ + abstract class TestBase + { + [SetUp] + public void Setup() + { + TestUtil.SetupContainer(); + } + } +} diff --git a/src/Jackett.Test/TestIIndexerManagerServiceHelper.cs b/src/Jackett.Test/TestIIndexerManagerServiceHelper.cs new file mode 100644 index 000000000..5bfe46713 --- /dev/null +++ b/src/Jackett.Test/TestIIndexerManagerServiceHelper.cs @@ -0,0 +1,46 @@ +using Jackett.Services; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Jackett.Indexers; +using Newtonsoft.Json.Linq; + +namespace JackettTest +{ + class TestIndexerManagerServiceHelper : IIndexerManagerService + { + public JToken LastSavedConfig { get; set; } + + public void DeleteIndexer(string name) + { + throw new NotImplementedException(); + } + + public IEnumerable GetAllIndexers() + { + throw new NotImplementedException(); + } + + public IIndexer GetIndexer(string name) + { + throw new NotImplementedException(); + } + + public void InitIndexers() + { + throw new NotImplementedException(); + } + + public void SaveConfig(IIndexer indexer, JToken obj) + { + LastSavedConfig = obj; + } + + public Task TestIndexer(string name) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/Jackett.Test/TestUtil.cs b/src/Jackett.Test/TestUtil.cs new file mode 100644 index 000000000..480b2647e --- /dev/null +++ b/src/Jackett.Test/TestUtil.cs @@ -0,0 +1,74 @@ +using Autofac; +using Jackett; +using Jackett.Services; +using Jackett.Utils.Clients; +using NLog; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace JackettTest +{ + class TestUtil + { + private static IContainer testContainer = null; + + public static void SetupContainer() + { + var builder = new ContainerBuilder(); + builder.RegisterModule(); + builder.RegisterType().As().SingleInstance(); + builder.RegisterInstance(LogManager.GetCurrentClassLogger()).SingleInstance(); + builder.RegisterType().As().SingleInstance(); + testContainer = builder.Build(); + + // Register the container in itself to allow for late resolves + var secondaryBuilder = new ContainerBuilder(); + secondaryBuilder.RegisterInstance(testContainer).SingleInstance(); + secondaryBuilder.Update(testContainer); + } + + public static TestIndexerManagerServiceHelper IndexManager + { + get + { + return testContainer.Resolve() as TestIndexerManagerServiceHelper; + } + } + + public static IContainer Container + { + get { return testContainer; } + } + + public static void RegisterByteCall(WebRequest r, Func f) + { + var client = testContainer.Resolve() as TestWebClient; + client.RegisterByteCall(r, f); + } + + public static void RegisterStringCall(WebRequest r, Func f) + { + var client = testContainer.Resolve() as TestWebClient; + client.RegisterStringCall(r, f); + } + + public static string GetResource(string item) + { + var assembly = Assembly.GetExecutingAssembly(); + var resourceName = "JackettTest." + item.Replace('/','.'); + + using (Stream stream = assembly.GetManifestResourceStream(resourceName)) + { + using (StreamReader reader = new StreamReader(stream)) + { + return reader.ReadToEnd(); + } + } + } + } +} diff --git a/src/Jackett.Test/TestWebClient.cs b/src/Jackett.Test/TestWebClient.cs new file mode 100644 index 000000000..dd375c38c --- /dev/null +++ b/src/Jackett.Test/TestWebClient.cs @@ -0,0 +1,35 @@ +using Jackett.Utils.Clients; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JackettTest +{ + public class TestWebClient : IWebClient + { + private Dictionary> byteCallbacks = new Dictionary>(); + private Dictionary> stringCallbacks = new Dictionary>(); + + public void RegisterByteCall(WebRequest req, Func f) + { + byteCallbacks.Add(req, f); + } + + public void RegisterStringCall(WebRequest req, Func f) + { + stringCallbacks.Add(req, f); + } + + public Task GetBytes(WebRequest request) + { + return Task.FromResult< WebClientByteResult>(byteCallbacks.Where(r => r.Key.Equals(request)).First().Value.Invoke(request)); + } + + public Task GetString(WebRequest request) + { + return Task.FromResult(stringCallbacks.Where(r => r.Key.Equals(request)).First().Value.Invoke(request)); + } + } +} diff --git a/src/Jackett.Test/app.config b/src/Jackett.Test/app.config new file mode 100644 index 000000000..c0ff2bc0e --- /dev/null +++ b/src/Jackett.Test/app.config @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Jackett.Test/packages.config b/src/Jackett.Test/packages.config new file mode 100644 index 000000000..8ac788eef --- /dev/null +++ b/src/Jackett.Test/packages.config @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Jackett.Tray/Jackett.Tray.csproj b/src/Jackett.Tray/Jackett.Tray.csproj index c417ef812..a7801f0dc 100644 --- a/src/Jackett.Tray/Jackett.Tray.csproj +++ b/src/Jackett.Tray/Jackett.Tray.csproj @@ -39,7 +39,7 @@ - ..\packages\Autofac.3.5.0\lib\net40\Autofac.dll + ..\packages\Autofac.3.5.2\lib\net40\Autofac.dll True @@ -62,12 +62,12 @@ ..\packages\Microsoft.Owin.FileSystems.3.0.1\lib\net45\Microsoft.Owin.FileSystems.dll True - - ..\packages\Microsoft.Owin.Host.HttpListener.2.0.2\lib\net45\Microsoft.Owin.Host.HttpListener.dll + + ..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll True - - ..\packages\Microsoft.Owin.Hosting.2.0.2\lib\net45\Microsoft.Owin.Hosting.dll + + ..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll True diff --git a/src/Jackett.Tray/packages.config b/src/Jackett.Tray/packages.config index 841d4aa9c..c3b90ef09 100644 --- a/src/Jackett.Tray/packages.config +++ b/src/Jackett.Tray/packages.config @@ -1,6 +1,6 @@  - + @@ -14,8 +14,8 @@ - - + + diff --git a/src/Jackett.sln b/src/Jackett.sln index bd24b6def..349b544bb 100644 --- a/src/Jackett.sln +++ b/src/Jackett.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett", "Jackett\Jackett.csproj", "{E636D5F8-68B4-4903-B4ED-CCFD9C9E899F}" EndProject @@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Service", "Jackett. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Tray", "Jackett.Tray\Jackett.Tray.csproj", "{FF9025B1-EC14-4AA9-8081-9F69C5E35B63}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Test", "Jackett.Test\Jackett.Test.csproj", "{E75D4F15-5DA3-4332-ADB1-28FB673DAE56}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -47,6 +49,10 @@ Global {FF9025B1-EC14-4AA9-8081-9F69C5E35B63}.Debug|Any CPU.Build.0 = Debug|Any CPU {FF9025B1-EC14-4AA9-8081-9F69C5E35B63}.Release|Any CPU.ActiveCfg = Release|Any CPU {FF9025B1-EC14-4AA9-8081-9F69C5E35B63}.Release|Any CPU.Build.0 = Release|Any CPU + {E75D4F15-5DA3-4332-ADB1-28FB673DAE56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E75D4F15-5DA3-4332-ADB1-28FB673DAE56}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E75D4F15-5DA3-4332-ADB1-28FB673DAE56}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E75D4F15-5DA3-4332-ADB1-28FB673DAE56}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Jackett/Controllers/APIController.cs b/src/Jackett/Controllers/APIController.cs index 0fd47e950..9e6ecd37e 100644 --- a/src/Jackett/Controllers/APIController.cs +++ b/src/Jackett/Controllers/APIController.cs @@ -3,6 +3,7 @@ using Jackett.Services; using NLog; using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Net; using System.Net.Http; @@ -42,7 +43,12 @@ namespace Jackett.Controllers }; } - if (!string.Equals(torznabQuery.ApiKey, serverService.Config.APIKey, StringComparison.InvariantCultureIgnoreCase)) + var allowBadApiDueToDebug = false; +#if DEBUG + allowBadApiDueToDebug = Debugger.IsAttached; +#endif + + if (!allowBadApiDueToDebug && !string.Equals(torznabQuery.ApiKey, serverService.Config.APIKey, StringComparison.InvariantCultureIgnoreCase)) { logger.Warn(string.Format("A request from {0} was made with an incorrect API key.", Request.GetOwinContext().Request.RemoteIpAddress)); return Request.CreateResponse(HttpStatusCode.Forbidden, "Incorrect API key"); diff --git a/src/Jackett/Indexers/BakaBT.cs b/src/Jackett/Indexers/BakaBT.cs new file mode 100644 index 000000000..87b106d32 --- /dev/null +++ b/src/Jackett/Indexers/BakaBT.cs @@ -0,0 +1,246 @@ +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.Globalization; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; +using System.Web; + +namespace Jackett.Indexers +{ + public class BakaBT : BaseIndexer, IIndexer + { + public readonly string SearchUrl = ""; + public readonly string LoginUrl = ""; + private string cookieHeader = ""; + private IWebClient webclient; + + public BakaBT(IIndexerManagerService i, IWebClient wc, Logger l) + : base(name: "BakaBT", + description: "Anime Community", + link: new Uri("http://bakabt.me/"), + caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(), + manager: i, + logger: l) + { + TorznabCaps.Categories.Clear(); + TorznabCaps.Categories.Add(new TorznabCategory { ID = "5070", Name = "TV/Anime" }); + + SearchUrl = SiteLink + "browse.php?only=0&hentai=1&incomplete=1&lossless=1&hd=1&multiaudio=1&bonus=1&c1=1&reorder=1&q="; + LoginUrl = SiteLink + "login.php"; + webclient = wc; + } + + public Task GetConfigurationForSetup() + { + var config = new ConfigurationDataBasicLogin(); + return Task.FromResult((ConfigurationData)config); + } + + public async Task ApplyConfiguration(JToken configJson) + { + var config = new ConfigurationDataBasicLogin(); + config.LoadValuesFromJson(configJson); + + var loginForm = await webclient.GetString(new Utils.Clients.WebRequest() + { + Url = LoginUrl, + Type = RequestType.GET + }); + + var pairs = new Dictionary { + { "username", config.Username.Value }, + { "password", config.Password.Value }, + { "returnto", "/index.php" } + }; + + var response = await webclient.GetString(new Utils.Clients.WebRequest() + { + Url = LoginUrl, + PostData = pairs, + Referer = SiteLink.ToString(), + Type = RequestType.POST, + Cookies = loginForm.Cookies + }); + + cookieHeader = response.Cookies; + if (response.Status == HttpStatusCode.Found) + { + response = await webclient.GetString(new Utils.Clients.WebRequest() + { + Url = SearchUrl, + Cookies = cookieHeader + }); + } + + var responseContent = response.Content; + + if (!responseContent.Contains("Logout")) + { + CQ dom = responseContent; + var messageEl = dom[".error"].First(); + var errorMessage = messageEl.Text().Trim(); + throw new ExceptionWithConfigData(errorMessage, (ConfigurationData)config); + } + else + { + var configSaveData = new JObject(); + configSaveData["cookies"] = cookieHeader; + SaveConfig(configSaveData); + IsConfigured = true; + } + } + + public void LoadFromSavedConfiguration(JToken jsonConfig) + { + cookieHeader = (string)jsonConfig["cookies"]; + IsConfigured = true; + } + + 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.SanitizedSearchTerm)) + { + var splitindex = query.SanitizedSearchTerm.LastIndexOf(' '); + if (splitindex > -1) + query.SanitizedSearchTerm = query.SanitizedSearchTerm.Substring(0, splitindex); + } + + var releases = new List(); + var searchString = query.SanitizedSearchTerm; + var episodeSearchUrl = SearchUrl + HttpUtility.UrlEncode(searchString); + + var response = await webclient.GetString(new Utils.Clients.WebRequest() + { + Url = episodeSearchUrl, + Cookies = cookieHeader + }); + + try + { + CQ dom = response.Content; + var rows = dom[".torrents tr.torrent"]; + + foreach (var row in rows) + { + + var qRow = row.Cq(); + var qTitleLink = qRow.Find("a.title").First(); + var title = qTitleLink.Text().Trim(); + + // Insert before the release info + var taidx = title.IndexOf('('); + var tbidx = title.IndexOf('['); + + if (taidx == -1) + taidx = title.Length; + + if (tbidx == -1) + tbidx = title.Length; + var titleSplit = Math.Min(taidx, tbidx); + var titleSeries = title.Substring(0, titleSplit); + var releaseInfo = title.Substring(titleSplit); + + // For each over each pipe deliminated name + foreach (var name in titleSeries.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)) + { + var release = new ReleaseInfo(); + + release.Title = (name + releaseInfo).Trim(); + // Ensure the season is defined as this tracker only deals with full seasons + if (release.Title.IndexOf("Season") == -1) + { + // Insert before the release info + var aidx = release.Title.IndexOf('('); + var bidx = release.Title.IndexOf('['); + + if (aidx == -1) + aidx = release.Title.Length; + + if (bidx == -1) + bidx = release.Title.Length; + + var insertPoint = Math.Min(aidx, bidx); + release.Title = release.Title.Substring(0, insertPoint) + "Season 1 " + release.Title.Substring(insertPoint); + } + + release.Description = release.Title; + release.Guid = new Uri(SiteLink + qTitleLink.Attr("href")); + release.Comments = release.Guid; + + release.Link = new Uri(SiteLink + qRow.Find(".peers a").First().Attr("href")); + + release.Seeders = int.Parse(qRow.Find(".peers a").Get(0).InnerText); + release.Peers = release.Seeders + int.Parse(qRow.Find(".peers a").Get(1).InnerText); + + var size = qRow.Find(".size").First().Text().Split(' '); + release.Size = ReleaseInfo.GetBytes(size[1], ParseUtil.CoerceFloat(size[0])); + + //22 Jul 15 + var dateStr = qRow.Find(".added . datetime").First().Text().Replace("'", string.Empty); + if (dateStr.Split(' ')[0].Length == 1) + dateStr = "0" + dateStr; + + if (string.Equals(dateStr, "yesterday", StringComparison.InvariantCultureIgnoreCase)) + { + release.PublishDate = DateTime.Now.AddDays(-1); + } + else if (string.Equals(dateStr, "today", StringComparison.InvariantCultureIgnoreCase)) + { + release.PublishDate = DateTime.Now; + } + else + { + release.PublishDate = DateTime.ParseExact(dateStr, "dd MMM yy", CultureInfo.InvariantCulture); + } + + releases.Add(release); + } + } + } + catch (Exception ex) + { + OnParseError(response.Content, ex); + } + + return releases.ToArray(); + } + + public async Task Download(Uri link) + { + var downloadPage = await webclient.GetString(new Utils.Clients.WebRequest() + { + Url = link.ToString(), + Cookies = cookieHeader + }); + + CQ dom = downloadPage.Content; + var downloadLink = dom.Find(".download_link").First().Attr("href"); + + if (string.IsNullOrWhiteSpace(downloadLink)) + { + throw new Exception("Unable to find download link."); + } + + downloadLink = SiteLink + downloadLink; + + var response = await webclient.GetBytes(new Utils.Clients.WebRequest() + { + Url = downloadLink, + Cookies = cookieHeader + }); + + return response.Content; + } + } +} diff --git a/src/Jackett/Jackett.csproj b/src/Jackett/Jackett.csproj index 492776118..5ec664aa1 100644 --- a/src/Jackett/Jackett.csproj +++ b/src/Jackett/Jackett.csproj @@ -27,6 +27,8 @@ false false true + + AnyCPU @@ -84,15 +86,15 @@ ..\packages\Microsoft.Owin.FileSystems.3.0.1\lib\net45\Microsoft.Owin.FileSystems.dll True - - ..\packages\Microsoft.Owin.Host.HttpListener.2.0.2\lib\net45\Microsoft.Owin.Host.HttpListener.dll + + ..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll True ..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll - - ..\packages\Microsoft.Owin.Hosting.2.0.2\lib\net45\Microsoft.Owin.Hosting.dll + + ..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll True @@ -153,6 +155,7 @@ + @@ -242,7 +245,9 @@ PreserveNewest - + + Designer + PreserveNewest @@ -272,7 +277,9 @@ PreserveNewest - + + PreserveNewest + PreserveNewest @@ -427,9 +434,11 @@ - - - - + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + \ No newline at end of file diff --git a/src/Jackett/Models/TorznabQuery.cs b/src/Jackett/Models/TorznabQuery.cs index cbc3fdc75..d27698517 100644 --- a/src/Jackett/Models/TorznabQuery.cs +++ b/src/Jackett/Models/TorznabQuery.cs @@ -11,18 +11,18 @@ namespace Jackett.Models { public class TorznabQuery { - public string QueryType { get; private set; } - public string[] Categories { get; private set; } - public int Extended { get; private set; } - public string ApiKey { get; private set; } - public int Limit { get; private set; } - public int Offset { get; private set; } - public int RageID { get; private set; } + public string QueryType { get; set; } + public string[] Categories { get; set; } + public int Extended { get; set; } + public string ApiKey { get; set; } + public int Limit { get; set; } + public int Offset { get; set; } + public int RageID { get; set; } - public int Season { get; private set; } - public string Episode { get; private set; } - public string SearchTerm { get; private set; } - public string SanitizedSearchTerm { get; private set; } + public int Season { get; set; } + public string Episode { get; set; } + public string SearchTerm { get; set; } + public string SanitizedSearchTerm { get; set; } public string GetEpisodeSearchString() { diff --git a/src/Jackett/Utils/Clients/UnixLibCurlWebClient.cs b/src/Jackett/Utils/Clients/UnixLibCurlWebClient.cs index e1d39c323..db0405788 100644 --- a/src/Jackett/Utils/Clients/UnixLibCurlWebClient.cs +++ b/src/Jackett/Utils/Clients/UnixLibCurlWebClient.cs @@ -9,7 +9,6 @@ using System.Net; using System.Net.Http; using System.Text; using System.Threading.Tasks; -using static Jackett.CurlHelper; namespace Jackett.Utils.Clients { @@ -24,7 +23,7 @@ namespace Jackett.Utils.Clients public async Task GetBytes(WebRequest request) { - CurlResponse response; + Jackett.CurlHelper.CurlResponse response; logger.Debug(string.Format("UnixLibCurlWebClient:GetBytes(Url:{0})", request.Url)); diff --git a/src/Jackett/Utils/Clients/WebRequest.cs b/src/Jackett/Utils/Clients/WebRequest.cs index b18e6a860..5dd60ea9b 100644 --- a/src/Jackett/Utils/Clients/WebRequest.cs +++ b/src/Jackett/Utils/Clients/WebRequest.cs @@ -19,6 +19,56 @@ namespace Jackett.Utils.Clients public string Cookies { get; set; } public string Referer { get; set; } public RequestType Type { get; set; } + + public override bool Equals(System.Object obj) + { + if(obj is WebRequest) + { + var other = obj as WebRequest; + var postDataSame = PostData == null && other.PostData == null; + if (!postDataSame) + { + if (!(PostData == null || other.PostData == null)) + { + var ok = PostData.Count == other.PostData.Count; + foreach(var i in PostData) + { + if (!other.PostData.ContainsKey(i.Key)) + { + ok = false; + break; + } + + if(PostData[i.Key] != other.PostData[i.Key]) + { + ok = false; + break; + } + } + + if (ok) + { + postDataSame = true; + } + } + } + + return other.Url == Url && + other.Referer == Referer && + other.Cookies == Cookies && + other.Type == Type && + postDataSame; + + } else + { + return false; + } + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } } public enum RequestType diff --git a/src/Jackett/packages.config b/src/Jackett/packages.config index 692eb46c7..98ab658a1 100644 --- a/src/Jackett/packages.config +++ b/src/Jackett/packages.config @@ -1,28 +1,28 @@  - - - - - - + + + + + + - - - - + + + + - + - - - + + + - - - - - - + + + + + + \ No newline at end of file