From d91578aee344f9e140b31cf8e31b0f611201b8b7 Mon Sep 17 00:00:00 2001 From: Winter Date: Wed, 1 Feb 2023 18:30:18 -0500 Subject: [PATCH] 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. --- src/NzbDrone.Core.Test/IndexerTests/PTPTests/PTPFixture.cs | 3 ++- .../Indexers/PassThePopcorn/PassThePopcornParser.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core.Test/IndexerTests/PTPTests/PTPFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/PTPTests/PTPFixture.cs index 0fadce7d2..ce2a26050 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/PTPTests/PTPFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/PTPTests/PTPFixture.cs @@ -1,3 +1,4 @@ +using System; using System.Linq; using System.Net.Http; using FluentAssertions; @@ -55,7 +56,7 @@ namespace NzbDrone.Core.Test.IndexerTests.PTPTests 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(); diff --git a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs index ae11e0196..8040f8cbe 100644 --- a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs +++ b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs @@ -97,7 +97,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn 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,