From 45d90b026ab73f45ae7fea588592e5c267d599e7 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sun, 12 Nov 2023 21:03:21 +0200 Subject: [PATCH] avistaz: use timezone offset for publish dates --- .../Indexers/Abstract/AvistazTracker.cs | 43 +++++++++---------- src/Jackett.Common/Indexers/AvistaZ.cs | 2 + src/Jackett.Common/Indexers/ExoticaZ.cs | 2 + 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/Jackett.Common/Indexers/Abstract/AvistazTracker.cs b/src/Jackett.Common/Indexers/Abstract/AvistazTracker.cs index 9186ea732..8b9521ed9 100644 --- a/src/Jackett.Common/Indexers/Abstract/AvistazTracker.cs +++ b/src/Jackett.Common/Indexers/Abstract/AvistazTracker.cs @@ -25,6 +25,8 @@ namespace Jackett.Common.Indexers.Abstract public override bool SupportsPagination => true; + protected virtual string TimezoneOffset => "-05:00"; // Avistaz does not specify a timezone & returns server time + private readonly Dictionary AuthHeaders = new Dictionary { {"Accept", "application/json"}, @@ -146,7 +148,7 @@ namespace Jackett.Common.Indexers.Abstract cacheService: cs, configData: new ConfigurationDataAvistazTracker()) { - webclient.requestDelay = 3; + webclient.requestDelay = 4; } public override async Task ApplyConfiguration(JToken configJson) @@ -220,20 +222,6 @@ namespace Jackett.Common.Indexers.Abstract { var details = new Uri(row.Value("url")); var link = new Uri(row.Value("download")); - var publishDate = DateTime.ParseExact(row.Value("created_at"), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); - - long? imdb = null; - long? tvdb = null; - long? tmdb = null; - var jMovieTv = row.Value("movie_tv"); - if (jMovieTv != null && jMovieTv.HasValues) - { - imdb = ParseUtil.GetImdbId(jMovieTv.Value("imdb")); - if (long.TryParse(jMovieTv.Value("tvdb"), out var tvdbParsed)) - tvdb = tvdbParsed; - if (long.TryParse(jMovieTv.Value("tmdb"), out var tmdbParsed)) - tmdb = tmdbParsed; - } var description = ""; var jAudio = row.Value("audio"); @@ -249,8 +237,6 @@ namespace Jackett.Common.Indexers.Abstract description += $"
Subtitles: {string.Join(", ", subtitleList)}"; } - var cats = ParseCategories(query, row); - var release = new ReleaseInfo { Title = row.Value("file_name"), @@ -258,17 +244,14 @@ namespace Jackett.Common.Indexers.Abstract InfoHash = row.Value("info_hash"), Details = details, Guid = details, - Category = cats, - PublishDate = publishDate, + Category = ParseCategories(query, row), + PublishDate = DateTime.Parse($"{row.Value("created_at")} {TimezoneOffset}", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal), Description = description, Size = row.Value("file_size"), Files = row.Value("file_count"), Grabs = row.Value("completed"), Seeders = row.Value("seed"), Peers = row.Value("leech") + row.Value("seed"), - Imdb = imdb, - TVDBId = tvdb, - TMDb = tmdb, DownloadVolumeFactor = row.Value("download_multiply"), UploadVolumeFactor = row.Value("upload_multiply"), MinimumRatio = 1, @@ -277,6 +260,22 @@ namespace Jackett.Common.Indexers.Abstract Subs = row.Value("subtitle")?.Select(x => x.Value("language")).ToList() ?? new List(), }; + var jMovieTv = row.Value("movie_tv"); + if (jMovieTv != null && jMovieTv.HasValues) + { + release.Imdb = ParseUtil.GetImdbId(jMovieTv.Value("imdb")); + + if (long.TryParse(jMovieTv.Value("tvdb"), out var tvdbId)) + { + release.TVDBId = tvdbId; + } + + if (long.TryParse(jMovieTv.Value("tmdb"), out var tmdbId)) + { + release.TMDb = tmdbId; + } + } + releases.Add(release); } } diff --git a/src/Jackett.Common/Indexers/AvistaZ.cs b/src/Jackett.Common/Indexers/AvistaZ.cs index fb3d06b06..ec348a1d2 100644 --- a/src/Jackett.Common/Indexers/AvistaZ.cs +++ b/src/Jackett.Common/Indexers/AvistaZ.cs @@ -17,6 +17,8 @@ namespace Jackett.Common.Indexers public override string Description => "Aka AsiaTorrents"; public override string SiteLink { get; protected set; } = "https://avistaz.to/"; + protected override string TimezoneOffset => "+01:00"; + public override TorznabCapabilities TorznabCaps => SetCapabilities(); public AvistaZ(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, diff --git a/src/Jackett.Common/Indexers/ExoticaZ.cs b/src/Jackett.Common/Indexers/ExoticaZ.cs index 68c5a1530..414ad017b 100644 --- a/src/Jackett.Common/Indexers/ExoticaZ.cs +++ b/src/Jackett.Common/Indexers/ExoticaZ.cs @@ -24,6 +24,8 @@ namespace Jackett.Common.Indexers "https://torrents.yourexotic.com/" }; + protected override string TimezoneOffset => "+01:00"; + public override TorznabCapabilities TorznabCaps => SetCapabilities(); private new ConfigurationDataAvistazTracker configData => (ConfigurationDataAvistazTracker)base.configData;