mirror of https://github.com/jellyfin/jellyfin.git
3.0.5641.0
This commit is contained in:
parent
2c4e27dac2
commit
67c4c9381f
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Providers;
|
using MediaBrowser.Model.Providers;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
@ -35,5 +36,12 @@ namespace MediaBrowser.Controller.Subtitles
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task{SubtitleResponse}.</returns>
|
/// <returns>Task{SubtitleResponse}.</returns>
|
||||||
Task<SubtitleResponse> GetSubtitles(string id, CancellationToken cancellationToken);
|
Task<SubtitleResponse> GetSubtitles(string id, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the supported languages.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task<IEnumerable<NameIdPair>>.</returns>
|
||||||
|
Task<IEnumerable<NameIdPair>> GetSupportedLanguages(CancellationToken cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,11 @@ using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Controller.Security;
|
using MediaBrowser.Controller.Security;
|
||||||
using MediaBrowser.Controller.Subtitles;
|
using MediaBrowser.Controller.Subtitles;
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Providers;
|
using MediaBrowser.Model.Providers;
|
||||||
|
using MediaBrowser.Model.Serialization;
|
||||||
using OpenSubtitlesHandler;
|
using OpenSubtitlesHandler;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -38,17 +39,23 @@ namespace MediaBrowser.Providers.Subtitles
|
||||||
// And the user may restart the server
|
// And the user may restart the server
|
||||||
private const int MaxDownloadsPerDay = 150;
|
private const int MaxDownloadsPerDay = 150;
|
||||||
|
|
||||||
public OpenSubtitleDownloader(ILogManager logManager, IHttpClient httpClient, IServerConfigurationManager config, IEncryptionManager encryption)
|
private readonly IJsonSerializer _json;
|
||||||
|
|
||||||
|
public OpenSubtitleDownloader(ILogManager logManager, IHttpClient httpClient, IServerConfigurationManager config, IEncryptionManager encryption, IJsonSerializer json)
|
||||||
{
|
{
|
||||||
_logger = logManager.GetLogger(GetType().Name);
|
_logger = logManager.GetLogger(GetType().Name);
|
||||||
_httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
_config = config;
|
_config = config;
|
||||||
_encryption = encryption;
|
_encryption = encryption;
|
||||||
|
_json = json;
|
||||||
|
|
||||||
_config.NamedConfigurationUpdating += _config_NamedConfigurationUpdating;
|
_config.NamedConfigurationUpdating += _config_NamedConfigurationUpdating;
|
||||||
|
|
||||||
// Reset the count every 24 hours
|
// Reset the count every 24 hours
|
||||||
_dailyTimer = new Timer(state => _dailyDownloadCount = 0, null, TimeSpan.FromHours(24), TimeSpan.FromHours(24));
|
_dailyTimer = new Timer(state => _dailyDownloadCount = 0, null, TimeSpan.FromHours(24), TimeSpan.FromHours(24));
|
||||||
|
|
||||||
|
Utilities.HttpClient = httpClient;
|
||||||
|
OpenSubtitles.SetUserAgent("mediabrowser.tv");
|
||||||
}
|
}
|
||||||
|
|
||||||
private const string PasswordHashPrefix = "h:";
|
private const string PasswordHashPrefix = "h:";
|
||||||
|
@ -195,6 +202,26 @@ namespace MediaBrowser.Providers.Subtitles
|
||||||
_lastLogin = DateTime.UtcNow;
|
_lastLogin = DateTime.UtcNow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<NameIdPair>> GetSupportedLanguages(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
await Login(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
var result = OpenSubtitles.GetSubLanguages("en");
|
||||||
|
if (!(result is MethodResponseGetSubLanguages))
|
||||||
|
{
|
||||||
|
_logger.Error("Invalid response type");
|
||||||
|
return new List<NameIdPair>();
|
||||||
|
}
|
||||||
|
|
||||||
|
var results = ((MethodResponseGetSubLanguages)result).Languages;
|
||||||
|
|
||||||
|
return results.Select(i => new NameIdPair
|
||||||
|
{
|
||||||
|
Name = i.LanguageName,
|
||||||
|
Id = i.SubLanguageID
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<RemoteSubtitleInfo>> Search(SubtitleSearchRequest request, CancellationToken cancellationToken)
|
public async Task<IEnumerable<RemoteSubtitleInfo>> Search(SubtitleSearchRequest request, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var imdbIdText = request.GetProviderId(MetadataProviders.Imdb);
|
var imdbIdText = request.GetProviderId(MetadataProviders.Imdb);
|
||||||
|
@ -229,9 +256,6 @@ namespace MediaBrowser.Providers.Subtitles
|
||||||
return new List<RemoteSubtitleInfo>();
|
return new List<RemoteSubtitleInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utilities.HttpClient = _httpClient;
|
|
||||||
OpenSubtitles.SetUserAgent("mediabrowser.tv");
|
|
||||||
|
|
||||||
await Login(cancellationToken).ConfigureAwait(false);
|
await Login(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var subLanguageId = request.Language;
|
var subLanguageId = request.Language;
|
||||||
|
@ -260,7 +284,7 @@ namespace MediaBrowser.Providers.Subtitles
|
||||||
var result = await OpenSubtitles.SearchSubtitlesAsync(parms.ToArray(), cancellationToken).ConfigureAwait(false);
|
var result = await OpenSubtitles.SearchSubtitlesAsync(parms.ToArray(), cancellationToken).ConfigureAwait(false);
|
||||||
if (!(result is MethodResponseSubtitleSearch))
|
if (!(result is MethodResponseSubtitleSearch))
|
||||||
{
|
{
|
||||||
_logger.Debug("Invalid response type");
|
_logger.Error("Invalid response type");
|
||||||
return new List<RemoteSubtitleInfo>();
|
return new List<RemoteSubtitleInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -398,21 +398,21 @@ namespace MediaBrowser.Providers.TV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (titles.Any(t => string.Equals(t, comparableName, StringComparison.OrdinalIgnoreCase)))
|
|
||||||
{
|
|
||||||
var id = node.SelectSingleNode("./seriesid") ??
|
|
||||||
node.SelectSingleNode("./id");
|
|
||||||
|
|
||||||
if (id != null)
|
|
||||||
{
|
|
||||||
searchResult.Name = titles.FirstOrDefault();
|
|
||||||
searchResult.SetProviderId(MetadataProviders.Tvdb, id.InnerText);
|
|
||||||
searchResults.Add(searchResult);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var title in titles)
|
foreach (var title in titles)
|
||||||
{
|
{
|
||||||
|
if (string.Equals(title, comparableName, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var id = node.SelectSingleNode("./seriesid") ??
|
||||||
|
node.SelectSingleNode("./id");
|
||||||
|
|
||||||
|
if (id != null)
|
||||||
|
{
|
||||||
|
searchResult.Name = title;
|
||||||
|
searchResult.SetProviderId(MetadataProviders.Tvdb, id.InnerText);
|
||||||
|
searchResults.Add(searchResult);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
_logger.Info("TVDb Provider - " + title + " did not match " + comparableName);
|
_logger.Info("TVDb Provider - " + title + " did not match " + comparableName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Linq;
|
using MediaBrowser.Common;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Connect;
|
using MediaBrowser.Controller.Connect;
|
||||||
|
@ -22,14 +22,16 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||||
private readonly IConnectManager _connectManager;
|
private readonly IConnectManager _connectManager;
|
||||||
|
|
||||||
private readonly INetworkManager _networkManager;
|
private readonly INetworkManager _networkManager;
|
||||||
|
private readonly IApplicationHost _appHost;
|
||||||
|
|
||||||
public ConnectEntryPoint(IHttpClient httpClient, IApplicationPaths appPaths, ILogger logger, INetworkManager networkManager, IConnectManager connectManager)
|
public ConnectEntryPoint(IHttpClient httpClient, IApplicationPaths appPaths, ILogger logger, INetworkManager networkManager, IConnectManager connectManager, IApplicationHost appHost)
|
||||||
{
|
{
|
||||||
_httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
_appPaths = appPaths;
|
_appPaths = appPaths;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_networkManager = networkManager;
|
_networkManager = networkManager;
|
||||||
_connectManager = connectManager;
|
_connectManager = connectManager;
|
||||||
|
_appHost = appHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public void Run()
|
||||||
|
@ -49,7 +51,8 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||||
{
|
{
|
||||||
using (var stream = await _httpClient.Get(new HttpRequestOptions
|
using (var stream = await _httpClient.Get(new HttpRequestOptions
|
||||||
{
|
{
|
||||||
Url = ipLookupUrl
|
Url = ipLookupUrl,
|
||||||
|
UserAgent = "Emby Server/" + _appHost.ApplicationVersion
|
||||||
|
|
||||||
}).ConfigureAwait(false))
|
}).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("3.0.*")]
|
//[assembly: AssemblyVersion("3.0.*")]
|
||||||
//[assembly: AssemblyVersion("3.0.5621.4")]
|
[assembly: AssemblyVersion("3.0.5641.0")]
|
||||||
|
|
Loading…
Reference in New Issue