From 67e054468d44e85ce6808c62b675091239cffc0f Mon Sep 17 00:00:00 2001 From: ilike2burnthing <59480337+ilike2burnthing@users.noreply.github.com> Date: Wed, 19 Jan 2022 23:53:45 +0000 Subject: [PATCH] cardigann: fix .query.season (#12857) Co-authored-by: Qstick --- src/Jackett.Common/Definitions/blutopia-api.yml | 13 +++++++++++-- src/Jackett.Common/Indexers/CardigannIndexer.cs | 14 +++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/Jackett.Common/Definitions/blutopia-api.yml b/src/Jackett.Common/Definitions/blutopia-api.yml index 85c7404fc..90c97950e 100644 --- a/src/Jackett.Common/Definitions/blutopia-api.yml +++ b/src/Jackett.Common/Definitions/blutopia-api.yml @@ -63,10 +63,19 @@ search: paths: # https://hdinnovations.github.io/UNIT3D-Community-Edition-Docs/api_endpoints.html # https://github.com/HDInnovations/UNIT3D-Community-Edition/blob/master/app/Http/Controllers/API/TorrentController.php - - path: "/api/torrents/filter?api_token={{ .Config.apikey }}&name={{ if .Query.IMDBID }}{{ else }}{{ .Keywords }}{{ end }}{{ if .Query.TMDBID }}&tmdbId={{ .Query.TMDBID }}{{ else }}{{ end }}{{ if .Query.IMDBIDShort }}&imdbId={{ .Query.IMDBIDShort }}{{ else }}{{ end }}{{ if .Query.TVDBID }}&tvdbId={{ .Query.TVDBID }}{{ else }}{{ end }}&sortField={{ .Config.sort }}&sortDirection={{ .Config.type }}&perPage=100&page=1{{ range .Categories }}&categories[]={{.}}{{end}}{{ if .Config.freeleech }}&free=1{{ else }}{{ end }}" + - path: "/api/torrents/filter" response: type: json attribute: attributes + inputs: + # if we have an id based search, add Season and Episode as query in name for UNIT3D < v6. Else pass S/E Params for UNIT3D >= v6 + api_token: "{{ .Config.apikey }}" + name: "{{ .Keywords }}" + $raw: "{{ if .Query.Season }}&seasonNumber={{ .Query.Season }}{{ else }}{{ end }}{{ if .Query.Ep }}&episodeNumber={{ .Query.Ep }}{{ else }}{{ end }}{{ if .Query.TMDBID }}&tmdbId={{ .Query.TMDBID }}{{ else }}{{ end }}{{ if .Query.IMDBIDShort }}&imdbId={{ .Query.IMDBIDShort }}{{ else }}{{ end }}{{ if .Query.TVDBID }}&tvdbId={{ .Query.TVDBID }}{{ else }}{{ end }}{{ range .Categories }}&categories[]={{.}}{{end}}{{ if .Config.freeleech }}&free=1{{ else }}{{ end }}" + sortField: "{{ .Config.sort }}" + sortDirection: "{{ .Config.type }}" + perPage: 100 + page: 1 keywordsfilters: - name: re_replace @@ -134,4 +143,4 @@ search: minimumseedtime: # 7 day (as seconds = 7 x 24 x 60 x 60) text: 604800 -# json UNIT3D 5.3.1b +# json UNIT3D 6.0.0 beta diff --git a/src/Jackett.Common/Indexers/CardigannIndexer.cs b/src/Jackett.Common/Indexers/CardigannIndexer.cs index 9012d4f3e..e41f62ba3 100644 --- a/src/Jackett.Common/Indexers/CardigannIndexer.cs +++ b/src/Jackett.Common/Indexers/CardigannIndexer.cs @@ -1259,19 +1259,19 @@ namespace Jackett.Common.Indexers variables[".Query.Q"] = query.SearchTerm; variables[".Query.Series"] = null; variables[".Query.Ep"] = query.Episode; - variables[".Query.Season"] = query.Season; + variables[".Query.Season"] = query.Season > 0 ? query.Season.ToString() : null; variables[".Query.Movie"] = null; - variables[".Query.Year"] = query.Year.ToString(); - variables[".Query.Limit"] = query.Limit.ToString(); - variables[".Query.Offset"] = query.Offset.ToString(); + variables[".Query.Year"] = query.Year?.ToString() ?? null; + variables[".Query.Limit"] = query.Limit.ToString() ?? null; + variables[".Query.Offset"] = query.Offset.ToString() ?? null; variables[".Query.Extended"] = query.Extended.ToString(); variables[".Query.Categories"] = query.Categories; variables[".Query.APIKey"] = query.ApiKey; - variables[".Query.TVDBID"] = query.TvdbID.ToString(); - variables[".Query.TVRageID"] = query.RageID; + variables[".Query.TVDBID"] = query.TvdbID?.ToString() ?? null; + variables[".Query.TVRageID"] = query.RageID?.ToString() ?? null; variables[".Query.IMDBID"] = query.ImdbID; variables[".Query.IMDBIDShort"] = query.ImdbIDShort; - variables[".Query.TMDBID"] = query.TmdbID.ToString(); + variables[".Query.TMDBID"] = query.TmdbID?.ToString() ?? null; variables[".Query.TVMazeID"] = null; variables[".Query.TraktID"] = null; variables[".Query.Album"] = query.Album;