From 95a2bd3d03a2c66563e31c243e4e54dff2e5be1a Mon Sep 17 00:00:00 2001 From: Qstick Date: Thu, 19 May 2022 21:58:35 -0500 Subject: [PATCH] Fixed: (Gazelle) Parse grouptime as long or date Closes #973 Fixes #773 Closes #1008 --- src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleApi.cs | 2 +- .../Indexers/Definitions/Gazelle/GazelleParser.cs | 3 ++- src/NzbDrone.Core/Indexers/Definitions/Redacted.cs | 3 ++- src/NzbDrone.Core/Indexers/Definitions/SecretCinema.cs | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleApi.cs b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleApi.cs index 9dd0e8930..7dd3c6d4c 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleApi.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleApi.cs @@ -59,7 +59,7 @@ namespace NzbDrone.Core.Indexers.Gazelle public int TotalSeeders { get; set; } public int TotalSnatched { get; set; } public long MaxSize { get; set; } - public long GroupTime { get; set; } + public string GroupTime { get; set; } public List Torrents { get; set; } public bool IsFreeLeech { get; set; } public bool IsNeutralLeech { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs index 04daef331..acf85f3e2 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs @@ -5,6 +5,7 @@ using System.Net; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; using NzbDrone.Core.Indexers.Exceptions; +using NzbDrone.Core.Parser; using NzbDrone.Core.Parser.Model; namespace NzbDrone.Core.Indexers.Gazelle @@ -120,7 +121,7 @@ namespace NzbDrone.Core.Indexers.Gazelle Peers = int.Parse(result.Leechers) + int.Parse(result.Seeders), Files = result.FileCount, Grabs = result.Snatches, - PublishDate = DateTimeOffset.FromUnixTimeSeconds(result.GroupTime).UtcDateTime, + PublishDate = long.TryParse(result.GroupTime, out var num) ? DateTimeOffset.FromUnixTimeSeconds(num).UtcDateTime : DateTimeUtil.FromFuzzyTime((string)result.GroupTime), PosterUrl = posterUrl, DownloadVolumeFactor = result.IsFreeLeech || result.IsNeutralLeech || result.IsPersonalFreeLeech ? 0 : 1, UploadVolumeFactor = result.IsNeutralLeech ? 0 : 1 diff --git a/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs b/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs index e33077de8..9fe615e10 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs @@ -16,6 +16,7 @@ using NzbDrone.Core.Indexers.Gazelle; using NzbDrone.Core.Indexers.Settings; using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.Messaging.Events; +using NzbDrone.Core.Parser; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Validation; @@ -276,7 +277,7 @@ namespace NzbDrone.Core.Indexers.Definitions InfoUrl = infoUrl, Seeders = int.Parse(result.Seeders), Peers = int.Parse(result.Leechers) + int.Parse(result.Seeders), - PublishDate = DateTimeOffset.FromUnixTimeSeconds(result.GroupTime).UtcDateTime, + PublishDate = DateTimeOffset.FromUnixTimeSeconds(ParseUtil.CoerceLong(result.GroupTime)).UtcDateTime, Freeleech = result.IsFreeLeech || result.IsPersonalFreeLeech, Files = result.FileCount, Grabs = result.Snatches, diff --git a/src/NzbDrone.Core/Indexers/Definitions/SecretCinema.cs b/src/NzbDrone.Core/Indexers/Definitions/SecretCinema.cs index 31553311e..afa3927a4 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/SecretCinema.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/SecretCinema.cs @@ -17,6 +17,7 @@ using NzbDrone.Core.Indexers.Exceptions; using NzbDrone.Core.Indexers.Gazelle; using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.Messaging.Events; +using NzbDrone.Core.Parser; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Validation; @@ -182,7 +183,7 @@ namespace NzbDrone.Core.Indexers.Definitions Peers = int.Parse(result.Leechers) + int.Parse(result.Seeders), Files = result.FileCount, Grabs = result.Snatches, - PublishDate = DateTimeOffset.FromUnixTimeSeconds(result.GroupTime).UtcDateTime, + PublishDate = DateTimeOffset.FromUnixTimeSeconds(ParseUtil.CoerceLong(result.GroupTime)).UtcDateTime, }; var category = result.Category;