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:
selector: ..names.alternative
optional: true
_year:
year:
selector: ..season.year
_quality:
selector: quality.string
_series:
selector: series.string
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:
selector: ..code
details:

View File

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

View File

@ -174,10 +174,10 @@ search:
title_desc:
optional: true
selector: title
_year_desc:
year_desc:
optional: true
selector: year
_genres_desc:
genre_desc:
optional: true
selector: genres
_tagline_desc:
@ -222,5 +222,5 @@ search:
- name: regexp
args: "(.+?), $"
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

View File

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

View File

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

View File

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

View File

@ -175,10 +175,10 @@ search:
title_desc:
optional: true
selector: title
_year_desc:
year_desc:
optional: true
selector: year
_genres_desc:
genre_desc:
optional: true
selector: genres
_tagline_desc:
@ -263,5 +263,5 @@ search:
- name: regexp
args: "(.+?), $"
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

View File

@ -104,7 +104,7 @@ search:
attribute: href
size:
selector: td:nth-child(5)
_artist:
artist:
selector: span.artist
optional: true
_tag:
@ -117,7 +117,7 @@ search:
selector: td:nth-child(7)
optional: true
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:
selector: td:nth-child(8)
seeders:

View File

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

View File

@ -84,7 +84,7 @@ search:
"*": 45
_type:
selector: type
_year:
year:
selector: ..year
title:
selector: ..title
@ -95,7 +95,7 @@ search:
args: [" ", "."]
# append type: BRRip or WEBRip, resolves #3558 via #4577
- 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:
text: "{{ .Config.sitelink }}"
filters:

View File

@ -38,7 +38,7 @@ namespace Jackett.Common.Indexers
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 =
{
@ -2043,13 +2043,6 @@ namespace Jackett.Common.Indexers
release.TMDb = ParseUtil.CoerceLong(TmdbID);
value = release.TMDb.ToString();
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":
var RageIDRegEx = new Regex(@"(\d+)", RegexOptions.Compiled);
var RageIDMatch = RageIDRegEx.Match(value);
@ -2064,12 +2057,33 @@ namespace Jackett.Common.Indexers
release.TVDBId = ParseUtil.CoerceLong(TVDBId);
value = release.TVDBId.ToString();
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":
release.Author = value;
break;
case "booktitle":
release.BookTitle = value;
break;
case "artist":
release.Artist = value;
break;
case "album":
release.Album = value;
break;
case "poster":
if (!string.IsNullOrWhiteSpace(value))
{

View File

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

View File

@ -94,22 +94,27 @@ namespace Jackett.Common.Models
new XAttribute("type", "application/x-bittorrent")
),
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("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("doubanid", r.DoubanId),
r.Genres == null ? null : GetTorznabElement("genre", string.Join(", ", r.Genres)),
GetTorznabElement("year", r.Year),
GetTorznabElement("author", RemoveInvalidXMLChars(r.Author)),
GetTorznabElement("booktitle", RemoveInvalidXMLChars(r.BookTitle)),
GetTorznabElement("artist", RemoveInvalidXMLChars(r.Artist)),
GetTorznabElement("album", RemoveInvalidXMLChars(r.Album)),
GetTorznabElement("seeders", r.Seeders),
GetTorznabElement("peers", r.Peers),
GetTorznabElement("magneturl", r.MagnetUri?.AbsoluteUri),
GetTorznabElement("coverurl", r.Poster?.AbsoluteUri),
GetTorznabElement("infohash", RemoveInvalidXMLChars(r.InfoHash)),
GetTorznabElement("magneturl", r.MagnetUri?.AbsoluteUri),
GetTorznabElement("minimumratio", r.MinimumRatio),
GetTorznabElement("minimumseedtime", r.MinimumSeedTime),
GetTorznabElement("downloadvolumefactor", r.DownloadVolumeFactor),
GetTorznabElement("uploadvolumefactor", r.UploadVolumeFactor),
GetTorznabElement("coverurl", r.Poster?.AbsoluteUri)
GetTorznabElement("uploadvolumefactor", r.UploadVolumeFactor)
)
)
)