mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-04-24 05:47:22 -04:00
Fixed: Mapping of Year, Genre, other from search string
This commit is contained in:
parent
57dcd861a9
commit
810b3612aa
3 changed files with 116 additions and 5 deletions
|
@ -226,6 +226,42 @@ class HistoryRow extends Component {
|
|||
null
|
||||
}
|
||||
|
||||
{
|
||||
data.label ?
|
||||
<HistoryRowParameter
|
||||
title='Label'
|
||||
value={data.label}
|
||||
/> :
|
||||
null
|
||||
}
|
||||
|
||||
{
|
||||
data.track ?
|
||||
<HistoryRowParameter
|
||||
title='Track'
|
||||
value={data.track}
|
||||
/> :
|
||||
null
|
||||
}
|
||||
|
||||
{
|
||||
data.year ?
|
||||
<HistoryRowParameter
|
||||
title='Year'
|
||||
value={data.year}
|
||||
/> :
|
||||
null
|
||||
}
|
||||
|
||||
{
|
||||
data.genre ?
|
||||
<HistoryRowParameter
|
||||
title='Genre'
|
||||
value={data.genre}
|
||||
/> :
|
||||
null
|
||||
}
|
||||
|
||||
{
|
||||
data.author ?
|
||||
<HistoryRowParameter
|
||||
|
@ -243,6 +279,15 @@ class HistoryRow extends Component {
|
|||
/> :
|
||||
null
|
||||
}
|
||||
|
||||
{
|
||||
data.publisher ?
|
||||
<HistoryRowParameter
|
||||
title='Publisher'
|
||||
value={data.publisher}
|
||||
/> :
|
||||
null
|
||||
}
|
||||
</TableRowCell>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -130,6 +130,8 @@ namespace NzbDrone.Core.History
|
|||
history.Data.Add("ImdbId", ((MovieSearchCriteria)message.Query).FullImdbId ?? string.Empty);
|
||||
history.Data.Add("TmdbId", ((MovieSearchCriteria)message.Query).TmdbId?.ToString() ?? string.Empty);
|
||||
history.Data.Add("TraktId", ((MovieSearchCriteria)message.Query).TraktId?.ToString() ?? string.Empty);
|
||||
history.Data.Add("Year", ((MovieSearchCriteria)message.Query).Year?.ToString() ?? string.Empty);
|
||||
history.Data.Add("Genre", ((MovieSearchCriteria)message.Query).Genre ?? string.Empty);
|
||||
}
|
||||
|
||||
if (message.Query is TvSearchCriteria)
|
||||
|
@ -142,18 +144,27 @@ namespace NzbDrone.Core.History
|
|||
history.Data.Add("TvMazeId", ((TvSearchCriteria)message.Query).TvMazeId?.ToString() ?? string.Empty);
|
||||
history.Data.Add("Season", ((TvSearchCriteria)message.Query).Season?.ToString() ?? string.Empty);
|
||||
history.Data.Add("Episode", ((TvSearchCriteria)message.Query).Episode ?? string.Empty);
|
||||
history.Data.Add("Year", ((TvSearchCriteria)message.Query).Year?.ToString() ?? string.Empty);
|
||||
history.Data.Add("Genre", ((TvSearchCriteria)message.Query).Genre ?? string.Empty);
|
||||
}
|
||||
|
||||
if (message.Query is MusicSearchCriteria)
|
||||
{
|
||||
history.Data.Add("Artist", ((MusicSearchCriteria)message.Query).Artist ?? string.Empty);
|
||||
history.Data.Add("Album", ((MusicSearchCriteria)message.Query).Album ?? string.Empty);
|
||||
history.Data.Add("Track", ((MusicSearchCriteria)message.Query).Track ?? string.Empty);
|
||||
history.Data.Add("Label", ((MusicSearchCriteria)message.Query).Label ?? string.Empty);
|
||||
history.Data.Add("Year", ((MusicSearchCriteria)message.Query).Year?.ToString() ?? string.Empty);
|
||||
history.Data.Add("Genre", ((MusicSearchCriteria)message.Query).Genre ?? string.Empty);
|
||||
}
|
||||
|
||||
if (message.Query is BookSearchCriteria)
|
||||
{
|
||||
history.Data.Add("Author", ((BookSearchCriteria)message.Query).Author ?? string.Empty);
|
||||
history.Data.Add("BookTitle", ((BookSearchCriteria)message.Query).Title ?? string.Empty);
|
||||
history.Data.Add("Publisher", ((BookSearchCriteria)message.Query).Publisher ?? string.Empty);
|
||||
history.Data.Add("Year", ((BookSearchCriteria)message.Query).Year?.ToString() ?? string.Empty);
|
||||
history.Data.Add("Genre", ((BookSearchCriteria)message.Query).Genre ?? string.Empty);
|
||||
}
|
||||
|
||||
history.Data.Add("ElapsedTime", message.QueryResult.Response?.ElapsedTime.ToString() ?? string.Empty);
|
||||
|
|
|
@ -4,10 +4,10 @@ namespace NzbDrone.Core.IndexerSearch
|
|||
{
|
||||
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>[^{]+)|(?:publisher\:)(?<publisher>[^{]+)|(?:title\:)(?<title>[^{]+))\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex TvRegex = new Regex(@"\{((?:imdbid\:)(?<imdbid>[^{]+)|(?:rid\:)(?<rid>[^{]+)|(?:tvdbid\:)(?<tvdbid>[^{]+)|(?:tmdbid\:)(?<tmdbid>[^{]+)|(?:doubanid\:)(?<doubanid>[^{]+)|(?:season\:)(?<season>[^{]+)|(?:episode\:)(?<episode>[^{]+)|(?:year\:)(?<year>[^{]+)|(?:genre\:)(?<genre>[^{]+))\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex MovieRegex = new Regex(@"\{((?:imdbid\:)(?<imdbid>[^{]+)|(?:doubanid\:)(?<doubanid>[^{]+)|(?:tmdbid\:)(?<tmdbid>[^{]+)|(?:traktid\:)(?<traktid>[^{]+)|(?:year\:)(?<year>[^{]+)|(?:genre\:)(?<genre>[^{]+))\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex MusicRegex = new Regex(@"\{((?:artist\:)(?<artist>[^{]+)|(?:album\:)(?<album>[^{]+)|(?:track\:)(?<track>[^{]+)|(?:label\:)(?<label>[^{]+)|(?:year\:)(?<year>[^{]+)|(?:genre\:)(?<genre>[^{]+))\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex BookRegex = new Regex(@"\{((?:author\:)(?<author>[^{]+)|(?:publisher\:)(?<publisher>[^{]+)|(?:title\:)(?<title>[^{]+)|(?:year\:)(?<year>[^{]+)|(?:genre\:)(?<genre>[^{]+))\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
public string t { get; set; }
|
||||
public string q { get; set; }
|
||||
|
@ -61,6 +61,11 @@ namespace NzbDrone.Core.IndexerSearch
|
|||
doubanid = int.TryParse(match.Groups["doubanid"].Value, out var tmdb) ? tmdb : null;
|
||||
}
|
||||
|
||||
if (match.Groups["rid"].Success)
|
||||
{
|
||||
rid = int.TryParse(match.Groups["rid"].Value, out var rId) ? rId : null;
|
||||
}
|
||||
|
||||
if (match.Groups["season"].Success)
|
||||
{
|
||||
season = int.TryParse(match.Groups["season"].Value, out var seasonParsed) ? seasonParsed : null;
|
||||
|
@ -71,11 +76,26 @@ namespace NzbDrone.Core.IndexerSearch
|
|||
imdbid = match.Groups["imdbid"].Value;
|
||||
}
|
||||
|
||||
if (match.Groups["traktid"].Success)
|
||||
{
|
||||
traktid = int.TryParse(match.Groups["traktid"].Value, out var trackId) ? trackId : null;
|
||||
}
|
||||
|
||||
if (match.Groups["episode"].Success)
|
||||
{
|
||||
ep = match.Groups["episode"].Value;
|
||||
}
|
||||
|
||||
if (match.Groups["year"].Success)
|
||||
{
|
||||
year = int.TryParse(match.Groups["year"].Value, out var parsedYear) ? parsedYear : null;
|
||||
}
|
||||
|
||||
if (match.Groups["genre"].Success)
|
||||
{
|
||||
genre = match.Groups["genre"].Value;
|
||||
}
|
||||
|
||||
q = q.Replace(match.Value, "");
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +113,7 @@ namespace NzbDrone.Core.IndexerSearch
|
|||
|
||||
if (match.Groups["doubanid"].Success)
|
||||
{
|
||||
doubanid = int.TryParse(match.Groups["doubanid"].Value, out var tmdb) ? tmdb : null;
|
||||
doubanid = int.TryParse(match.Groups["doubanid"].Value, out var doubanId) ? doubanId : null;
|
||||
}
|
||||
|
||||
if (match.Groups["imdbid"].Success)
|
||||
|
@ -101,6 +121,21 @@ namespace NzbDrone.Core.IndexerSearch
|
|||
imdbid = match.Groups["imdbid"].Value;
|
||||
}
|
||||
|
||||
if (match.Groups["traktid"].Success)
|
||||
{
|
||||
traktid = int.TryParse(match.Groups["traktid"].Value, out var trackId) ? trackId : null;
|
||||
}
|
||||
|
||||
if (match.Groups["year"].Success)
|
||||
{
|
||||
year = int.TryParse(match.Groups["year"].Value, out var parsedYear) ? parsedYear : null;
|
||||
}
|
||||
|
||||
if (match.Groups["genre"].Success)
|
||||
{
|
||||
genre = match.Groups["genre"].Value;
|
||||
}
|
||||
|
||||
q = q.Replace(match.Value, "").Trim();
|
||||
}
|
||||
}
|
||||
|
@ -131,6 +166,16 @@ namespace NzbDrone.Core.IndexerSearch
|
|||
label = match.Groups["label"].Value;
|
||||
}
|
||||
|
||||
if (match.Groups["year"].Success)
|
||||
{
|
||||
year = int.TryParse(match.Groups["year"].Value, out var parsedYear) ? parsedYear : null;
|
||||
}
|
||||
|
||||
if (match.Groups["genre"].Success)
|
||||
{
|
||||
genre = match.Groups["genre"].Value;
|
||||
}
|
||||
|
||||
q = q.Replace(match.Value, "").Trim();
|
||||
}
|
||||
}
|
||||
|
@ -156,6 +201,16 @@ namespace NzbDrone.Core.IndexerSearch
|
|||
publisher = match.Groups["publisher"].Value;
|
||||
}
|
||||
|
||||
if (match.Groups["year"].Success)
|
||||
{
|
||||
year = int.TryParse(match.Groups["year"].Value, out var parsedYear) ? parsedYear : null;
|
||||
}
|
||||
|
||||
if (match.Groups["genre"].Success)
|
||||
{
|
||||
genre = match.Groups["genre"].Value;
|
||||
}
|
||||
|
||||
q = q.Replace(match.Value, "").Trim();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue