animetorrents: add current time of day if date added is today

This commit is contained in:
Bogdan 2023-05-11 16:48:47 +03:00
parent c1fe13a3a6
commit f84cb6e334
1 changed files with 11 additions and 2 deletions

View File

@ -134,7 +134,9 @@ namespace Jackett.Common.Indexers
};
if (configData.DownloadableOnly.Value)
{
queryCollection.Set("dlable", "1");
}
searchUrl += "?" + queryCollection.GetQueryString();
@ -153,7 +155,7 @@ namespace Jackett.Common.Indexers
var dom = parser.ParseDocument(results);
var rows = dom.QuerySelectorAll("table tr");
foreach (var row in rows.Skip(1))
foreach (var (row, index) in rows.Skip(1).Select((v, i) => (v, i)))
{
var downloadVolumeFactor = row.QuerySelector("img[alt=\"Gold Torrent\"]") != null ? 0 : row.QuerySelector("img[alt=\"Silver Torrent\"]") != null ? 0.5 : 1;
@ -185,6 +187,13 @@ namespace Jackett.Common.Indexers
var categoryLink = row.QuerySelector("td:nth-of-type(1) a")?.GetAttribute("href") ?? string.Empty;
var categoryId = ParseUtil.GetArgumentFromQueryString(categoryLink, "cat");
var publishedDate = DateTime.ParseExact(row.QuerySelector("td:nth-of-type(5)").TextContent, "dd MMM yy", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
if (publishedDate.Date == DateTime.Today)
{
publishedDate = publishedDate.Date + DateTime.Now.TimeOfDay - TimeSpan.FromMinutes(index);
}
var release = new ReleaseInfo
{
Guid = new Uri(infoUrl),
@ -192,7 +201,7 @@ namespace Jackett.Common.Indexers
Link = new Uri(downloadUrl),
Title = title,
Category = MapTrackerCatToNewznab(categoryId),
PublishDate = DateTime.ParseExact(row.QuerySelector("td:nth-of-type(5)").TextContent, "dd MMM yy", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal),
PublishDate = publishedDate,
Size = ParseUtil.GetBytes(row.QuerySelector("td:nth-of-type(6)").TextContent.Trim()),
Seeders = seeders,
Peers = ParseUtil.CoerceInt(connections[1]) + seeders,