mirror of
https://github.com/jellyfin/jellyfin-plugin-opensubtitles.git
synced 2024-11-23 06:09:51 +00:00
Use reset_time_utc in download response
This commit is contained in:
parent
7ee208e0fd
commit
b8337449a5
@ -243,12 +243,9 @@ namespace Jellyfin.Plugin.OpenSubtitles
|
||||
|
||||
var info = await OpenSubtitlesHandler.OpenSubtitles.GetSubtitleLinkAsync(fid, _login, _apiKey, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (info.Data?.Message != null && info.Data.Message.Contains("UTC", StringComparison.Ordinal))
|
||||
if (info.Data?.ResetTime != null)
|
||||
{
|
||||
// "Your quota will be renewed in 20 hours and 52 minutes (2021-08-24 12:02:10 UTC) "
|
||||
var str = info.Data.Message.Split('(')[1].Trim().Replace(" UTC)", "Z", StringComparison.Ordinal);
|
||||
_limitReset = DateTime.Parse(str, _usCulture, DateTimeStyles.AdjustToUniversal);
|
||||
|
||||
_limitReset = info.Data.ResetTime;
|
||||
_logger.LogDebug("Updated expiration time to {ResetTime}", _limitReset);
|
||||
}
|
||||
|
||||
@ -295,7 +292,7 @@ namespace Jellyfin.Plugin.OpenSubtitles
|
||||
{
|
||||
var msg = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"Failed to obtain download link for file {0}: {1}",
|
||||
"Failed to obtain download link for file {0}: {1} (empty response)",
|
||||
fid,
|
||||
info.Code);
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace OpenSubtitlesHandler.Models.Responses
|
||||
{
|
||||
@ -24,5 +25,11 @@ namespace OpenSubtitlesHandler.Models.Responses
|
||||
/// </summary>
|
||||
[JsonPropertyName("message")]
|
||||
public string? Message { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the reset time.
|
||||
/// </summary>
|
||||
[JsonPropertyName("reset_time_utc")]
|
||||
public DateTime? ResetTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user