1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2024-12-25 01:07:38 +00:00

Bug fixes for MoreThanTV and TorrentShack date parsing

This commit is contained in:
zone117x 2015-05-09 12:53:28 -06:00
parent ba419a1b8e
commit e93e95a940
2 changed files with 27 additions and 19 deletions

View file

@ -166,8 +166,11 @@ namespace Jackett.Indexers
var json = JObject.Parse(results); var json = JObject.Parse(results);
foreach (JObject r in json["response"]["results"]) foreach (JObject r in json["response"]["results"])
{ {
DateTime pubDate = DateTime.MinValue;
double dateNum;
if (double.TryParse((string)r["groupTime"], out dateNum))
pubDate = UnixTimestampToDateTime(dateNum);
var pubDate = UnixTimestampToDateTime(double.Parse((string)r["groupTime"]));
var groupName = (string)r["groupName"]; var groupName = (string)r["groupName"];
if (r["torrents"] is JArray) if (r["torrents"] is JArray)

View file

@ -134,6 +134,10 @@ namespace Jackett.Indexers
release.Link = new Uri(BaseUrl + "/" + qRow.Find(".torrent_handle_links > a").First().Attr("href")); release.Link = new Uri(BaseUrl + "/" + qRow.Find(".torrent_handle_links > a").First().Attr("href"));
var dateStr = qRow.Find(".time").Text().Trim(); var dateStr = qRow.Find(".time").Text().Trim();
if (dateStr.ToLower().Contains("just now"))
release.PublishDate = DateTime.Now;
else
{
var dateParts = dateStr.Split(' '); var dateParts = dateStr.Split(' ');
var dateValue = int.Parse(dateParts[0]); var dateValue = int.Parse(dateParts[0]);
TimeSpan ts = TimeSpan.Zero; TimeSpan ts = TimeSpan.Zero;
@ -152,6 +156,7 @@ namespace Jackett.Indexers
else if (dateStr.Contains("year")) else if (dateStr.Contains("year"))
ts = TimeSpan.FromDays(dateValue * 365); ts = TimeSpan.FromDays(dateValue * 365);
release.PublishDate = DateTime.Now - ts; release.PublishDate = DateTime.Now - ts;
}
var sizeStr = qRow.Find(".size")[0].ChildNodes[0].NodeValue.Trim(); var sizeStr = qRow.Find(".size")[0].ChildNodes[0].NodeValue.Trim();
var sizeParts = sizeStr.Split(' '); var sizeParts = sizeStr.Split(' ');