AlphaRatio: Fix Time (#471)

AlphaRatio: Fix Time
This commit is contained in:
flightlevel 2016-08-26 17:21:04 +10:00 committed by GitHub
parent 5d03e6ec99
commit ef99687187
1 changed files with 19 additions and 2 deletions

View File

@ -30,7 +30,7 @@ namespace Jackett.Indexers
: base(name: "AlphaRatio", : base(name: "AlphaRatio",
description: "Legendary", description: "Legendary",
link: "https://alpharatio.cc/", link: "https://alpharatio.cc/",
caps: TorznabUtil.CreateDefaultTorznabTVCaps(), caps: new TorznabCapabilities(),
manager: i, manager: i,
client: w, client: w,
logger: l, logger: l,
@ -93,6 +93,7 @@ namespace Jackett.Indexers
release.Guid = new Uri(GuidUrl + id); release.Guid = new Uri(GuidUrl + id);
release.Comments = release.Guid; release.Comments = release.Guid;
release.Link = new Uri(DownloadUrl + id); release.Link = new Uri(DownloadUrl + id);
release.Category = MapTrackerCatToNewznab(CategoryReverseMapper((string)r["category"]));
} }
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query) public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
@ -164,7 +165,23 @@ namespace Jackett.Indexers
{ {
DateTime unixStart = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc); DateTime unixStart = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
long unixTimeStampInTicks = (long)(unixTime * TimeSpan.TicksPerSecond); long unixTimeStampInTicks = (long)(unixTime * TimeSpan.TicksPerSecond);
return new DateTime(unixStart.Ticks + unixTimeStampInTicks); return new DateTime(unixStart.Ticks + unixTimeStampInTicks, DateTimeKind.Utc).ToLocalTime();
}
static string CategoryReverseMapper(string categoryName)
{
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("TvSD", "1");
dictionary.Add("TvHD", "2");
dictionary.Add("MovieSD", "6");
dictionary.Add("MovieHD", "7");
if (dictionary.ContainsKey(categoryName))
{
return dictionary[categoryName];
}
return string.Empty;
} }
} }
} }