Fixed: Issue parsing size from newznab mocking indexers

pull/4/head
Mark McDowall 11 years ago
parent ac18d6c704
commit 174689f533

@ -17,12 +17,12 @@ namespace NzbDrone.Core.Indexers.Newznab
var attributes = item.Elements("attr").ToList(); var attributes = item.Elements("attr").ToList();
var sizeElement = attributes.SingleOrDefault(e => e.Attribute("name").Value.Equals("size", StringComparison.CurrentCultureIgnoreCase)); var sizeElement = attributes.SingleOrDefault(e => e.Attribute("name").Value.Equals("size", StringComparison.CurrentCultureIgnoreCase));
if (sizeElement == null) if (sizeElement != null)
{ {
return Convert.ToInt64(sizeElement.Attribute("value").Value);
} }
return Convert.ToInt64(sizeElement.Attribute("value").Value); return ParseSize(item.Description());
} }
protected override ReleaseInfo PostProcessor(XElement item, ReleaseInfo currentResult) protected override ReleaseInfo PostProcessor(XElement item, ReleaseInfo currentResult)

@ -108,8 +108,6 @@ namespace NzbDrone.Core.Indexers
return currentResult; return currentResult;
} }
public static string ParseReleaseGroup(string title) public static string ParseReleaseGroup(string title)
{ {
title = title.Trim(); title = title.Trim();
@ -132,8 +130,6 @@ namespace NzbDrone.Core.Indexers
private static readonly Regex ReportSizeRegex = new Regex(@"(?<value>\d+\.\d{1,2}|\d+\,\d+\.\d{1,2}|\d+)\W?(?<unit>GB|MB|GiB|MiB)", private static readonly Regex ReportSizeRegex = new Regex(@"(?<value>\d+\.\d{1,2}|\d+\,\d+\.\d{1,2}|\d+)\W?(?<unit>GB|MB|GiB|MiB)",
RegexOptions.IgnoreCase | RegexOptions.Compiled); RegexOptions.IgnoreCase | RegexOptions.Compiled);
public static long ParseSize(string sizeString) public static long ParseSize(string sizeString)
{ {
var match = ReportSizeRegex.Matches(sizeString); var match = ReportSizeRegex.Matches(sizeString);

Loading…
Cancel
Save