mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
MTV: Fix size
This commit is contained in:
@@ -217,7 +217,7 @@ namespace Jackett.Indexers
|
|||||||
if (torrentId.Contains('#'))
|
if (torrentId.Contains('#'))
|
||||||
torrentId = torrentId.Split('#')[0];
|
torrentId = torrentId.Split('#')[0];
|
||||||
|
|
||||||
var size = ParseSizeToBytes(torrentData[0].TextContent);
|
var size = ReleaseInfo.GetBytes(torrentData[0].TextContent);
|
||||||
var grabs = int.Parse(torrentData[1].TextContent);
|
var grabs = int.Parse(torrentData[1].TextContent);
|
||||||
var seeders = int.Parse(torrentData[2].TextContent);
|
var seeders = int.Parse(torrentData[2].TextContent);
|
||||||
var guid = new Uri(GuidUrl + torrentId);
|
var guid = new Uri(GuidUrl + torrentId);
|
||||||
@@ -253,30 +253,5 @@ namespace Jackett.Indexers
|
|||||||
|
|
||||||
return season;
|
return season;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Changes "xx.xx GB/MB" to bytes
|
|
||||||
private static long ParseSizeToBytes(string strSize)
|
|
||||||
{
|
|
||||||
var sizeParts = strSize.Split(' ');
|
|
||||||
if (sizeParts.Length != 2)
|
|
||||||
throw new Exception($"We expected 2 size parts, instead we have {sizeParts.Length}.");
|
|
||||||
|
|
||||||
var size = double.Parse(sizeParts[0]);
|
|
||||||
|
|
||||||
switch (sizeParts[1].Trim())
|
|
||||||
{
|
|
||||||
case "GB":
|
|
||||||
size = size*1000*1000*1000;
|
|
||||||
break;
|
|
||||||
case "MB":
|
|
||||||
size = size*1000*1000;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception($"Unknown size type {sizeParts[1].Trim()}.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return (long) Math.Ceiling(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user