cardigann: add tvmaze support (#13389)

Follow up to:
#13385
#13387

Includes a couple of fixes for the latter.
This commit is contained in:
ilike2burnthing 2022-07-21 17:43:56 +01:00 committed by GitHub
parent e34e70040b
commit c8ae183d68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 47 additions and 13 deletions

View File

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

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 TVMazeId = $(row).data("tvmaze");
var TraktId = $(row).data("trakt");
var DoubanId = $(row).data("douban");
var Poster = $(row).data("poster");
@ -1012,6 +1013,10 @@ 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 (TVMazeId && TVMazeId > 0) {
labels.append('\n<a href="https://tvmaze.com/shows/' + TVMazeId + '" target="_blank" class="label label-tvmaze" alt="TVMaze" title="TVMaze">TVMaze</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>');

View File

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

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=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="../custom.css?changed=20220721002" media="only screen and (min-device-width: 480px)">
<link rel="stylesheet" type="text/css" href="../custom_mobile.css?changed=20220721002" 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-trakt="{{TraktId}}" data-douban="{{DoubanId}}" data-poster="{{Poster}}" data-description="{{Description}}">
<tr class="jackett-releases-row" data-imdb="{{Imdb}}" data-tmdb="{{TMDb}}" data-tvdb="{{TVDBId}}" data-tvmaze="{{TVMazeId}}" 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-trakt="{{TraktId}}" 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-tvmaze="{{TVMazeId}}" 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=20220721"></script>
<script type="text/javascript" src="../custom.js?changed=20220721002"></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=20220721" rel="stylesheet">
<link href="../custom.css?changed=20220721002" 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", "traktid", "doubanid", "poster", "description" };
protected readonly string[] OptionalFields = { "imdb", "imdbid", "tmdbid", "rageid", "tvdbid", "tvmazeid", "traktid", "doubanid", "poster", "description" };
private static readonly string[] _SupportedLogicFunctions =
{
@ -1300,7 +1300,7 @@ namespace Jackett.Common.Indexers
variables[".Query.IMDBID"] = query.ImdbID;
variables[".Query.IMDBIDShort"] = query.ImdbIDShort;
variables[".Query.TMDBID"] = query.TmdbID?.ToString() ?? null;
variables[".Query.TVMazeID"] = null;
variables[".Query.TVMazeID"] = query.TvmazeID?.ToString() ?? null;
variables[".Query.TraktID"] = query.TraktID?.ToString() ?? null;
variables[".Query.DoubanID"] = query.DoubanID?.ToString() ?? null;
variables[".Query.Album"] = query.Album;
@ -2058,6 +2058,13 @@ namespace Jackett.Common.Indexers
release.TVDBId = ParseUtil.CoerceLong(TVDBId);
value = release.TVDBId.ToString();
break;
case "tvmazeid":
var TVMazeIdRegEx = new Regex(@"(\d+)", RegexOptions.Compiled);
var TVMazeIdMatch = TVMazeIdRegEx.Match(value);
var TVMazeId = TVMazeIdMatch.Groups[1].Value;
release.TVMazeId = ParseUtil.CoerceLong(TVMazeId);
value = release.TVMazeId.ToString();
break;
case "traktid":
var TraktIdRegEx = new Regex(@"(\d+)", RegexOptions.Compiled);
var TraktIdMatch = TraktIdRegEx.Match(value);

View File

@ -18,6 +18,7 @@ namespace Jackett.Common.Models.DTO
public string rid { get; set; }
public string tvdbid { get; set; }
public string tmdbid { get; set; }
public string tvmazeid { get; set; }
public string traktid { get; set; }
public string doubanid { get; set; }
public string album { get; set; }
@ -72,6 +73,8 @@ namespace Jackett.Common.Models.DTO
query.RageID = int.Parse(request.rid);
if (!string.IsNullOrWhiteSpace(request.tvdbid))
query.TvdbID = int.Parse(request.tvdbid);
if (!string.IsNullOrWhiteSpace(request.tvmazeid))
query.TvmazeID = int.Parse(request.tvmazeid);
if (!string.IsNullOrWhiteSpace(request.tmdbid))
query.TmdbID = int.Parse(request.tmdbid);

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? TVMazeId { get; set; }
public long? TraktId { get; set; }
public long? DoubanId { get; set; }
public ICollection<string> Genres { get; set; }
@ -68,6 +69,7 @@ namespace Jackett.Common.Models
TVDBId = copyFrom.TVDBId;
Imdb = copyFrom.Imdb;
TMDb = copyFrom.TMDb;
TVMazeId = copyFrom.TVMazeId;
TraktId = copyFrom.TraktId;
DoubanId = copyFrom.DoubanId;
Genres = copyFrom.Genres;
@ -128,6 +130,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}, TraktId={TraktId}, 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}, TVMazeId={TVMazeId}, 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("tvmazeid", r.TVMazeId),
GetTorznabElement("traktid", r.TraktId),
GetTorznabElement("doubanid", r.DoubanId),
r.Genres == null ? null : GetTorznabElement("genre", string.Join(", ", r.Genres)),

View File

@ -14,6 +14,7 @@ namespace Jackett.Common.Models
TvdbId,
RId,
TmdbId,
TvmazeId,
TraktId
}
@ -59,6 +60,7 @@ namespace Jackett.Common.Models
public bool TvSearchTvdbAvailable => (TvSearchParams.Contains(TvSearchParam.TvdbId));
public bool TvSearchTvRageAvailable => (TvSearchParams.Contains(TvSearchParam.RId));
public bool TvSearchTmdbAvailable => (TvSearchParams.Contains(TvSearchParam.TmdbId));
public bool TvSearchTvMazeAvailable => (TvSearchParams.Contains(TvSearchParam.TvmazeId));
public bool TvSearchTraktAvailable => (TvSearchParams.Contains(TvSearchParam.TraktId));
public List<MovieSearchParam> MovieSearchParams;
@ -193,7 +195,9 @@ namespace Jackett.Common.Models
parameters.Add("rid");
if (TvSearchTmdbAvailable)
parameters.Add("tmdbid");
if (TvSearchTmdbAvailable)
if (TvSearchTvMazeAvailable)
parameters.Add("tvmazeid");
if (TvSearchTraktAvailable)
parameters.Add("traktid");
return string.Join(",", parameters);
}
@ -205,9 +209,9 @@ namespace Jackett.Common.Models
parameters.Add("imdbid");
if (MovieSearchTmdbAvailable)
parameters.Add("tmdbid");
if (MovieSearchImdbAvailable)
if (MovieSearchTraktAvailable)
parameters.Add("traktid");
if (MovieSearchTmdbAvailable)
if (MovieSearchDoubanAvailable)
parameters.Add("doubanid");
return string.Join(",", parameters);
}

View File

@ -19,6 +19,7 @@ namespace Jackett.Common.Models
public int? TvdbID { get; set; }
public string ImdbID { get; set; }
public int? TmdbID { get; set; }
public int? TvmazeID { get; set; }
public int? TraktID { get; set; }
public int? DoubanID { get; set; }
public bool Cache { get; set; } = true;
@ -61,6 +62,8 @@ namespace Jackett.Common.Models
public bool IsTmdbQuery => TmdbID != null;
public bool IsTvmazeQuery => TvmazeID != null;
public bool IsTraktQuery => TraktID != null;
public bool IsDoubanQuery => DoubanID != null;
@ -145,6 +148,7 @@ namespace Jackett.Common.Models
TvdbID = TvdbID,
ImdbID = ImdbID,
TmdbID = TmdbID,
TvmazeID = TvmazeID,
TraktID = TraktID,
DoubanID = DoubanID,
Cache = Cache

View File

@ -406,7 +406,7 @@ namespace Jackett.Test.Common.Models
Assert.AreEqual("yes", xDocumentSearching?.Element("tv-search")?.Attribute("available")?.Value);
Assert.AreEqual("q,season,ep,tvdbid,rid", xDocumentSearching?.Element("tv-search")?.Attribute("supportedParams")?.Value);
Assert.AreEqual("yes", xDocumentSearching?.Element("movie-search")?.Attribute("available")?.Value);
Assert.AreEqual("q,imdbid,tmdbid,traktid,doubanid", xDocumentSearching?.Element("movie-search")?.Attribute("supportedParams")?.Value);
Assert.AreEqual("q,imdbid,tmdbid", xDocumentSearching?.Element("movie-search")?.Attribute("supportedParams")?.Value);
Assert.AreEqual("yes", xDocumentSearching?.Element("music-search")?.Attribute("available")?.Value);
Assert.AreEqual("q,album,artist,label,year", xDocumentSearching?.Element("music-search")?.Attribute("supportedParams")?.Value);
Assert.AreEqual("yes", xDocumentSearching?.Element("audio-search")?.Attribute("available")?.Value);