mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
New: (Cardigann) Additional query support
v7
This commit is contained in:
@@ -6,6 +6,9 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
||||
{
|
||||
public string Author { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Publisher { get; set; }
|
||||
public int? Year { get; set; }
|
||||
public string Genre { get; set; }
|
||||
|
||||
public override bool RssSearch
|
||||
{
|
||||
|
@@ -18,6 +18,8 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
||||
public int? TraktId { get; set; }
|
||||
public int? TmdbId { get; set; }
|
||||
public int? DoubanId { get; set; }
|
||||
public int? Year { get; set; }
|
||||
public string Genre { get; set; }
|
||||
|
||||
public string SanitizedTvSearchString => (SanitizedSearchTerm + " " + EpisodeSearchString).Trim();
|
||||
public string EpisodeSearchString => GetEpisodeSearchString();
|
||||
|
@@ -7,7 +7,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||
private static readonly Regex TvRegex = new Regex(@"\{((?:imdbid\:)(?<imdbid>[^{]+)|(?:tvdbid\:)(?<tvdbid>[^{]+)|(?:tmdbid\:)(?<tmdbid>[^{]+)|(?:doubanid\:)(?<doubanid>[^{]+)|(?:season\:)(?<season>[^{]+)|(?:episode\:)(?<episode>[^{]+))\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex MovieRegex = new Regex(@"\{((?:imdbid\:)(?<imdbid>[^{]+)|(?:doubanid\:)(?<doubanid>[^{]+)|(?:tmdbid\:)(?<tmdbid>[^{]+))\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex MusicRegex = new Regex(@"\{((?:artist\:)(?<artist>[^{]+)|(?:album\:)(?<album>[^{]+)|(?:track\:)(?<track>[^{]+)|(?:label\:)(?<label>[^{]+))\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex BookRegex = new Regex(@"\{((?:author\:)(?<author>[^{]+)|(?:title\:)(?<title>[^{]+))\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex BookRegex = new Regex(@"\{((?:author\:)(?<author>[^{]+)|(?:publisher\:)(?<publisher>[^{]+)|(?:title\:)(?<title>[^{]+))\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
public string t { get; set; }
|
||||
public string q { get; set; }
|
||||
@@ -32,6 +32,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||
public string genre { get; set; }
|
||||
public string author { get; set; }
|
||||
public string title { get; set; }
|
||||
public string publisher { get; set; }
|
||||
public string configured { get; set; }
|
||||
public string source { get; set; }
|
||||
public string host { get; set; }
|
||||
@@ -150,6 +151,11 @@ namespace NzbDrone.Core.IndexerSearch
|
||||
title = match.Groups["title"].Value;
|
||||
}
|
||||
|
||||
if (match.Groups["publisher"].Success)
|
||||
{
|
||||
publisher = match.Groups["publisher"].Value;
|
||||
}
|
||||
|
||||
q = q.Replace(match.Value, "").Trim();
|
||||
}
|
||||
}
|
||||
|
@@ -93,6 +93,8 @@ namespace NzbDrone.Core.IndexerSearch
|
||||
searchSpec.DoubanId = request.doubanid;
|
||||
searchSpec.RId = request.rid;
|
||||
searchSpec.TvMazeId = request.tvmazeid;
|
||||
searchSpec.Year = request.year;
|
||||
searchSpec.Genre = request.genre;
|
||||
|
||||
return new NewznabResults { Releases = await Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec) };
|
||||
}
|
||||
@@ -103,6 +105,9 @@ namespace NzbDrone.Core.IndexerSearch
|
||||
|
||||
searchSpec.Author = request.author;
|
||||
searchSpec.Title = request.title;
|
||||
searchSpec.Publisher = request.publisher;
|
||||
searchSpec.Year = request.year;
|
||||
searchSpec.Genre = request.genre;
|
||||
|
||||
return new NewznabResults { Releases = await Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec) };
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ namespace NzbDrone.Core.IndexerVersions
|
||||
/* Update Service will fall back if version # does not exist for an indexer per Ta */
|
||||
|
||||
private const string DEFINITION_BRANCH = "master";
|
||||
private const int DEFINITION_VERSION = 6;
|
||||
private const int DEFINITION_VERSION = 7;
|
||||
|
||||
//Used when moving yml to C#
|
||||
private readonly List<string> _defintionBlocklist = new List<string>()
|
||||
|
@@ -28,7 +28,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
||||
protected readonly IndexerCapabilitiesCategories _categories = new IndexerCapabilitiesCategories();
|
||||
protected readonly List<string> _defaultCategories = new List<string>();
|
||||
|
||||
protected readonly string[] OptionalFields = new string[] { "imdb", "imdbid", "rageid", "tmdbid", "tvdbid", "poster", "banner", "description", "doubanid" };
|
||||
protected readonly string[] OptionalFields = new string[] { "imdb", "imdbid", "tmdbid", "rageid", "tvdbid", "tvmazeid", "traktid", "doubanid", "poster", "banner", "description" };
|
||||
|
||||
protected static readonly string[] _SupportedLogicFunctions =
|
||||
{
|
||||
|
@@ -607,12 +607,21 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
||||
case "booktitle":
|
||||
release.BookTitle = value;
|
||||
break;
|
||||
case "publisher":
|
||||
release.Publisher = value;
|
||||
break;
|
||||
case "artist":
|
||||
release.Artist = value;
|
||||
break;
|
||||
case "album":
|
||||
release.Album = value;
|
||||
break;
|
||||
case "label":
|
||||
release.Label = value;
|
||||
break;
|
||||
case "track":
|
||||
release.Track = value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@@ -49,10 +49,12 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
||||
|
||||
variables[".Query.Movie"] = null;
|
||||
variables[".Query.Year"] = searchCriteria.Year?.ToString() ?? null;
|
||||
variables[".Query.Genre"] = searchCriteria.Genre;
|
||||
variables[".Query.IMDBID"] = searchCriteria.FullImdbId;
|
||||
variables[".Query.IMDBIDShort"] = searchCriteria.ImdbId;
|
||||
variables[".Query.TMDBID"] = searchCriteria.TmdbId?.ToString() ?? null;
|
||||
variables[".Query.TraktID"] = searchCriteria.TraktId?.ToString() ?? null;
|
||||
variables[".Query.DoubanID"] = searchCriteria.DoubanId?.ToString() ?? null;
|
||||
|
||||
pageableRequests.Add(GetRequest(variables));
|
||||
|
||||
@@ -70,7 +72,9 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
||||
variables[".Query.Album"] = searchCriteria.Album;
|
||||
variables[".Query.Artist"] = searchCriteria.Artist;
|
||||
variables[".Query.Label"] = searchCriteria.Label;
|
||||
variables[".Query.Track"] = null;
|
||||
variables[".Query.Genre"] = searchCriteria.Genre;
|
||||
variables[".Query.Year"] = searchCriteria.Year?.ToString() ?? null;
|
||||
variables[".Query.Track"] = searchCriteria.Track;
|
||||
|
||||
pageableRequests.Add(GetRequest(variables));
|
||||
|
||||
@@ -88,6 +92,8 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
||||
variables[".Query.Series"] = null;
|
||||
variables[".Query.Ep"] = searchCriteria.Episode;
|
||||
variables[".Query.Season"] = searchCriteria.Season?.ToString() ?? null;
|
||||
variables[".Query.Genre"] = searchCriteria.Genre;
|
||||
variables[".Query.Year"] = searchCriteria.Year?.ToString() ?? null;
|
||||
variables[".Query.IMDBID"] = searchCriteria.FullImdbId;
|
||||
variables[".Query.IMDBIDShort"] = searchCriteria.ImdbId;
|
||||
variables[".Query.TVDBID"] = searchCriteria.TvdbId?.ToString() ?? null;
|
||||
@@ -95,6 +101,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
||||
variables[".Query.TVRageID"] = searchCriteria.RId?.ToString() ?? null;
|
||||
variables[".Query.TVMazeID"] = searchCriteria.TvMazeId?.ToString() ?? null;
|
||||
variables[".Query.TraktID"] = searchCriteria.TraktId?.ToString() ?? null;
|
||||
variables[".Query.DoubanID"] = searchCriteria.DoubanId?.ToString() ?? null;
|
||||
variables[".Query.Episode"] = searchCriteria.EpisodeSearchString;
|
||||
|
||||
pageableRequests.Add(GetRequest(variables));
|
||||
@@ -112,6 +119,9 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
||||
|
||||
variables[".Query.Author"] = searchCriteria.Author;
|
||||
variables[".Query.Title"] = searchCriteria.Title;
|
||||
variables[".Query.Genre"] = searchCriteria.Genre;
|
||||
variables[".Query.Publisher"] = searchCriteria.Publisher;
|
||||
variables[".Query.Year"] = searchCriteria.Year?.ToString() ?? null;
|
||||
|
||||
pageableRequests.Add(GetRequest(variables));
|
||||
|
||||
|
@@ -16,7 +16,9 @@ namespace NzbDrone.Core.Indexers
|
||||
TvMazeId,
|
||||
TraktId,
|
||||
TmdbId,
|
||||
DoubanId
|
||||
DoubanId,
|
||||
Genre,
|
||||
Year
|
||||
}
|
||||
|
||||
public enum MovieSearchParam
|
||||
@@ -28,7 +30,8 @@ namespace NzbDrone.Core.Indexers
|
||||
ImdbYear,
|
||||
TraktId,
|
||||
Genre,
|
||||
DoubanId
|
||||
DoubanId,
|
||||
Year
|
||||
}
|
||||
|
||||
public enum MusicSearchParam
|
||||
@@ -51,7 +54,10 @@ namespace NzbDrone.Core.Indexers
|
||||
{
|
||||
Q,
|
||||
Title,
|
||||
Author
|
||||
Author,
|
||||
Publisher,
|
||||
Genre,
|
||||
Year
|
||||
}
|
||||
|
||||
public class IndexerCapabilities
|
||||
@@ -75,6 +81,8 @@ namespace NzbDrone.Core.Indexers
|
||||
public bool TvSearchTraktAvailable => TvSearchParams.Contains(TvSearchParam.TraktId);
|
||||
public bool TvSearchTmdbAvailable => TvSearchParams.Contains(TvSearchParam.TmdbId);
|
||||
public bool TvSearchDoubanAvailable => TvSearchParams.Contains(TvSearchParam.DoubanId);
|
||||
public bool TvSearchGenreAvailable => TvSearchParams.Contains(TvSearchParam.Genre);
|
||||
public bool TvSearchYearAvailable => TvSearchParams.Contains(TvSearchParam.Year);
|
||||
|
||||
public List<MovieSearchParam> MovieSearchParams;
|
||||
public bool MovieSearchAvailable => MovieSearchParams.Count > 0;
|
||||
@@ -82,6 +90,7 @@ namespace NzbDrone.Core.Indexers
|
||||
public bool MovieSearchTmdbAvailable => MovieSearchParams.Contains(MovieSearchParam.TmdbId);
|
||||
public bool MovieSearchTraktAvailable => MovieSearchParams.Contains(MovieSearchParam.TraktId);
|
||||
public bool MovieSearchGenreAvailable => MovieSearchParams.Contains(MovieSearchParam.Genre);
|
||||
public bool MovieSearchYearAvailable => MovieSearchParams.Contains(MovieSearchParam.Year);
|
||||
public bool MovieSearchDoubanAvailable => MovieSearchParams.Contains(MovieSearchParam.DoubanId);
|
||||
|
||||
public List<MusicSearchParam> MusicSearchParams;
|
||||
@@ -97,6 +106,9 @@ namespace NzbDrone.Core.Indexers
|
||||
public bool BookSearchAvailable => BookSearchParams.Count > 0;
|
||||
public bool BookSearchTitleAvailable => BookSearchParams.Contains(BookSearchParam.Title);
|
||||
public bool BookSearchAuthorAvailable => BookSearchParams.Contains(BookSearchParam.Author);
|
||||
public bool BookSearchPublisherAvailable => BookSearchParams.Contains(BookSearchParam.Publisher);
|
||||
public bool BookSearchYearAvailable => BookSearchParams.Contains(BookSearchParam.Year);
|
||||
public bool BookSearchGenreAvailable => BookSearchParams.Contains(BookSearchParam.Genre);
|
||||
|
||||
public readonly IndexerCapabilitiesCategories Categories;
|
||||
public List<IndexerFlag> Flags;
|
||||
@@ -313,6 +325,16 @@ namespace NzbDrone.Core.Indexers
|
||||
parameters.Add("doubanid");
|
||||
}
|
||||
|
||||
if (TvSearchGenreAvailable)
|
||||
{
|
||||
parameters.Add("genre");
|
||||
}
|
||||
|
||||
if (TvSearchYearAvailable)
|
||||
{
|
||||
parameters.Add("year");
|
||||
}
|
||||
|
||||
return string.Join(",", parameters);
|
||||
}
|
||||
|
||||
@@ -351,6 +373,11 @@ namespace NzbDrone.Core.Indexers
|
||||
parameters.Add("doubanid");
|
||||
}
|
||||
|
||||
if (MovieSearchYearAvailable)
|
||||
{
|
||||
parameters.Add("year");
|
||||
}
|
||||
|
||||
return string.Join(",", parameters);
|
||||
}
|
||||
|
||||
@@ -403,6 +430,21 @@ namespace NzbDrone.Core.Indexers
|
||||
parameters.Add("author");
|
||||
}
|
||||
|
||||
if (BookSearchPublisherAvailable)
|
||||
{
|
||||
parameters.Add("publisher");
|
||||
}
|
||||
|
||||
if (BookSearchGenreAvailable)
|
||||
{
|
||||
parameters.Add("genre");
|
||||
}
|
||||
|
||||
if (BookSearchYearAvailable)
|
||||
{
|
||||
parameters.Add("year");
|
||||
}
|
||||
|
||||
return string.Join(",", parameters);
|
||||
}
|
||||
|
||||
|
@@ -38,6 +38,7 @@ namespace NzbDrone.Core.Parser.Model
|
||||
public int Year { get; set; }
|
||||
public string Author { get; set; }
|
||||
public string BookTitle { get; set; }
|
||||
public string Publisher { get; set; }
|
||||
public string Artist { get; set; }
|
||||
public string Album { get; set; }
|
||||
public string Label { get; set; }
|
||||
|
Reference in New Issue
Block a user