cardigann: add album, artist, year, and genre fields. #13376 (#13384)

Follow up to #13376.

Based on:
7e0f88ad7a
579b8a3d3b

Added new elements to ResultPage, as well as doubanid as it was missing. Rearranged a few for greater consistency with ReleaseInfo (same with CardigannIndexer).

Added missing TVDBId to ReleaseInfo.
This commit is contained in:
ilike2burnthing 2022-07-21 05:11:40 +01:00 committed by GitHub
parent f314668979
commit d399e7dac8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 63 additions and 35 deletions

View File

@ -45,14 +45,14 @@ search:
title_alternative: title_alternative:
selector: ..names.alternative selector: ..names.alternative
optional: true optional: true
_year: year:
selector: ..season.year selector: ..season.year
_quality: _quality:
selector: quality.string selector: quality.string
_series: _series:
selector: series.string selector: series.string
title: title:
text: "{{ .Result.title_ru }} / {{ .Result.title_en }}{{ if .Result.title_alternative }} / {{ .Result.title_alternative }}{{ else }}{{ end }} [{{ .Result._quality }}] - {{ .Result._series }}" text: "{{ .Result.title_ru }} / {{ .Result.title_en }}{{ if .Result.title_alternative }} / {{ .Result.title_alternative }}{{ else }}{{ end }} ({{ .Result.year }}) [{{ .Result._quality }}] - {{ .Result._series }}"
_code: _code:
selector: ..code selector: ..code
details: details:

View File

@ -288,7 +288,7 @@ search:
fields: fields:
category: category:
text: 1 text: 1
_year: year:
selector: div.shor_subtitles span selector: div.shor_subtitles span
filters: filters:
- name: regexp - name: regexp
@ -297,7 +297,7 @@ search:
selector: div.short_titles > a selector: div.short_titles > a
filters: filters:
- name: append - name: append
args: " [{{ .Result._year }}]" args: " [{{ .Result.year }}]"
details: details:
selector: div.short_titles > a selector: div.short_titles > a
attribute: href attribute: href

View File

@ -174,10 +174,10 @@ search:
title_desc: title_desc:
optional: true optional: true
selector: title selector: title
_year_desc: year_desc:
optional: true optional: true
selector: year selector: year
_genres_desc: genre_desc:
optional: true optional: true
selector: genres selector: genres
_tagline_desc: _tagline_desc:
@ -222,5 +222,5 @@ search:
- name: regexp - name: regexp
args: "(.+?), $" args: "(.+?), $"
description: description:
text: "{{ if .Result.title_desc }}Title: {{ .Result.title_desc }}</br>{{ else }}{{ end }}{{ if .Result._year_desc }}Year: {{ .Result._year_desc }}</br>{{ else }}{{ end }}{{ if .Result._genres_desc }}Genres: {{ .Result._genres_desc }}</br>{{ else }}{{ end }}{{ if .Result._tagline_desc }}Tagline: {{ .Result._tagline_desc }}</br>{{ else }}{{ end }}{{ if .Result._cast_desc }}Cast: {{ .Result._cast_desc }}</br>{{ else }}{{ end }}{{ if .Result._rating_desc }}Rating: {{ .Result._rating_desc }}</br>{{ else }}{{ end }}{{ if .Result._tag_desc }}Tags: {{ .Result._tag_desc }}</br>{{ else }}{{ end }}{{ if .Result._predate_desc }}PRE: {{ .Result._predate_desc }}</br>{{ else }}{{ end }}{{ if .Result._section_desc }}Section: {{ .Result._section_desc }}{{ else }}{{ end }}" text: "{{ if .Result.title_desc }}Title: {{ .Result.title_desc }}</br>{{ else }}{{ end }}{{ if .Result.year_desc }}Year: {{ .Result.year_desc }}</br>{{ else }}{{ end }}{{ if .Result.genre_desc }}Genres: {{ .Result.genre_desc }}</br>{{ else }}{{ end }}{{ if .Result._tagline_desc }}Tagline: {{ .Result._tagline_desc }}</br>{{ else }}{{ end }}{{ if .Result._cast_desc }}Cast: {{ .Result._cast_desc }}</br>{{ else }}{{ end }}{{ if .Result._rating_desc }}Rating: {{ .Result._rating_desc }}</br>{{ else }}{{ end }}{{ if .Result._tag_desc }}Tags: {{ .Result._tag_desc }}</br>{{ else }}{{ end }}{{ if .Result._predate_desc }}PRE: {{ .Result._predate_desc }}</br>{{ else }}{{ end }}{{ if .Result._section_desc }}Section: {{ .Result._section_desc }}{{ else }}{{ end }}"
# json rartracker api v1 # json rartracker api v1

View File

@ -112,7 +112,7 @@ search:
filters: filters:
- name: querystring - name: querystring
args: cat args: cat
_year: year:
optional: true optional: true
selector: div.video_year selector: div.video_year
filters: filters:
@ -122,7 +122,7 @@ search:
selector: a.video_name_str selector: a.video_name_str
filters: filters:
- name: append - name: append
args: "{{ .Result._year }}" args: "{{ .Result.year }}"
details: details:
selector: a.video_name_str selector: a.video_name_str
attribute: href attribute: href

View File

@ -66,7 +66,7 @@ search:
selector: tbody#highlighted tr selector: tbody#highlighted tr
fields: fields:
_year: year:
selector: td:nth-child(2) a:nth-child(1) selector: td:nth-child(2) a:nth-child(1)
filters: filters:
- name: regexp # find torrent year - name: regexp # find torrent year
@ -108,7 +108,7 @@ search:
- name: re_replace # remove various - name: re_replace # remove various
args: ["(?i)(Serie completa|Completa|\\[in pausa\\])", ""] args: ["(?i)(Serie completa|Completa|\\[in pausa\\])", ""]
- name: append - name: append
args: " ({{ .Result._year }}) [{{ .Result._quality }} - {{ .Result._audio }} ITA]" args: " ({{ .Result.year }}) [{{ .Result._quality }} - {{ .Result._audio }} ITA]"
- name: re_replace # replace multiple spaces - name: re_replace # replace multiple spaces
args: ["[ ]{2,}", " "] args: ["[ ]{2,}", " "]
details: details:

View File

@ -85,7 +85,7 @@ search:
img[title^="Movie"]: 1 img[title^="Movie"]: 1
img[title^="Music"]: 2 img[title^="Music"]: 2
img[title^="Literature"]: 3 img[title^="Literature"]: 3
_year: year:
selector: a[href$="search_type=year"] selector: a[href$="search_type=year"]
optional: true optional: true
_flag: _flag:
@ -104,7 +104,7 @@ search:
selector: a[href^="details.php?id="] selector: a[href^="details.php?id="]
filters: filters:
- name: append - name: append
args: " {{ .Result._year }} {{ .Result._flag }} [{{ .Result._filename }}]" args: " {{ .Result.year }} {{ .Result._flag }} [{{ .Result._filename }}]"
details: details:
selector: a[href^="details.php?id="] selector: a[href^="details.php?id="]
attribute: href attribute: href

View File

@ -175,10 +175,10 @@ search:
title_desc: title_desc:
optional: true optional: true
selector: title selector: title
_year_desc: year_desc:
optional: true optional: true
selector: year selector: year
_genres_desc: genre_desc:
optional: true optional: true
selector: genres selector: genres
_tagline_desc: _tagline_desc:
@ -263,5 +263,5 @@ search:
- name: regexp - name: regexp
args: "(.+?), $" args: "(.+?), $"
description: description:
text: "{{ if .Result.title_desc }}Title: {{ .Result.title_desc }}</br>{{ else }}{{ end }}{{ if .Result._year_desc }}Year: {{ .Result._year_desc }}</br>{{ else }}{{ end }}{{ if .Result._genres_desc }}Genres: {{ .Result._genres_desc }}</br>{{ else }}{{ end }}{{ if .Result._tagline_desc }}Tagline: {{ .Result._tagline_desc }}</br>{{ else }}{{ end }}{{ if .Result._cast_desc }}Cast: {{ .Result._cast_desc }}</br>{{ else }}{{ end }}{{ if .Result._rating_desc }}Rating: {{ .Result._rating_desc }}</br>{{ else }}{{ end }}{{ if .Result._plot_desc }}Plot: {{ .Result._plot_desc }}</br>{{ else }}{{ end }}{{ if .Result._tag_desc }}Tags: {{ .Result._tag_desc }}</br>{{ else }}{{ end }}{{ if .Result._predate_desc }}PRE: {{ .Result._predate_desc }}</br>{{ else }}{{ end }}{{ if .Result._section_desc }}Section: {{ .Result._section_desc }}{{ else }}{{ end }}" text: "{{ if .Result.title_desc }}Title: {{ .Result.title_desc }}</br>{{ else }}{{ end }}{{ if .Result.year_desc }}Year: {{ .Result.year_desc }}</br>{{ else }}{{ end }}{{ if .Result.genre_desc }}Genres: {{ .Result.genre_desc }}</br>{{ else }}{{ end }}{{ if .Result._tagline_desc }}Tagline: {{ .Result._tagline_desc }}</br>{{ else }}{{ end }}{{ if .Result._cast_desc }}Cast: {{ .Result._cast_desc }}</br>{{ else }}{{ end }}{{ if .Result._rating_desc }}Rating: {{ .Result._rating_desc }}</br>{{ else }}{{ end }}{{ if .Result._plot_desc }}Plot: {{ .Result._plot_desc }}</br>{{ else }}{{ end }}{{ if .Result._tag_desc }}Tags: {{ .Result._tag_desc }}</br>{{ else }}{{ end }}{{ if .Result._predate_desc }}PRE: {{ .Result._predate_desc }}</br>{{ else }}{{ end }}{{ if .Result._section_desc }}Section: {{ .Result._section_desc }}{{ else }}{{ end }}"
# json rartracker api v1 # json rartracker api v1

View File

@ -104,7 +104,7 @@ search:
attribute: href attribute: href
size: size:
selector: td:nth-child(5) selector: td:nth-child(5)
_artist: artist:
selector: span.artist selector: span.artist
optional: true optional: true
_tag: _tag:
@ -117,7 +117,7 @@ search:
selector: td:nth-child(7) selector: td:nth-child(7)
optional: true optional: true
description: description:
text: "Artist=[{{ .Result._artist }}] , Tags={{ .Result._tag }} , Codec=[{{ .Result._codec }}] , BitRate=[{{ .Result._bit }}]" text: "Artist=[{{ .Result.artist }}] , Tags={{ .Result._tag }} , Codec=[{{ .Result._codec }}] , BitRate=[{{ .Result._bit }}]"
grabs: grabs:
selector: td:nth-child(8) selector: td:nth-child(8)
seeders: seeders:

View File

@ -56,12 +56,12 @@ search:
attribute: src attribute: src
_subcat: _subcat:
selector: div.box ul li:first-child selector: div.box ul li:first-child
_year: year:
selector: div.box ul li:contains("Year:") selector: div.box ul li:contains("Year:")
_quality: _quality:
selector: div.box ul li:contains("Quality:") selector: div.box ul li:contains("Quality:")
description: description:
text: "{{ .Result._subcat }} {{ .Result._year }} {{ .Result._quality }}" text: "{{ .Result._subcat }} {{ .Result.year }} {{ .Result._quality }}"
date: date:
text: now text: now
size: size:

View File

@ -84,7 +84,7 @@ search:
"*": 45 "*": 45
_type: _type:
selector: type selector: type
_year: year:
selector: ..year selector: ..year
title: title:
selector: ..title selector: ..title
@ -95,7 +95,7 @@ search:
args: [" ", "."] args: [" ", "."]
# append type: BRRip or WEBRip, resolves #3558 via #4577 # append type: BRRip or WEBRip, resolves #3558 via #4577
- name: append - name: append
args: ".{{ .Result._year }}.{{ .Result._quality }}.{{ if eq .Result._type \"web\" }}WEBRip{{ else }}BRRip{{ end }}-YTS" args: ".{{ .Result.year }}.{{ .Result._quality }}.{{ if eq .Result._type \"web\" }}WEBRip{{ else }}BRRip{{ end }}-YTS"
_sitelink_trimmed: _sitelink_trimmed:
text: "{{ .Config.sitelink }}" text: "{{ .Config.sitelink }}"
filters: filters:

View File

@ -38,7 +38,7 @@ namespace Jackett.Common.Indexers
set => base.configData = value; set => base.configData = value;
} }
protected readonly string[] OptionalFields = { "imdb", "imdbid", "rageid", "tmdbid", "tvdbid", "poster", "description", "doubanid" }; protected readonly string[] OptionalFields = { "imdb", "imdbid", "tmdbid", "rageid", "tvdbid", "doubanid", "poster", "description" };
private static readonly string[] _SupportedLogicFunctions = private static readonly string[] _SupportedLogicFunctions =
{ {
@ -2043,13 +2043,6 @@ namespace Jackett.Common.Indexers
release.TMDb = ParseUtil.CoerceLong(TmdbID); release.TMDb = ParseUtil.CoerceLong(TmdbID);
value = release.TMDb.ToString(); value = release.TMDb.ToString();
break; break;
case "doubanid":
var DoubanIDRegEx = new Regex(@"(\d+)", RegexOptions.Compiled);
var DoubanIDMatch = DoubanIDRegEx.Match(value);
var DoubanID = DoubanIDMatch.Groups[1].Value;
release.DoubanId = ParseUtil.CoerceLong(DoubanID);
value = release.DoubanId.ToString();
break;
case "rageid": case "rageid":
var RageIDRegEx = new Regex(@"(\d+)", RegexOptions.Compiled); var RageIDRegEx = new Regex(@"(\d+)", RegexOptions.Compiled);
var RageIDMatch = RageIDRegEx.Match(value); var RageIDMatch = RageIDRegEx.Match(value);
@ -2064,12 +2057,33 @@ namespace Jackett.Common.Indexers
release.TVDBId = ParseUtil.CoerceLong(TVDBId); release.TVDBId = ParseUtil.CoerceLong(TVDBId);
value = release.TVDBId.ToString(); value = release.TVDBId.ToString();
break; break;
case "doubanid":
var DoubanIDRegEx = new Regex(@"(\d+)", RegexOptions.Compiled);
var DoubanIDMatch = DoubanIDRegEx.Match(value);
var DoubanID = DoubanIDMatch.Groups[1].Value;
release.DoubanId = ParseUtil.CoerceLong(DoubanID);
value = release.DoubanId.ToString();
break;
case "genre":
release.Genres = release.Genres.Union(value.Split(',')).ToList();
value = release.Genres.ToString();
break;
case "year":
release.Year = ReleaseInfo.GetBytes(value);
value = release.Year.ToString();
break;
case "author": case "author":
release.Author = value; release.Author = value;
break; break;
case "booktitle": case "booktitle":
release.BookTitle = value; release.BookTitle = value;
break; break;
case "artist":
release.Artist = value;
break;
case "album":
release.Album = value;
break;
case "poster": case "poster":
if (!string.IsNullOrWhiteSpace(value)) if (!string.IsNullOrWhiteSpace(value))
{ {

View File

@ -25,8 +25,12 @@ namespace Jackett.Common.Models
public long? Imdb { get; set; } public long? Imdb { get; set; }
public long? TMDb { get; set; } public long? TMDb { get; set; }
public long? DoubanId { get; set; } public long? DoubanId { get; set; }
public ICollection<string> Genres { get; set; }
public long? Year { get; set; }
public string Author { get; set; } public string Author { get; set; }
public string BookTitle { get; set; } public string BookTitle { get; set; }
public string Artist { get; set; }
public string Album { get; set; }
public long? Seeders { get; set; } public long? Seeders { get; set; }
public long? Peers { get; set; } public long? Peers { get; set; }
public Uri Poster { get; set; } public Uri Poster { get; set; }
@ -60,11 +64,16 @@ namespace Jackett.Common.Models
Grabs = copyFrom.Grabs; Grabs = copyFrom.Grabs;
Description = copyFrom.Description; Description = copyFrom.Description;
RageID = copyFrom.RageID; RageID = copyFrom.RageID;
TVDBId = copyFrom.TVDBId;
Imdb = copyFrom.Imdb; Imdb = copyFrom.Imdb;
TMDb = copyFrom.TMDb; TMDb = copyFrom.TMDb;
DoubanId = copyFrom.DoubanId; DoubanId = copyFrom.DoubanId;
Genres = copyFrom.Genres;
Year = copyFrom.Year;
Author = copyFrom.Author; Author = copyFrom.Author;
BookTitle = copyFrom.BookTitle; BookTitle = copyFrom.BookTitle;
Artist = copyFrom.Artist;
Album = copyFrom.Album;
Seeders = copyFrom.Seeders; Seeders = copyFrom.Seeders;
Peers = copyFrom.Peers; Peers = copyFrom.Peers;
Poster = copyFrom.Poster; Poster = copyFrom.Poster;

View File

@ -94,22 +94,27 @@ namespace Jackett.Common.Models
new XAttribute("type", "application/x-bittorrent") new XAttribute("type", "application/x-bittorrent")
), ),
r.Category == null ? null : from c in r.Category select GetTorznabElement("category", c), r.Category == null ? null : from c in r.Category select GetTorznabElement("category", c),
GetTorznabElement("imdb", r.Imdb?.ToString("D7")),
GetTorznabElement("imdbid", r.Imdb != null ? "tt" + r.Imdb?.ToString("D7") : null),
GetTorznabElement("rageid", r.RageID), GetTorznabElement("rageid", r.RageID),
GetTorznabElement("tvdbid", r.TVDBId), GetTorznabElement("tvdbid", r.TVDBId),
GetTorznabElement("imdb", r.Imdb?.ToString("D7")),
GetTorznabElement("imdbid", r.Imdb != null ? "tt" + r.Imdb?.ToString("D7") : null),
GetTorznabElement("tmdbid", r.TMDb), GetTorznabElement("tmdbid", r.TMDb),
GetTorznabElement("doubanid", r.DoubanId),
r.Genres == null ? null : GetTorznabElement("genre", string.Join(", ", r.Genres)),
GetTorznabElement("year", r.Year),
GetTorznabElement("author", RemoveInvalidXMLChars(r.Author)), GetTorznabElement("author", RemoveInvalidXMLChars(r.Author)),
GetTorznabElement("booktitle", RemoveInvalidXMLChars(r.BookTitle)), GetTorznabElement("booktitle", RemoveInvalidXMLChars(r.BookTitle)),
GetTorznabElement("artist", RemoveInvalidXMLChars(r.Artist)),
GetTorznabElement("album", RemoveInvalidXMLChars(r.Album)),
GetTorznabElement("seeders", r.Seeders), GetTorznabElement("seeders", r.Seeders),
GetTorznabElement("peers", r.Peers), GetTorznabElement("peers", r.Peers),
GetTorznabElement("magneturl", r.MagnetUri?.AbsoluteUri), GetTorznabElement("coverurl", r.Poster?.AbsoluteUri),
GetTorznabElement("infohash", RemoveInvalidXMLChars(r.InfoHash)), GetTorznabElement("infohash", RemoveInvalidXMLChars(r.InfoHash)),
GetTorznabElement("magneturl", r.MagnetUri?.AbsoluteUri),
GetTorznabElement("minimumratio", r.MinimumRatio), GetTorznabElement("minimumratio", r.MinimumRatio),
GetTorznabElement("minimumseedtime", r.MinimumSeedTime), GetTorznabElement("minimumseedtime", r.MinimumSeedTime),
GetTorznabElement("downloadvolumefactor", r.DownloadVolumeFactor), GetTorznabElement("downloadvolumefactor", r.DownloadVolumeFactor),
GetTorznabElement("uploadvolumefactor", r.UploadVolumeFactor), GetTorznabElement("uploadvolumefactor", r.UploadVolumeFactor)
GetTorznabElement("coverurl", r.Poster?.AbsoluteUri)
) )
) )
) )