cardigann: add trakt support (#13385)

Related to, but kept separate from, #13384
This commit is contained in:
ilike2burnthing 2022-07-21 06:34:54 +01:00 committed by GitHub
parent d399e7dac8
commit 9996413a58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 32 additions and 8 deletions

View File

@ -309,6 +309,10 @@ table td.fit{
background-color: #86cca8;
}
.label-trakt {
background-color: #ef1e25;
}
.label-douban {
background-color: #86cc10;
}

View File

@ -973,6 +973,7 @@ function updateReleasesRow(row) {
var IMDBId = $(row).data("imdb");
var TMDBId = $(row).data("tmdb");
var TVDBId = $(row).data("tvdb");
var TraktId = $(row).data("trakt");
var DoubanId = $(row).data("douban");
var Poster = $(row).data("poster");
var Description = $(row).data("description");
@ -1011,6 +1012,11 @@ function updateReleasesRow(row) {
labels.append('\n<a href="https://thetvdb.com/?tab=series&id=' + TVDBId + '" target="_blank" class="label label-tvdb" alt="TVDB" title="TVDB">TVDB</a>');
}
if (TraktId && TraktId > 0) {
var TraktType = (Cat.includes("Movies")) ? "movies" : "shows";
labels.append('\n<a href="https://www.trakt.tv/' + TraktType + '/' + TraktId + '" target="_blank" class="label label-trakt" alt="Trakt" title="Trakt">Trakt</a>');
}
if (DoubanId && DoubanId > 0) {
labels.append('\n<a href="https://movie.douban.com/subject/' + DoubanId + '" target="_blank" class="label label-douban" alt="Douban" title="Douban">Douban</a>');
}

View File

@ -292,6 +292,10 @@ table td.fit{
background-color: #86cca8;
}
.label-trakt {
background-color: #ef1e25;
}
.label-douban {
background-color: #86cc10;
}

View File

@ -28,8 +28,8 @@
<link rel="stylesheet" type="text/css" href="../bootstrap/bootstrap.min.css?changed=2017083001">
<link rel="stylesheet" type="text/css" href="../animate.css?changed=2017083001">
<link rel="stylesheet" type="text/css" href="../css/tagify.css?changed=11662">
<link rel="stylesheet" type="text/css" href="../custom.css?changed=20220512" media="only screen and (min-device-width: 480px)">
<link rel="stylesheet" type="text/css" href="../custom_mobile.css?changed=20220512" media="only screen and (max-device-width: 480px)">
<link rel="stylesheet" type="text/css" href="../custom.css?changed=20220721" media="only screen and (min-device-width: 480px)">
<link rel="stylesheet" type="text/css" href="../custom_mobile.css?changed=20220721" media="only screen and (max-device-width: 480px)">
<link rel="stylesheet" type="text/css" href="../css/jquery.dataTables.min.css?changed=2017083001">
<link rel="stylesheet" type="text/css" href="../css/bootstrap-multiselect.css?changed=2017083001" />
<link rel="stylesheet" type="text/css" href="../css/font-awesome.min.css?changed=2017083001">
@ -458,7 +458,7 @@
</thead>
<tbody>
{{#each releases}}
<tr class="jackett-releases-row" data-imdb="{{Imdb}}" data-tmdb="{{TMDb}}" data-tvdb="{{TVDBId}}" data-douban="{{DoubanId}}" data-poster="{{Poster}}" data-description="{{Description}}">
<tr class="jackett-releases-row" data-imdb="{{Imdb}}" data-tmdb="{{TMDb}}" data-tvdb="{{TVDBId}}" data-trakt="{{TraktId}}" data-douban="{{DoubanId}}" data-poster="{{Poster}}" data-description="{{Description}}">
<td class="fit">{{PublishDate}}</td>
<td class="fit">{{FirstSeen}}</td>
<td class="fit">{{jacketTimespan PublishDate}}</td>
@ -586,7 +586,7 @@
</thead>
<tbody>
{{#each Results}}
<tr class="jackett-search-results-row" data-imdb="{{Imdb}}" data-tmdb="{{TMDb}}" data-tvdb="{{TVDBId}}" data-douban="{{DoubanId}}" data-poster="{{Poster}}" data-description="{{Description}}">
<tr class="jackett-search-results-row" data-imdb="{{Imdb}}" data-tmdb="{{TMDb}}" data-tvdb="{{TVDBId}}" data-trakt="{{TraktId}}" data-douban="{{DoubanId}}" data-poster="{{Poster}}" data-description="{{Description}}">
<td>{{PublishDate}}</td>
<td>{{jacketTimespan PublishDate}}</td>
<td>{{Tracker}}</td>
@ -754,6 +754,6 @@
</script>
<script type="text/javascript" src="../libs/api.js?changed=2017083001"></script>
<script type="text/javascript" src="../custom.js?changed=20220606"></script>
<script type="text/javascript" src="../custom.js?changed=20220721"></script>
</body>
</html>

View File

@ -16,7 +16,7 @@
<link href="../bootstrap/bootstrap.min.css" rel="stylesheet">
<link href="../animate.css" rel="stylesheet">
<link href="../custom.css?changed=20220512" rel="stylesheet">
<link href="../custom.css?changed=20220721" rel="stylesheet">
<title>Jackett</title>
</head>

View File

@ -38,7 +38,7 @@ namespace Jackett.Common.Indexers
set => base.configData = value;
}
protected readonly string[] OptionalFields = { "imdb", "imdbid", "tmdbid", "rageid", "tvdbid", "doubanid", "poster", "description" };
protected readonly string[] OptionalFields = { "imdb", "imdbid", "tmdbid", "rageid", "tvdbid", "traktid", "doubanid", "poster", "description" };
private static readonly string[] _SupportedLogicFunctions =
{
@ -2057,6 +2057,13 @@ namespace Jackett.Common.Indexers
release.TVDBId = ParseUtil.CoerceLong(TVDBId);
value = release.TVDBId.ToString();
break;
case "traktid":
var TraktIdRegEx = new Regex(@"(\d+)", RegexOptions.Compiled);
var TraktIdMatch = TraktIdRegEx.Match(value);
var TraktId = TraktIdMatch.Groups[1].Value;
release.TraktId = ParseUtil.CoerceLong(TraktId);
value = release.TraktId.ToString();
break;
case "doubanid":
var DoubanIDRegEx = new Regex(@"(\d+)", RegexOptions.Compiled);
var DoubanIDMatch = DoubanIDRegEx.Match(value);

View File

@ -24,6 +24,7 @@ namespace Jackett.Common.Models
public long? TVDBId { get; set; }
public long? Imdb { get; set; }
public long? TMDb { get; set; }
public long? TraktId { get; set; }
public long? DoubanId { get; set; }
public ICollection<string> Genres { get; set; }
public long? Year { get; set; }
@ -67,6 +68,7 @@ namespace Jackett.Common.Models
TVDBId = copyFrom.TVDBId;
Imdb = copyFrom.Imdb;
TMDb = copyFrom.TMDb;
TraktId = copyFrom.TraktId;
DoubanId = copyFrom.DoubanId;
Genres = copyFrom.Genres;
Year = copyFrom.Year;
@ -126,6 +128,6 @@ namespace Jackett.Common.Models
public static long BytesFromKB(float kb) => (long)(kb * 1024f);
public override string ToString() =>
$"[ReleaseInfo: Title={Title}, Guid={Guid}, Link={Link}, Details={Details}, PublishDate={PublishDate}, Category={Category}, Size={Size}, Files={Files}, Grabs={Grabs}, Description={Description}, RageID={RageID}, TVDBId={TVDBId}, Imdb={Imdb}, TMDb={TMDb}, DoubanId={DoubanId}, Seeders={Seeders}, Peers={Peers}, Poster={Poster}, InfoHash={InfoHash}, MagnetUri={MagnetUri}, MinimumRatio={MinimumRatio}, MinimumSeedTime={MinimumSeedTime}, DownloadVolumeFactor={DownloadVolumeFactor}, UploadVolumeFactor={UploadVolumeFactor}, Gain={Gain}]";
$"[ReleaseInfo: Title={Title}, Guid={Guid}, Link={Link}, Details={Details}, PublishDate={PublishDate}, Category={Category}, Size={Size}, Files={Files}, Grabs={Grabs}, Description={Description}, RageID={RageID}, TVDBId={TVDBId}, Imdb={Imdb}, TMDb={TMDb}, TraktId={TraktId}, DoubanId={DoubanId}, Seeders={Seeders}, Peers={Peers}, Poster={Poster}, InfoHash={InfoHash}, MagnetUri={MagnetUri}, MinimumRatio={MinimumRatio}, MinimumSeedTime={MinimumSeedTime}, DownloadVolumeFactor={DownloadVolumeFactor}, UploadVolumeFactor={UploadVolumeFactor}, Gain={Gain}]";
}
}

View File

@ -99,6 +99,7 @@ namespace Jackett.Common.Models
GetTorznabElement("imdb", r.Imdb?.ToString("D7")),
GetTorznabElement("imdbid", r.Imdb != null ? "tt" + r.Imdb?.ToString("D7") : null),
GetTorznabElement("tmdbid", r.TMDb),
GetTorznabElement("traktid", r.TraktId),
GetTorznabElement("doubanid", r.DoubanId),
r.Genres == null ? null : GetTorznabElement("genre", string.Join(", ", r.Genres)),
GetTorznabElement("year", r.Year),