mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
New: Search by DoubanId
This commit is contained in:
@@ -9,6 +9,7 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
||||
public string ImdbId { get; set; }
|
||||
public int? TmdbId { get; set; }
|
||||
public int? TraktId { get; set; }
|
||||
public int? DoubanId { get; set; }
|
||||
public int? Year { get; set; }
|
||||
public string Genre { get; set; }
|
||||
|
||||
|
@@ -8,6 +8,7 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
||||
public string Artist { get; set; }
|
||||
public string Label { get; set; }
|
||||
public string Genre { get; set; }
|
||||
public string Track { get; set; }
|
||||
public int? Year { get; set; }
|
||||
|
||||
public override bool RssSearch
|
||||
|
@@ -17,6 +17,7 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
||||
public int? TvMazeId { get; set; }
|
||||
public int? TraktId { get; set; }
|
||||
public int? TmdbId { get; set; }
|
||||
public int? DoubanId { get; set; }
|
||||
|
||||
public string SanitizedTvSearchString => (SanitizedSearchTerm + " " + EpisodeSearchString).Trim();
|
||||
public string EpisodeSearchString => GetEpisodeSearchString();
|
||||
|
@@ -4,9 +4,9 @@ namespace NzbDrone.Core.IndexerSearch
|
||||
{
|
||||
public class NewznabRequest
|
||||
{
|
||||
private static readonly Regex TvRegex = new Regex(@"\{((?:imdbid\:)(?<imdbid>[^{]+)|(?:tvdbid\:)(?<tvdbid>[^{]+)|(?:season\:)(?<season>[^{]+)|(?:episode\:)(?<episode>[^{]+))\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex MovieRegex = new Regex(@"\{((?:imdbid\:)(?<imdbid>[^{]+)|(?:tmdbid\:)(?<tmdbid>[^{]+))\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex MusicRegex = new Regex(@"\{((?:artist\:)(?<artist>[^{]+)|(?:album\:)(?<album>[^{]+)|(?:label\:)(?<label>[^{]+))\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
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);
|
||||
|
||||
public string t { get; set; }
|
||||
@@ -21,6 +21,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||
public int? tvmazeid { get; set; }
|
||||
public int? traktid { get; set; }
|
||||
public int? tvdbid { get; set; }
|
||||
public int? doubanid { get; set; }
|
||||
public int? season { get; set; }
|
||||
public string ep { get; set; }
|
||||
public string album { get; set; }
|
||||
@@ -49,6 +50,16 @@ namespace NzbDrone.Core.IndexerSearch
|
||||
tvdbid = int.TryParse(match.Groups["tvdbid"].Value, out var tvdb) ? tvdb : null;
|
||||
}
|
||||
|
||||
if (match.Groups["tmdbid"].Success)
|
||||
{
|
||||
tmdbid = int.TryParse(match.Groups["tmdbid"].Value, out var tmdb) ? tmdb : null;
|
||||
}
|
||||
|
||||
if (match.Groups["doubanid"].Success)
|
||||
{
|
||||
doubanid = int.TryParse(match.Groups["doubanid"].Value, out var tmdb) ? tmdb : null;
|
||||
}
|
||||
|
||||
if (match.Groups["season"].Success)
|
||||
{
|
||||
season = int.TryParse(match.Groups["season"].Value, out var seasonParsed) ? seasonParsed : null;
|
||||
@@ -79,6 +90,11 @@ namespace NzbDrone.Core.IndexerSearch
|
||||
tmdbid = int.TryParse(match.Groups["tmdbid"].Value, out var tmdb) ? tmdb : null;
|
||||
}
|
||||
|
||||
if (match.Groups["doubanid"].Success)
|
||||
{
|
||||
doubanid = int.TryParse(match.Groups["doubanid"].Value, out var tmdb) ? tmdb : null;
|
||||
}
|
||||
|
||||
if (match.Groups["imdbid"].Success)
|
||||
{
|
||||
imdbid = match.Groups["imdbid"].Value;
|
||||
@@ -104,6 +120,11 @@ namespace NzbDrone.Core.IndexerSearch
|
||||
album = match.Groups["album"].Value;
|
||||
}
|
||||
|
||||
if (match.Groups["track"].Success)
|
||||
{
|
||||
track = match.Groups["track"].Value;
|
||||
}
|
||||
|
||||
if (match.Groups["label"].Success)
|
||||
{
|
||||
label = match.Groups["label"].Value;
|
||||
|
@@ -107,6 +107,8 @@ namespace NzbDrone.Core.IndexerSearch
|
||||
GetNabElement("booktitle", RemoveInvalidXMLChars(r.BookTitle), protocol),
|
||||
GetNabElement("artist", RemoveInvalidXMLChars(r.Artist), protocol),
|
||||
GetNabElement("album", RemoveInvalidXMLChars(r.Album), protocol),
|
||||
GetNabElement("label", RemoveInvalidXMLChars(r.Label), protocol),
|
||||
GetNabElement("track", RemoveInvalidXMLChars(r.Track), protocol),
|
||||
GetNabElement("infohash", RemoveInvalidXMLChars(t.InfoHash), protocol),
|
||||
GetNabElement("minimumratio", t.MinimumRatio, protocol),
|
||||
GetNabElement("minimumseedtime", t.MinimumSeedTime, protocol),
|
||||
|
@@ -59,6 +59,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||
searchSpec.ImdbId = request.imdbid;
|
||||
searchSpec.TmdbId = request.tmdbid;
|
||||
searchSpec.TraktId = request.traktid;
|
||||
searchSpec.DoubanId = request.doubanid;
|
||||
searchSpec.Year = request.year;
|
||||
searchSpec.Genre = request.genre;
|
||||
|
||||
@@ -73,6 +74,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||
searchSpec.Album = request.album;
|
||||
searchSpec.Label = request.label;
|
||||
searchSpec.Genre = request.genre;
|
||||
searchSpec.Track = request.track;
|
||||
searchSpec.Year = request.year;
|
||||
|
||||
return new NewznabResults { Releases = await Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec) };
|
||||
@@ -88,6 +90,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||
searchSpec.ImdbId = request.imdbid;
|
||||
searchSpec.TraktId = request.traktid;
|
||||
searchSpec.TmdbId = request.tmdbid;
|
||||
searchSpec.DoubanId = request.doubanid;
|
||||
searchSpec.RId = request.rid;
|
||||
searchSpec.TvMazeId = request.tvmazeid;
|
||||
|
||||
|
@@ -15,7 +15,8 @@ namespace NzbDrone.Core.Indexers
|
||||
RId,
|
||||
TvMazeId,
|
||||
TraktId,
|
||||
TmdbId
|
||||
TmdbId,
|
||||
DoubanId
|
||||
}
|
||||
|
||||
public enum MovieSearchParam
|
||||
@@ -26,7 +27,8 @@ namespace NzbDrone.Core.Indexers
|
||||
ImdbTitle,
|
||||
ImdbYear,
|
||||
TraktId,
|
||||
Genre
|
||||
Genre,
|
||||
DoubanId
|
||||
}
|
||||
|
||||
public enum MusicSearchParam
|
||||
@@ -36,7 +38,8 @@ namespace NzbDrone.Core.Indexers
|
||||
Artist,
|
||||
Label,
|
||||
Year,
|
||||
Genre
|
||||
Genre,
|
||||
Track
|
||||
}
|
||||
|
||||
public enum SearchParam
|
||||
@@ -71,6 +74,7 @@ namespace NzbDrone.Core.Indexers
|
||||
public bool TvSearchTvMazeAvailable => TvSearchParams.Contains(TvSearchParam.TvMazeId);
|
||||
public bool TvSearchTraktAvailable => TvSearchParams.Contains(TvSearchParam.TraktId);
|
||||
public bool TvSearchTmdbAvailable => TvSearchParams.Contains(TvSearchParam.TmdbId);
|
||||
public bool TvSearchDoubanAvailable => TvSearchParams.Contains(TvSearchParam.DoubanId);
|
||||
|
||||
public List<MovieSearchParam> MovieSearchParams;
|
||||
public bool MovieSearchAvailable => MovieSearchParams.Count > 0;
|
||||
@@ -78,12 +82,14 @@ 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 MovieSearchDoubanAvailable => MovieSearchParams.Contains(MovieSearchParam.DoubanId);
|
||||
|
||||
public List<MusicSearchParam> MusicSearchParams;
|
||||
public bool MusicSearchAvailable => MusicSearchParams.Count > 0;
|
||||
public bool MusicSearchAlbumAvailable => MusicSearchParams.Contains(MusicSearchParam.Album);
|
||||
public bool MusicSearchArtistAvailable => MusicSearchParams.Contains(MusicSearchParam.Artist);
|
||||
public bool MusicSearchLabelAvailable => MusicSearchParams.Contains(MusicSearchParam.Label);
|
||||
public bool MusicSearchTrackAvailable => MusicSearchParams.Contains(MusicSearchParam.Track);
|
||||
public bool MusicSearchYearAvailable => MusicSearchParams.Contains(MusicSearchParam.Year);
|
||||
public bool MusicSearchGenreAvailable => MusicSearchParams.Contains(MusicSearchParam.Genre);
|
||||
|
||||
@@ -302,6 +308,11 @@ namespace NzbDrone.Core.Indexers
|
||||
parameters.Add("tmdbid");
|
||||
}
|
||||
|
||||
if (TvSearchDoubanAvailable)
|
||||
{
|
||||
parameters.Add("doubanid");
|
||||
}
|
||||
|
||||
return string.Join(",", parameters);
|
||||
}
|
||||
|
||||
@@ -335,6 +346,11 @@ namespace NzbDrone.Core.Indexers
|
||||
parameters.Add("genre");
|
||||
}
|
||||
|
||||
if (MovieSearchDoubanAvailable)
|
||||
{
|
||||
parameters.Add("doubanid");
|
||||
}
|
||||
|
||||
return string.Join(",", parameters);
|
||||
}
|
||||
|
||||
@@ -356,6 +372,11 @@ namespace NzbDrone.Core.Indexers
|
||||
parameters.Add("label");
|
||||
}
|
||||
|
||||
if (MusicSearchTrackAvailable)
|
||||
{
|
||||
parameters.Add("track");
|
||||
}
|
||||
|
||||
if (MusicSearchYearAvailable)
|
||||
{
|
||||
parameters.Add("year");
|
||||
|
@@ -40,6 +40,8 @@ namespace NzbDrone.Core.Parser.Model
|
||||
public string BookTitle { get; set; }
|
||||
public string Artist { get; set; }
|
||||
public string Album { get; set; }
|
||||
public string Label { get; set; }
|
||||
public string Track { get; set; }
|
||||
public DateTime PublishDate { get; set; }
|
||||
|
||||
public string PosterUrl { get; set; }
|
||||
|
Reference in New Issue
Block a user