mirror of
https://github.com/Prowlarr/Prowlarr
synced 2025-12-24 17:32:37 +01:00
New: (Cardigann) Additional query support
v7
This commit is contained in:
parent
6412048eb9
commit
ee6467073f
10 changed files with 85 additions and 7 deletions
|
|
@ -6,6 +6,9 @@ public class BookSearchCriteria : SearchCriteriaBase
|
|||
{
|
||||
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 @@ public class TvSearchCriteria : SearchCriteriaBase
|
|||
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 @@ public class NewznabRequest
|
|||
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 @@ public class NewznabRequest
|
|||
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 @@ public void QueryToParams()
|
|||
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 @@ private async Task<NewznabResults> TvSearch(NewznabRequest request, List<int> in
|
|||
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 @@ private async Task<NewznabResults> BookSearch(NewznabRequest request, List<int>
|
|||
|
||||
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 @@ public class IndexerDefinitionUpdateService : IIndexerDefinitionUpdateService, I
|
|||
/* 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 @@ public class CardigannBase
|
|||
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 @@ private string ParseFields(string value, string fieldName, TorrentInfo release,
|
|||
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 @@ public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchC
|
|||
|
||||
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 @@ public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchC
|
|||
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 @@ public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCrit
|
|||
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 @@ public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCrit
|
|||
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 @@ public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCr
|
|||
|
||||
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 @@ public enum TvSearchParam
|
|||
TvMazeId,
|
||||
TraktId,
|
||||
TmdbId,
|
||||
DoubanId
|
||||
DoubanId,
|
||||
Genre,
|
||||
Year
|
||||
}
|
||||
|
||||
public enum MovieSearchParam
|
||||
|
|
@ -28,7 +30,8 @@ public enum MovieSearchParam
|
|||
ImdbYear,
|
||||
TraktId,
|
||||
Genre,
|
||||
DoubanId
|
||||
DoubanId,
|
||||
Year
|
||||
}
|
||||
|
||||
public enum MusicSearchParam
|
||||
|
|
@ -51,7 +54,10 @@ public enum BookSearchParam
|
|||
{
|
||||
Q,
|
||||
Title,
|
||||
Author
|
||||
Author,
|
||||
Publisher,
|
||||
Genre,
|
||||
Year
|
||||
}
|
||||
|
||||
public class IndexerCapabilities
|
||||
|
|
@ -75,6 +81,8 @@ public class IndexerCapabilities
|
|||
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 @@ public class IndexerCapabilities
|
|||
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 @@ public class IndexerCapabilities
|
|||
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 @@ private string SupportedTvSearchParams()
|
|||
parameters.Add("doubanid");
|
||||
}
|
||||
|
||||
if (TvSearchGenreAvailable)
|
||||
{
|
||||
parameters.Add("genre");
|
||||
}
|
||||
|
||||
if (TvSearchYearAvailable)
|
||||
{
|
||||
parameters.Add("year");
|
||||
}
|
||||
|
||||
return string.Join(",", parameters);
|
||||
}
|
||||
|
||||
|
|
@ -351,6 +373,11 @@ private string SupportedMovieSearchParams()
|
|||
parameters.Add("doubanid");
|
||||
}
|
||||
|
||||
if (MovieSearchYearAvailable)
|
||||
{
|
||||
parameters.Add("year");
|
||||
}
|
||||
|
||||
return string.Join(",", parameters);
|
||||
}
|
||||
|
||||
|
|
@ -403,6 +430,21 @@ private string SupportedBookSearchParams()
|
|||
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 @@ public ReleaseInfo()
|
|||
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; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue