mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-04-25 06:17:26 -04:00
Fixed: Standardize dashes/single quotes in search term, ignore artist if "VA"
This commit is contained in:
parent
306209fcc2
commit
f99a2e1164
10 changed files with 87 additions and 149 deletions
|
@ -10,17 +10,6 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
||||||
public int? Year { get; set; }
|
public int? Year { get; set; }
|
||||||
public string Genre { get; set; }
|
public string Genre { get; set; }
|
||||||
|
|
||||||
public override bool RssSearch
|
public override bool RssSearch => SearchTerm.IsNullOrWhiteSpace() && Author.IsNullOrWhiteSpace() && Title.IsNullOrWhiteSpace();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (SearchTerm.IsNullOrWhiteSpace() && Author.IsNullOrWhiteSpace() && Title.IsNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,18 +13,7 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
||||||
public int? Year { get; set; }
|
public int? Year { get; set; }
|
||||||
public string Genre { get; set; }
|
public string Genre { get; set; }
|
||||||
|
|
||||||
public override bool RssSearch
|
public override bool RssSearch => SearchTerm.IsNullOrWhiteSpace() && ImdbId.IsNullOrWhiteSpace() && !TmdbId.HasValue && !TraktId.HasValue;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (SearchTerm.IsNullOrWhiteSpace() && ImdbId.IsNullOrWhiteSpace() && !TmdbId.HasValue && !TraktId.HasValue)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string FullImdbId => ParseUtil.GetFullImdbId(ImdbId);
|
public string FullImdbId => ParseUtil.GetFullImdbId(ImdbId);
|
||||||
|
|
||||||
|
|
|
@ -11,17 +11,6 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
||||||
public string Track { get; set; }
|
public string Track { get; set; }
|
||||||
public int? Year { get; set; }
|
public int? Year { get; set; }
|
||||||
|
|
||||||
public override bool RssSearch
|
public override bool RssSearch => SearchTerm.IsNullOrWhiteSpace() && Album.IsNullOrWhiteSpace() && Artist.IsNullOrWhiteSpace() && Label.IsNullOrWhiteSpace();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (SearchTerm.IsNullOrWhiteSpace() && Album.IsNullOrWhiteSpace() && Artist.IsNullOrWhiteSpace() && Label.IsNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,8 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
||||||
{
|
{
|
||||||
public abstract class SearchCriteriaBase
|
public abstract class SearchCriteriaBase
|
||||||
{
|
{
|
||||||
private static readonly Regex SpecialCharacter = new Regex(@"[`'.]", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
private static readonly Regex StandardizeDashesRegex = new (@"\p{Pd}+", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
private static readonly Regex NonWord = new Regex(@"[\W]", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
private static readonly Regex StandardizeSingleQuotesRegex = new (@"[\u0060\u00B4\u2018\u2019]", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
private static readonly Regex BeginningThe = new Regex(@"^the\s", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
|
||||||
|
|
||||||
public virtual bool InteractiveSearch { get; set; }
|
public virtual bool InteractiveSearch { get; set; }
|
||||||
public List<int> IndexerIds { get; set; }
|
public List<int> IndexerIds { get; set; }
|
||||||
|
@ -21,58 +20,24 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
||||||
public string Source { get; set; }
|
public string Source { get; set; }
|
||||||
public string Host { get; set; }
|
public string Host { get; set; }
|
||||||
|
|
||||||
public virtual string SearchQuery
|
public override string ToString() => $"{SearchQuery}, Offset: {Offset ?? 0}, Limit: {Limit ?? 0}, Categories: [{string.Join(", ", Categories)}]";
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return $"Term: [{SearchTerm}]";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
public virtual string SearchQuery => $"Term: [{SearchTerm}]";
|
||||||
{
|
|
||||||
return $"{SearchQuery}, Offset: {Offset ?? 0}, Limit: {Limit ?? 0}, Categories: [{string.Join(", ", Categories)}]";
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool RssSearch
|
public virtual bool RssSearch => SearchTerm.IsNullOrWhiteSpace();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (SearchTerm.IsNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
public string SanitizedSearchTerm => GetSanitizedTerm(SearchTerm);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string SanitizedSearchTerm
|
private static string GetSanitizedTerm(string term)
|
||||||
{
|
{
|
||||||
get
|
term ??= "";
|
||||||
{
|
|
||||||
var term = SearchTerm;
|
term = StandardizeDashesRegex.Replace(term, "-");
|
||||||
if (SearchTerm == null)
|
term = StandardizeSingleQuotesRegex.Replace(term, "'");
|
||||||
{
|
|
||||||
term = "";
|
var safeTitle = term.Where(c => char.IsLetterOrDigit(c) || char.IsWhiteSpace(c) || c is '-' or '.' or '_' or '(' or ')' or '@' or '/' or '\'' or '[' or ']' or '+' or '%');
|
||||||
}
|
|
||||||
|
|
||||||
var safeTitle = term.Where(c => (char.IsLetterOrDigit(c)
|
|
||||||
|| char.IsWhiteSpace(c)
|
|
||||||
|| c == '-'
|
|
||||||
|| c == '.'
|
|
||||||
|| c == '_'
|
|
||||||
|| c == '('
|
|
||||||
|| c == ')'
|
|
||||||
|| c == '@'
|
|
||||||
|| c == '/'
|
|
||||||
|| c == '\''
|
|
||||||
|| c == '['
|
|
||||||
|| c == ']'
|
|
||||||
|| c == '+'
|
|
||||||
|| c == '%'));
|
|
||||||
return string.Concat(safeTitle);
|
return string.Concat(safeTitle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,23 +21,12 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
||||||
public int? Year { get; set; }
|
public int? Year { get; set; }
|
||||||
public string Genre { get; set; }
|
public string Genre { get; set; }
|
||||||
|
|
||||||
public string SanitizedTvSearchString => (SanitizedSearchTerm + " " + EpisodeSearchString).Trim();
|
public string SanitizedTvSearchString => $"{SanitizedSearchTerm} {EpisodeSearchString}".Trim();
|
||||||
public string EpisodeSearchString => GetEpisodeSearchString();
|
public string EpisodeSearchString => GetEpisodeSearchString();
|
||||||
|
|
||||||
public string FullImdbId => ParseUtil.GetFullImdbId(ImdbId);
|
public string FullImdbId => ParseUtil.GetFullImdbId(ImdbId);
|
||||||
|
|
||||||
public override bool RssSearch
|
public override bool RssSearch => SearchTerm.IsNullOrWhiteSpace() && ImdbId.IsNullOrWhiteSpace() && !TvdbId.HasValue && !RId.HasValue && !TraktId.HasValue && !TvMazeId.HasValue;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (SearchTerm.IsNullOrWhiteSpace() && ImdbId.IsNullOrWhiteSpace() && !TvdbId.HasValue && !RId.HasValue && !TraktId.HasValue && !TvMazeId.HasValue)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string SearchQuery
|
public override string SearchQuery
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class GazelleRequestGenerator : IIndexerRequestGenerator
|
||||||
{
|
{
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
|
|
||||||
var parameters = GetBasicSearchParameters(searchCriteria.SearchTerm, searchCriteria.Categories);
|
var parameters = GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
|
||||||
|
|
||||||
if (searchCriteria.ImdbId != null)
|
if (searchCriteria.ImdbId != null)
|
||||||
{
|
{
|
||||||
|
@ -62,9 +62,9 @@ public class GazelleRequestGenerator : IIndexerRequestGenerator
|
||||||
{
|
{
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
|
|
||||||
var parameters = GetBasicSearchParameters(searchCriteria.SearchTerm, searchCriteria.Categories);
|
var parameters = GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
|
||||||
|
|
||||||
if (searchCriteria.Artist.IsNotNullOrWhiteSpace())
|
if (searchCriteria.Artist.IsNotNullOrWhiteSpace() && searchCriteria.Artist != "VA")
|
||||||
{
|
{
|
||||||
parameters.Set("artistname", searchCriteria.Artist);
|
parameters.Set("artistname", searchCriteria.Artist);
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ public class GazelleRequestGenerator : IIndexerRequestGenerator
|
||||||
{
|
{
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
|
|
||||||
var parameters = GetBasicSearchParameters(searchCriteria.SearchTerm, searchCriteria.Categories);
|
var parameters = GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
|
||||||
pageableRequests.Add(GetRequest(parameters));
|
pageableRequests.Add(GetRequest(parameters));
|
||||||
|
|
||||||
return pageableRequests;
|
return pageableRequests;
|
||||||
|
@ -114,7 +114,7 @@ public class GazelleRequestGenerator : IIndexerRequestGenerator
|
||||||
{
|
{
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
|
|
||||||
var parameters = GetBasicSearchParameters(searchCriteria.SearchTerm, searchCriteria.Categories);
|
var parameters = GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
|
||||||
pageableRequests.Add(GetRequest(parameters));
|
pageableRequests.Add(GetRequest(parameters));
|
||||||
|
|
||||||
return pageableRequests;
|
return pageableRequests;
|
||||||
|
|
|
@ -128,14 +128,17 @@ public class LibbleRequestGenerator : IIndexerRequestGenerator
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
var parameters = new NameValueCollection();
|
var parameters = new NameValueCollection();
|
||||||
|
|
||||||
if (searchCriteria.Artist.IsNotNullOrWhiteSpace())
|
if (searchCriteria.Artist.IsNotNullOrWhiteSpace() && searchCriteria.Artist != "VA")
|
||||||
{
|
{
|
||||||
parameters.Set("artistname", searchCriteria.Artist);
|
parameters.Set("artistname", searchCriteria.Artist);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchCriteria.Album.IsNotNullOrWhiteSpace())
|
if (searchCriteria.Album.IsNotNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
parameters.Set("groupname", searchCriteria.Album);
|
// Remove year
|
||||||
|
var album = Regex.Replace(searchCriteria.Album, @"(.+)\b\d{4}$", "$1");
|
||||||
|
|
||||||
|
parameters.Set("groupname", album.Trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchCriteria.Label.IsNotNullOrWhiteSpace())
|
if (searchCriteria.Label.IsNotNullOrWhiteSpace())
|
||||||
|
@ -188,9 +191,14 @@ public class LibbleRequestGenerator : IIndexerRequestGenerator
|
||||||
{
|
{
|
||||||
var term = searchCriteria.SanitizedSearchTerm.Trim();
|
var term = searchCriteria.SanitizedSearchTerm.Trim();
|
||||||
|
|
||||||
|
parameters.Set("action", "advanced");
|
||||||
parameters.Set("order_by", "time");
|
parameters.Set("order_by", "time");
|
||||||
parameters.Set("order_way", "desc");
|
parameters.Set("order_way", "desc");
|
||||||
|
|
||||||
|
if (term.IsNotNullOrWhiteSpace())
|
||||||
|
{
|
||||||
parameters.Set("searchstr", term);
|
parameters.Set("searchstr", term);
|
||||||
|
}
|
||||||
|
|
||||||
var queryCats = _capabilities.Categories.MapTorznabCapsToTrackers(searchCriteria.Categories);
|
var queryCats = _capabilities.Categories.MapTorznabCapsToTrackers(searchCriteria.Categories);
|
||||||
if (queryCats.Any())
|
if (queryCats.Any())
|
||||||
|
@ -276,7 +284,9 @@ public class LibbleParser : IParseIndexerResponse
|
||||||
Guid = infoUrl,
|
Guid = infoUrl,
|
||||||
InfoUrl = infoUrl,
|
InfoUrl = infoUrl,
|
||||||
DownloadUrl = downloadLink,
|
DownloadUrl = downloadLink,
|
||||||
Title = $"{releaseArtist} - {releaseAlbumName} {releaseAlbumYear} {releaseTags}".Trim(' ', '-'),
|
Title = $"{releaseArtist} - {releaseAlbumName} {releaseAlbumYear.Value} {releaseTags}".Trim(' ', '-'),
|
||||||
|
Artist = releaseArtist,
|
||||||
|
Album = releaseAlbumName,
|
||||||
Categories = ParseCategories(group),
|
Categories = ParseCategories(group),
|
||||||
Description = releaseDescription,
|
Description = releaseDescription,
|
||||||
Size = ParseUtil.GetBytes(row.QuerySelector("td:nth-child(4)").TextContent.Trim()),
|
Size = ParseUtil.GetBytes(row.QuerySelector("td:nth-child(4)").TextContent.Trim()),
|
||||||
|
|
|
@ -135,22 +135,22 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
var parameters = new NameValueCollection();
|
var parameters = new NameValueCollection();
|
||||||
|
|
||||||
if (searchCriteria.Artist.IsNotNullOrWhiteSpace())
|
if (searchCriteria.Artist.IsNotNullOrWhiteSpace() && searchCriteria.Artist != "VA")
|
||||||
{
|
{
|
||||||
parameters.Add("artistname", searchCriteria.Artist);
|
parameters.Set("artistname", searchCriteria.Artist);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchCriteria.Album.IsNotNullOrWhiteSpace())
|
if (searchCriteria.Album.IsNotNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
parameters.Add("groupname", searchCriteria.Album);
|
parameters.Set("groupname", searchCriteria.Album);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchCriteria.Year.HasValue)
|
if (searchCriteria.Year.HasValue)
|
||||||
{
|
{
|
||||||
parameters.Add("year", searchCriteria.Year.ToString());
|
parameters.Set("year", searchCriteria.Year.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
pageableRequests.Add(GetRequest(searchCriteria, parameters));
|
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
|
||||||
|
|
||||||
return pageableRequests;
|
return pageableRequests;
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
var parameters = new NameValueCollection();
|
var parameters = new NameValueCollection();
|
||||||
|
|
||||||
pageableRequests.Add(GetRequest(searchCriteria, parameters));
|
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
|
||||||
|
|
||||||
return pageableRequests;
|
return pageableRequests;
|
||||||
}
|
}
|
||||||
|
@ -180,28 +180,28 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
var parameters = new NameValueCollection();
|
var parameters = new NameValueCollection();
|
||||||
|
|
||||||
pageableRequests.Add(GetRequest(searchCriteria, parameters));
|
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
|
||||||
|
|
||||||
return pageableRequests;
|
return pageableRequests;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<IndexerRequest> GetRequest(SearchCriteriaBase searchCriteria, NameValueCollection parameters)
|
private IEnumerable<IndexerRequest> GetPagedRequests(SearchCriteriaBase searchCriteria, NameValueCollection parameters)
|
||||||
{
|
{
|
||||||
var term = searchCriteria.SanitizedSearchTerm.Trim();
|
var term = searchCriteria.SanitizedSearchTerm.Trim();
|
||||||
|
|
||||||
parameters.Add("action", "browse");
|
parameters.Set("action", "browse");
|
||||||
parameters.Add("order_by", "time");
|
parameters.Set("order_by", "time");
|
||||||
parameters.Add("order_way", "desc");
|
parameters.Set("order_way", "desc");
|
||||||
parameters.Add("searchstr", term);
|
|
||||||
|
if (term.IsNotNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
parameters.Set("searchstr", term);
|
||||||
|
}
|
||||||
|
|
||||||
var queryCats = _capabilities.Categories.MapTorznabCapsToTrackers(searchCriteria.Categories);
|
var queryCats = _capabilities.Categories.MapTorznabCapsToTrackers(searchCriteria.Categories);
|
||||||
|
if (queryCats.Any())
|
||||||
if (queryCats.Count > 0)
|
|
||||||
{
|
{
|
||||||
foreach (var cat in queryCats)
|
queryCats.ForEach(cat => parameters.Set($"filter_cat[{cat}]", "1"));
|
||||||
{
|
|
||||||
parameters.Add($"filter_cat[{cat}]", "1");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var request = RequestBuilder()
|
var request = RequestBuilder()
|
||||||
|
@ -267,12 +267,14 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||||
var release = new GazelleInfo
|
var release = new GazelleInfo
|
||||||
{
|
{
|
||||||
Guid = infoUrl,
|
Guid = infoUrl,
|
||||||
|
InfoUrl = infoUrl,
|
||||||
|
DownloadUrl = GetDownloadUrl(id, torrent.CanUseToken),
|
||||||
Title = WebUtility.HtmlDecode(title),
|
Title = WebUtility.HtmlDecode(title),
|
||||||
|
Artist = WebUtility.HtmlDecode(result.Artist),
|
||||||
|
Album = WebUtility.HtmlDecode(result.GroupName),
|
||||||
Container = torrent.Encoding,
|
Container = torrent.Encoding,
|
||||||
Codec = torrent.Format,
|
Codec = torrent.Format,
|
||||||
Size = long.Parse(torrent.Size),
|
Size = long.Parse(torrent.Size),
|
||||||
DownloadUrl = GetDownloadUrl(id, torrent.CanUseToken),
|
|
||||||
InfoUrl = infoUrl,
|
|
||||||
Seeders = int.Parse(torrent.Seeders),
|
Seeders = int.Parse(torrent.Seeders),
|
||||||
Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders),
|
Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders),
|
||||||
PublishDate = torrent.Time.ToUniversalTime(),
|
PublishDate = torrent.Time.ToUniversalTime(),
|
||||||
|
|
|
@ -117,22 +117,22 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
var parameters = new NameValueCollection();
|
var parameters = new NameValueCollection();
|
||||||
|
|
||||||
if (searchCriteria.Artist.IsNotNullOrWhiteSpace())
|
if (searchCriteria.Artist.IsNotNullOrWhiteSpace() && searchCriteria.Artist != "VA")
|
||||||
{
|
{
|
||||||
parameters.Add("artistname", searchCriteria.Artist);
|
parameters.Set("artistname", searchCriteria.Artist);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchCriteria.Album.IsNotNullOrWhiteSpace())
|
if (searchCriteria.Album.IsNotNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
parameters.Add("groupname", searchCriteria.Album);
|
parameters.Set("groupname", searchCriteria.Album);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchCriteria.Year.HasValue)
|
if (searchCriteria.Year.HasValue)
|
||||||
{
|
{
|
||||||
parameters.Add("year", searchCriteria.Year.ToString());
|
parameters.Set("year", searchCriteria.Year.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
pageableRequests.Add(GetRequest(searchCriteria, parameters));
|
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
|
||||||
|
|
||||||
return pageableRequests;
|
return pageableRequests;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
var parameters = new NameValueCollection();
|
var parameters = new NameValueCollection();
|
||||||
|
|
||||||
pageableRequests.Add(GetRequest(searchCriteria, parameters));
|
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
|
||||||
|
|
||||||
return pageableRequests;
|
return pageableRequests;
|
||||||
}
|
}
|
||||||
|
@ -162,27 +162,28 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
var parameters = new NameValueCollection();
|
var parameters = new NameValueCollection();
|
||||||
|
|
||||||
pageableRequests.Add(GetRequest(searchCriteria, parameters));
|
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
|
||||||
|
|
||||||
return pageableRequests;
|
return pageableRequests;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<IndexerRequest> GetRequest(SearchCriteriaBase searchCriteria, NameValueCollection parameters)
|
private IEnumerable<IndexerRequest> GetPagedRequests(SearchCriteriaBase searchCriteria, NameValueCollection parameters)
|
||||||
{
|
{
|
||||||
var term = searchCriteria.SanitizedSearchTerm.Trim();
|
var term = searchCriteria.SanitizedSearchTerm.Trim();
|
||||||
|
|
||||||
parameters.Add("action", "browse");
|
parameters.Set("action", "browse");
|
||||||
parameters.Add("order_by", "time");
|
parameters.Set("order_by", "time");
|
||||||
parameters.Add("order_way", "desc");
|
parameters.Set("order_way", "desc");
|
||||||
parameters.Add("searchstr", term);
|
|
||||||
|
if (term.IsNotNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
parameters.Set("searchstr", term);
|
||||||
|
}
|
||||||
|
|
||||||
var queryCats = _capabilities.Categories.MapTorznabCapsToTrackers(searchCriteria.Categories);
|
var queryCats = _capabilities.Categories.MapTorznabCapsToTrackers(searchCriteria.Categories);
|
||||||
if (queryCats.Any())
|
if (queryCats.Any())
|
||||||
{
|
{
|
||||||
foreach (var cat in queryCats)
|
queryCats.ForEach(cat => parameters.Set($"filter_cat[{cat}]", "1"));
|
||||||
{
|
|
||||||
parameters.Add($"filter_cat[{cat}]", "1");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var request = RequestBuilder()
|
var request = RequestBuilder()
|
||||||
|
@ -248,12 +249,14 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||||
var release = new GazelleInfo
|
var release = new GazelleInfo
|
||||||
{
|
{
|
||||||
Guid = infoUrl,
|
Guid = infoUrl,
|
||||||
|
InfoUrl = infoUrl,
|
||||||
|
DownloadUrl = GetDownloadUrl(id, torrent.CanUseToken),
|
||||||
Title = WebUtility.HtmlDecode(title),
|
Title = WebUtility.HtmlDecode(title),
|
||||||
|
Artist = WebUtility.HtmlDecode(result.Artist),
|
||||||
|
Album = WebUtility.HtmlDecode(result.GroupName),
|
||||||
Container = torrent.Encoding,
|
Container = torrent.Encoding,
|
||||||
Codec = torrent.Format,
|
Codec = torrent.Format,
|
||||||
Size = long.Parse(torrent.Size),
|
Size = long.Parse(torrent.Size),
|
||||||
DownloadUrl = GetDownloadUrl(id, torrent.CanUseToken),
|
|
||||||
InfoUrl = infoUrl,
|
|
||||||
Seeders = int.Parse(torrent.Seeders),
|
Seeders = int.Parse(torrent.Seeders),
|
||||||
Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders),
|
Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders),
|
||||||
PublishDate = torrent.Time.ToUniversalTime(),
|
PublishDate = torrent.Time.ToUniversalTime(),
|
||||||
|
|
|
@ -146,13 +146,15 @@ public class SecretCinemaParser : IParseIndexerResponse
|
||||||
release.Title = $"{title} ({result.GroupYear}) {torrent.Media}";
|
release.Title = $"{title} ({result.GroupYear}) {torrent.Media}";
|
||||||
|
|
||||||
// Replace media formats with standards
|
// Replace media formats with standards
|
||||||
release.Title = Regex.Replace(release.Title, "BDMV", "COMPLETE BLURAY", RegexOptions.IgnoreCase);
|
release.Title = Regex.Replace(release.Title, @"\bBDMV\b", "COMPLETE BLURAY", RegexOptions.IgnoreCase);
|
||||||
release.Title = Regex.Replace(release.Title, "SD", "DVDRip", RegexOptions.IgnoreCase);
|
release.Title = Regex.Replace(release.Title, @"\bSD\b", "DVDRip", RegexOptions.IgnoreCase);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// SC API currently doesn't return anything but title.
|
// SC API currently doesn't return anything but title.
|
||||||
release.Title = $"{artist} - {title} ({result.GroupYear}) [{torrent.Format} {torrent.Encoding}] [{torrent.Media}]";
|
release.Title = $"{artist} - {title} ({result.GroupYear}) [{torrent.Format} {torrent.Encoding}] [{torrent.Media}]";
|
||||||
|
release.Artist = artist;
|
||||||
|
release.Album = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (torrent.HasCue)
|
if (torrent.HasCue)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue