mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-04-18 02:40:47 +02:00
Fixed: (GreatPosterWall) Use UTC for PublishDate, order releases and map categories accordingly
This commit is contained in:
parent
3dfbfd07dd
commit
57dac6afdd
1 changed files with 22 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
|
|
@ -80,6 +81,8 @@ public override IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteri
|
|||
|
||||
public class GreatPosterWallParser : GazelleParser
|
||||
{
|
||||
private readonly HashSet<string> _hdResolutions = new HashSet<string> { "1080p", "1080i", "720p" };
|
||||
|
||||
public GreatPosterWallParser(GazelleSettings settings, IndexerCapabilities capabilities)
|
||||
: base(settings, capabilities)
|
||||
{
|
||||
|
|
@ -130,8 +133,8 @@ public override IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse
|
|||
Guid = infoUrl,
|
||||
PosterUrl = GetPosterUrl(result.Cover),
|
||||
DownloadUrl = GetDownloadUrl(torrent.TorrentId, torrent.CanUseToken),
|
||||
PublishDate = new DateTimeOffset(time, TimeSpan.FromHours(8)).LocalDateTime, // Time is Chinese Time, add 8 hours difference from UTC and then convert back to local time
|
||||
Categories = new List<IndexerCategory> { NewznabStandardCategory.Movies },
|
||||
PublishDate = new DateTimeOffset(time, TimeSpan.FromHours(8)).UtcDateTime, // Time is Chinese Time, add 8 hours difference from UTC
|
||||
Categories = ParseCategories(torrent),
|
||||
Size = torrent.Size,
|
||||
Seeders = torrent.Seeders,
|
||||
Peers = torrent.Seeders + torrent.Leechers,
|
||||
|
|
@ -173,7 +176,9 @@ public override IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse
|
|||
}
|
||||
}
|
||||
|
||||
return torrentInfos;
|
||||
return torrentInfos
|
||||
.OrderByDescending(o => o.PublishDate)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
protected string GetDownloadUrl(int torrentId, bool canUseToken)
|
||||
|
|
@ -186,6 +191,20 @@ protected string GetDownloadUrl(int torrentId, bool canUseToken)
|
|||
|
||||
return url.FullUri;
|
||||
}
|
||||
|
||||
protected virtual List<IndexerCategory> ParseCategories(GreatPosterWallTorrent torrent)
|
||||
{
|
||||
var cats = new List<IndexerCategory>();
|
||||
|
||||
cats.Add(torrent.Resolution switch
|
||||
{
|
||||
var res when _hdResolutions.Contains(res) => NewznabStandardCategory.MoviesHD,
|
||||
"2160p" => NewznabStandardCategory.MoviesUHD,
|
||||
_ => NewznabStandardCategory.MoviesSD
|
||||
});
|
||||
|
||||
return cats;
|
||||
}
|
||||
}
|
||||
|
||||
public class GreatPosterWallResponse
|
||||
|
|
|
|||
Loading…
Reference in a new issue