mirror of
https://github.com/jellyfin/jellyfin-plugin-opensubtitles.git
synced 2024-11-22 21:59:52 +00:00
Better logging (#152)
Some checks failed
🏗️ Build Plugin / call (push) Failing after 0s
📝 Create/Update Release Draft & Release Bump PR / call (push) Failing after 0s
🔬 Run CodeQL / call (push) Failing after 0s
🧪 Test Plugin / call (push) Failing after 0s
🏷️ Sync labels / call (push) Has been cancelled
Some checks failed
🏗️ Build Plugin / call (push) Failing after 0s
📝 Create/Update Release Draft & Release Bump PR / call (push) Failing after 0s
🔬 Run CodeQL / call (push) Failing after 0s
🧪 Test Plugin / call (push) Failing after 0s
🏷️ Sync labels / call (push) Has been cancelled
This commit is contained in:
parent
2518aefd23
commit
c7800c2648
@ -102,7 +102,7 @@ public class OpenSubtitleDownloader : ISubtitleProvider
|
||||
return Enumerable.Empty<RemoteSubtitleInfo>();
|
||||
}
|
||||
|
||||
var language = await GetLanguage(request.TwoLetterISOLanguageName, cancellationToken).ConfigureAwait(false);
|
||||
var language = await GetLanguage(request.TwoLetterISOLanguageName, request.MediaPath, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
string? hash = null;
|
||||
if (!Path.GetExtension(request.MediaPath).Equals(".strm", StringComparison.OrdinalIgnoreCase))
|
||||
@ -303,7 +303,7 @@ public class OpenSubtitleDownloader : ISubtitleProvider
|
||||
if (_login.User is not null)
|
||||
{
|
||||
_login.User.RemainingDownloads = info.Data?.Remaining;
|
||||
_logger.LogInformation("Remaining downloads: {RemainingDownloads}", _login.User.RemainingDownloads);
|
||||
_logger.LogInformation("Remaining subtitle downloads: {RemainingDownloads}", _login.User.RemainingDownloads);
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(info.Data?.Link))
|
||||
@ -403,7 +403,7 @@ public class OpenSubtitleDownloader : ISubtitleProvider
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<string> GetLanguage(string language, CancellationToken cancellationToken)
|
||||
private async Task<string> GetLanguage(string language, string mediaPath, CancellationToken cancellationToken)
|
||||
{
|
||||
if (language == "zh")
|
||||
{
|
||||
@ -434,10 +434,10 @@ public class OpenSubtitleDownloader : ISubtitleProvider
|
||||
|
||||
if (language.Contains('-', StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return await GetLanguage(language.Split('-')[0], cancellationToken).ConfigureAwait(false);
|
||||
return await GetLanguage(language.Split('-')[0], mediaPath, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Language '{0}' is not supported", language));
|
||||
throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Language '{0}' is not supported ({1})", language, mediaPath));
|
||||
}
|
||||
|
||||
internal void ConfigurationChanged(PluginConfiguration e)
|
||||
|
Loading…
Reference in New Issue
Block a user