1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-07-04 11:07:59 +02:00

Fixed: Releases from PTP showing skewed publish date

PTP returns UTC timestamps, without a timezone specifier. Previously, users
would see skewed publish dates, as the UTC timestamps were being parsed
as if they were in the system's timezone. To fix this, we just assume the
publish date is in UTC.
This commit is contained in:
Winter 2023-02-01 18:30:18 -05:00 committed by Qstick
parent affedd7f9d
commit d91578aee3
2 changed files with 3 additions and 2 deletions

View File

@ -1,3 +1,4 @@
using System;
using System.Linq;
using System.Net.Http;
using FluentAssertions;
@ -55,7 +56,7 @@ public void should_parse_feed_from_PTP(string fileName)
first.DownloadUrl.Should().Be("https://passthepopcorn.me/torrents.php?action=download&id=452135&authkey=00000000000000000000000000000000&torrent_pass=00000000000000000000000000000000");
first.InfoUrl.Should().Be("https://passthepopcorn.me/torrents.php?id=148131&torrentid=452135");
// first.PublishDate.Should().Be(DateTime.Parse("2017-04-17T12:13:42+0000").ToUniversalTime()); stupid timezones
first.PublishDate.Should().Be(DateTime.Parse("2016-10-18T23:40:59+0000").ToUniversalTime());
first.Size.Should().Be(2466170624L);
first.InfoHash.Should().BeNullOrEmpty();
first.MagnetUrl.Should().BeNullOrEmpty();

View File

@ -97,7 +97,7 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
InfoUrl = GetInfoUrl(result.GroupId, id),
Seeders = int.Parse(torrent.Seeders),
Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders),
PublishDate = torrent.UploadTime.ToUniversalTime(),
PublishDate = TimeZoneInfo.ConvertTimeToUtc(torrent.UploadTime, TimeZoneInfo.Utc), // PTP returns UTC timestamps, without a timezone specifier.
Golden = torrent.GoldenPopcorn,
Scene = torrent.Scene,
Approved = torrent.Checked,