mirror of
https://github.com/Prowlarr/Prowlarr
synced 2025-12-24 17:32:37 +01:00
Fixed: (BeyondHD) Don't die on invalid TMDb ids
This commit is contained in:
parent
d1084039b3
commit
ef7e04065c
2 changed files with 13 additions and 6 deletions
|
|
@ -267,10 +267,6 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
|||
var details = row.InfoUrl;
|
||||
var link = row.DownloadLink;
|
||||
|
||||
// BHD can return crazy values for tmdb
|
||||
var tmdbId = row.TmdbId.IsNullOrWhiteSpace() ? 0 : ParseUtil.TryCoerceInt(row.TmdbId.Split("/")[1], out var tmdbResult) ? tmdbResult : 0;
|
||||
var imdbId = ParseUtil.GetImdbId(row.ImdbId).GetValueOrDefault();
|
||||
|
||||
var flags = new HashSet<IndexerFlag>();
|
||||
|
||||
if (row.Internal)
|
||||
|
|
@ -291,8 +287,7 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
|||
Size = row.Size,
|
||||
Grabs = row.Grabs,
|
||||
Seeders = row.Seeders,
|
||||
ImdbId = imdbId,
|
||||
TmdbId = tmdbId,
|
||||
ImdbId = ParseUtil.GetImdbId(row.ImdbId).GetValueOrDefault(),
|
||||
Peers = row.Leechers + row.Seeders,
|
||||
DownloadVolumeFactor = row.Freeleech || row.Limited ? 0 : row.Promo75 ? 0.25 : row.Promo50 ? 0.5 : row.Promo25 ? 0.75 : 1,
|
||||
UploadVolumeFactor = 1,
|
||||
|
|
@ -300,6 +295,13 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
|||
MinimumSeedTime = 172800, // 120 hours
|
||||
};
|
||||
|
||||
// BHD can return crazy values for tmdb
|
||||
if (row.TmdbId.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
var tmdbId = row.TmdbId.Split("/").ElementAtOrDefault(1);
|
||||
release.TmdbId = tmdbId != null && ParseUtil.TryCoerceInt(tmdbId, out var tmdbResult) ? tmdbResult : 0;
|
||||
}
|
||||
|
||||
releaseInfos.Add(release);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@ public static string NormalizeMultiSpaces(string s) =>
|
|||
|
||||
private static string NormalizeNumber(string s, bool isInt = false)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var valStr = new string(s.Where(c => char.IsDigit(c) || c == '.' || c == ',').ToArray());
|
||||
|
||||
valStr = valStr.Trim().Replace("-", "0");
|
||||
|
|
|
|||
Loading…
Reference in a new issue