mirror of
https://github.com/Jackett/Jackett
synced 2024-12-24 08:45:47 +00:00
Bug fixes for MoreThanTV and TorrentShack date parsing
This commit is contained in:
parent
ba419a1b8e
commit
e93e95a940
2 changed files with 27 additions and 19 deletions
|
@ -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)
|
||||||
|
|
|
@ -134,24 +134,29 @@ 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();
|
||||||
var dateParts = dateStr.Split(' ');
|
if (dateStr.ToLower().Contains("just now"))
|
||||||
var dateValue = int.Parse(dateParts[0]);
|
release.PublishDate = DateTime.Now;
|
||||||
TimeSpan ts = TimeSpan.Zero;
|
else
|
||||||
if (dateStr.Contains("sec"))
|
{
|
||||||
ts = TimeSpan.FromSeconds(dateValue);
|
var dateParts = dateStr.Split(' ');
|
||||||
else if (dateStr.Contains("min"))
|
var dateValue = int.Parse(dateParts[0]);
|
||||||
ts = TimeSpan.FromMinutes(dateValue);
|
TimeSpan ts = TimeSpan.Zero;
|
||||||
else if (dateStr.Contains("hour"))
|
if (dateStr.Contains("sec"))
|
||||||
ts = TimeSpan.FromHours(dateValue);
|
ts = TimeSpan.FromSeconds(dateValue);
|
||||||
else if (dateStr.Contains("day"))
|
else if (dateStr.Contains("min"))
|
||||||
ts = TimeSpan.FromDays(dateValue);
|
ts = TimeSpan.FromMinutes(dateValue);
|
||||||
else if (dateStr.Contains("week"))
|
else if (dateStr.Contains("hour"))
|
||||||
ts = TimeSpan.FromDays(dateValue * 7);
|
ts = TimeSpan.FromHours(dateValue);
|
||||||
else if (dateStr.Contains("month"))
|
else if (dateStr.Contains("day"))
|
||||||
ts = TimeSpan.FromDays(dateValue * 30);
|
ts = TimeSpan.FromDays(dateValue);
|
||||||
else if (dateStr.Contains("year"))
|
else if (dateStr.Contains("week"))
|
||||||
ts = TimeSpan.FromDays(dateValue * 365);
|
ts = TimeSpan.FromDays(dateValue * 7);
|
||||||
release.PublishDate = DateTime.Now - ts;
|
else if (dateStr.Contains("month"))
|
||||||
|
ts = TimeSpan.FromDays(dateValue * 30);
|
||||||
|
else if (dateStr.Contains("year"))
|
||||||
|
ts = TimeSpan.FromDays(dateValue * 365);
|
||||||
|
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(' ');
|
||||||
|
|
Loading…
Reference in a new issue