Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cardigann: fix search paths #14493

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Jackett.Common/Definitions/2xfree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ login:
search:
paths:
- path: torrents.php
categories: [401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 413, 420, 421, 422, 423, 424]
categories: ["!", 526, 527, 528, 529, 530, 531, 532]
- path: special.php
categories: [526, 527, 528, 529, 530, 531, 532]
inputs:
Expand Down
2 changes: 1 addition & 1 deletion src/Jackett.Common/Definitions/3wmg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ login:
search:
paths:
- path: torrents.php
categories: [401, 402, 403, 404, 405, 406, 407, 409, 410]
categories: ["!", 411, 412, 413, 414, 415, 416]
- path: special.php
categories: [411, 412, 413, 414, 415, 416]
inputs:
Expand Down
2 changes: 1 addition & 1 deletion src/Jackett.Common/Definitions/bitbazis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ login:
search:
paths:
- path: browse.php
categories: [85, 86, 15, 16, 17, 19, 83, 82, 94, 95, 92, 93, 22, 58, 64, 24, 70, 27, 50, 69, 68, 91, 25, 26, 84, 71, 31, 54, 81, 67, 49, 14, 65, 97]
categories: ["!", 33, 66, 89]
inputs:
# 0 all, 1 active, 2 deadonly, 3 myuploads, 4 zeroseed, 6 re-seeded
incldead: 0
Expand Down
2 changes: 1 addition & 1 deletion src/Jackett.Common/Definitions/carphunter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ login:
search:
paths:
- path: browse.php
categories: [1, 2, 8, 7, 16, 15, 14, 13, 4, 3, 18, 17, 23, 19, 20, 24, 21, 22, 35, 36, 25, 30, 31, 33, 32, 29, 28, 27, 26]
categories: ["!", 34, 39]
- path: browse.php
categories: [34, 39]
inputs:
Expand Down
2 changes: 1 addition & 1 deletion src/Jackett.Common/Definitions/freefarm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ login:
search:
paths:
- path: torrents.php
categories: [401, 402, 403, 404, 405, 406, 407, 408, 428]
categories: ["!", 413, 414, 415, 416, 417, 426]
- path: special.php
categories: [413, 414, 415, 416, 417, 426]
inputs:
Expand Down
2 changes: 1 addition & 1 deletion src/Jackett.Common/Definitions/haitang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ login:
search:
paths:
- path: torrents.php
categories: [1, 4091, 4097, 4098, 4099, 4101, 4104, 4105]
categories: ["!", 4103]
- path: live.php
categories: [4103]
inputs:
Expand Down
2 changes: 1 addition & 1 deletion src/Jackett.Common/Definitions/icc2022.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ login:
search:
paths:
- path: torrents.php
categories: [401, 402, 403, 404, 405, 406, 407, 408, 409]
categories: ["!", 410, 411, 412]
- path: special.php
categories: [410, 411, 412]
inputs:
Expand Down
5 changes: 3 additions & 2 deletions src/Jackett.Common/Definitions/lastfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ caps:
- {id: 57, cat: TV/Documentary, desc: "Documentary-Ro", default: true}
- {id: 58, cat: Movies/SD, desc: "Movies: Cam", default: true}
- {id: 59, cat: Movies/SD, desc: "Movies: Cam-Ro", default: true}
- {id: 60, cat: XXX/ImageSet, desc: "Images: XXX", default: false}
- {id: 61, cat: Movies/3D, desc: "Movies: 3D", default: true}
- {id: 62, cat: Movies/3D, desc: "Movies: 3D-Ro", default: true}
- {id: 81, cat: Movies/HD, desc: "Movies: x265-Ro", default: true}
Expand Down Expand Up @@ -120,9 +121,9 @@ search:
# https://www.last-torrents.org/externalid?searchex=tt5834760&search_by=imdbid
# cannot support imdbid or tmdbid searches while using path category filters
- path: browse.php
categories: [1, 2, 5, 6, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 28, 30, 31, 32, 33, 42, 43, 44, 49, 51, 54, 55, 56, 57, 58, 59, 60, 61, 62, 81, 82]
categories: ["!", 27, 60]
- path: browseadult.php
categories: [27]
categories: [27, 60]

keywordsfilters:
- name: re_replace
Expand Down
4 changes: 2 additions & 2 deletions src/Jackett.Common/Definitions/majomparade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ login:
search:
paths:
- path: letoltes.php
categories: [4, 5, 48, 50, 75, 76, 26, 25, 58, 59, 42, 51, 38, 24, 85, 87, 47, 36, 6, 7, 56, 33, 44, 28, 32, 30, 53, 74, 40, 41, 34, 35, 46]
categories: ["!", 70, 39, 57]
inputs:
tipus: 1
- path: letoltes.php
categories: [4, 5, 48, 50, 75, 76, 26, 25, 58, 59, 42, 51, 38, 24, 85, 87, 47, 36, 6, 7, 56, 33, 44, 28, 32, 30, 53, 74, 40, 41, 34, 35, 46]
categories: ["!", 70, 39, 57]
inputs:
tipus: 2
- path: xxx.php
Expand Down
2 changes: 1 addition & 1 deletion src/Jackett.Common/Definitions/pignetwork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ login:
search:
paths:
- path: torrents.php
categories: [401, 402, 403, 404, 405, 406, 407, 408, 409]
categories: ["!", 905, 907, 908, 909]
- path: special.php
categories: [905, 907, 908, 909]
inputs:
Expand Down
2 changes: 1 addition & 1 deletion src/Jackett.Common/Definitions/pttime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ login:
search:
paths:
- path: torrents.php
categories: [401, 402, 403, 404, 405, 406, 408, 409, 411, 412, 413, 420, 430, 431, 432, 450, 451, 490]
categories: ["!", 440, 441, 442, 443, 444, 445, 446, 447]
- path: adults.php
categories: [440, 441, 442, 443, 444, 445, 446, 447]
inputs:
Expand Down
2 changes: 1 addition & 1 deletion src/Jackett.Common/Definitions/siambit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ download:
search:
paths:
- path: viewno18sb.php
categories: [1, 75, 10, 9, 110, 7, 40, 16, 3, 70, 100, 85, 105, 8, 56, 19, 20, 55, 21, 2, 130, 60, 90, 91, 92, 89, 93, 4, 50, 18, 17, 11, 5, 54, 51, 52, 57, 53]
categories: ["!", 901, 902, 903, 904, 905, 906, 907, 908, 910, 911, 912]
- path: viewbrsb.php
categories: [901, 902, 903, 904, 905, 906, 907, 908, 910, 911, 912]
inputs:
Expand Down
2 changes: 1 addition & 1 deletion src/Jackett.Common/Definitions/teamctgame.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ login:
search:
paths:
- path: torrents.php
categories: [409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453]
categories: ["!", 435]
- path: special.php
categories: [435]
inputs:
Expand Down
25 changes: 13 additions & 12 deletions src/Jackett.Common/Indexers/CardigannIndexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1414,26 +1414,27 @@ protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuer
var SearchPaths = Search.Paths;
foreach (var SearchPath in SearchPaths)
{
variables[".Categories"] = mappedCategories;
var localMappedCategories = mappedCategories;
variables[".Categories"] = localMappedCategories;

// skip path if categories don't match
if (SearchPath.Categories.Count > 0)
{
var hasIntersect = mappedCategories.Intersect(SearchPath.Categories).Any();

if (SearchPath.Categories[0] == "!")
if (localMappedCategories.Count == 0)
{
hasIntersect = !hasIntersect;
localMappedCategories = GetAllTrackerCategories();
}

if (!hasIntersect)
{
variables[".Categories"] = mappedCategories.Except(SearchPath.Categories).ToList();
var categories = SearchPath.Categories[0] == "!"
? localMappedCategories.Except(SearchPath.Categories).ToList()
: localMappedCategories.Intersect(SearchPath.Categories).ToList();

if (!categories.Any())
{
continue;
}

variables[".Categories"] = mappedCategories.Intersect(SearchPath.Categories).ToList();
variables[".Categories"] = categories;
}

// build search URL
Expand Down Expand Up @@ -1484,11 +1485,11 @@ protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuer
}
}

if (method == RequestType.GET)
if (method == RequestType.GET && queryCollection.Count > 0)
{
if (queryCollection.Count > 0)
searchUrl += "?" + queryCollection.GetQueryString(Encoding);
searchUrl += "?" + queryCollection.GetQueryString(Encoding);
}

var searchUrlUri = new Uri(searchUrl);

// send HTTP request
Expand Down