diff --git a/src/NzbDrone.Core/Indexers/Definitions/BeyondHD.cs b/src/NzbDrone.Core/Indexers/Definitions/BeyondHD.cs index cb7d2cf5f..a8826c259 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/BeyondHD.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/BeyondHD.cs @@ -267,10 +267,6 @@ namespace NzbDrone.Core.Indexers.Definitions 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(); if (row.Internal) @@ -291,8 +287,7 @@ namespace NzbDrone.Core.Indexers.Definitions 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 @@ namespace NzbDrone.Core.Indexers.Definitions 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); } diff --git a/src/NzbDrone.Core/Parser/ParseUtil.cs b/src/NzbDrone.Core/Parser/ParseUtil.cs index ea80afb20..3927adff9 100644 --- a/src/NzbDrone.Core/Parser/ParseUtil.cs +++ b/src/NzbDrone.Core/Parser/ParseUtil.cs @@ -15,6 +15,11 @@ namespace NzbDrone.Core.Parser 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");