mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-18 08:06:35 +00:00
Merge branch 'master' into syncplay-enhanced
This commit is contained in:
@@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.AppBase
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string VirtualDataPath { get; } = "%AppDataPath%";
|
||||
public string VirtualDataPath => "%AppDataPath%";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the image cache path.
|
||||
|
||||
@@ -133,6 +133,33 @@ namespace Emby.Server.Implementations.AppBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manually pre-loads a factory so that it is available pre system initialisation.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Class to register.</typeparam>
|
||||
public virtual void RegisterConfiguration<T>()
|
||||
where T : IConfigurationFactory
|
||||
{
|
||||
IConfigurationFactory factory = Activator.CreateInstance<T>();
|
||||
|
||||
if (_configurationFactories == null)
|
||||
{
|
||||
_configurationFactories = new[] { factory };
|
||||
}
|
||||
else
|
||||
{
|
||||
var oldLen = _configurationFactories.Length;
|
||||
var arr = new IConfigurationFactory[oldLen + 1];
|
||||
_configurationFactories.CopyTo(arr, 0);
|
||||
arr[oldLen] = factory;
|
||||
_configurationFactories = arr;
|
||||
}
|
||||
|
||||
_configurationStores = _configurationFactories
|
||||
.SelectMany(i => i.GetConfigurations())
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds parts.
|
||||
/// </summary>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace Emby.Server.Implementations.AppBase
|
||||
@@ -35,7 +36,7 @@ namespace Emby.Server.Implementations.AppBase
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
configuration = Activator.CreateInstance(type);
|
||||
configuration = Activator.CreateInstance(type) ?? throw new ArgumentException($"Provided path ({type}) is not valid.", nameof(type));
|
||||
}
|
||||
|
||||
using var stream = new MemoryStream(buffer?.Length ?? 0);
|
||||
@@ -48,8 +49,9 @@ namespace Emby.Server.Implementations.AppBase
|
||||
// If the file didn't exist before, or if something has changed, re-save
|
||||
if (buffer == null || !newBytes.AsSpan(0, newBytesLen).SequenceEqual(buffer))
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
var directory = Path.GetDirectoryName(path) ?? throw new ArgumentException($"Provided path ({path}) is not valid.", nameof(path));
|
||||
|
||||
Directory.CreateDirectory(directory);
|
||||
// Save it after load in case we got new items
|
||||
using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read))
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@ using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
@@ -16,6 +15,7 @@ using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using Emby.Dlna;
|
||||
using Emby.Dlna.Main;
|
||||
using Emby.Dlna.Ssdp;
|
||||
@@ -30,7 +30,6 @@ using Emby.Server.Implementations.Cryptography;
|
||||
using Emby.Server.Implementations.Data;
|
||||
using Emby.Server.Implementations.Devices;
|
||||
using Emby.Server.Implementations.Dto;
|
||||
using Emby.Server.Implementations.HttpServer;
|
||||
using Emby.Server.Implementations.HttpServer.Security;
|
||||
using Emby.Server.Implementations.IO;
|
||||
using Emby.Server.Implementations.Library;
|
||||
@@ -48,6 +47,8 @@ using Emby.Server.Implementations.SyncPlay;
|
||||
using Emby.Server.Implementations.TV;
|
||||
using Emby.Server.Implementations.Updates;
|
||||
using Jellyfin.Api.Helpers;
|
||||
using Jellyfin.Networking.Configuration;
|
||||
using Jellyfin.Networking.Manager;
|
||||
using MediaBrowser.Common;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Events;
|
||||
@@ -96,10 +97,11 @@ using MediaBrowser.Model.System;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using MediaBrowser.Providers.Chapters;
|
||||
using MediaBrowser.Providers.Manager;
|
||||
using MediaBrowser.Providers.Plugins.TheTvdb;
|
||||
using MediaBrowser.Providers.Plugins.Tmdb;
|
||||
using MediaBrowser.Providers.Subtitles;
|
||||
using MediaBrowser.XbmcMetadata.Providers;
|
||||
using Microsoft.AspNetCore.DataProtection.Repositories;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -120,7 +122,6 @@ namespace Emby.Server.Implementations
|
||||
private static readonly string[] _relevantEnvVarPrefixes = { "JELLYFIN_", "DOTNET_", "ASPNETCORE_" };
|
||||
|
||||
private readonly IFileSystem _fileSystemManager;
|
||||
private readonly INetworkManager _networkManager;
|
||||
private readonly IXmlSerializer _xmlSerializer;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IStartupOptions _startupOptions;
|
||||
@@ -128,8 +129,6 @@ namespace Emby.Server.Implementations
|
||||
private IMediaEncoder _mediaEncoder;
|
||||
private ISessionManager _sessionManager;
|
||||
private IHttpClientFactory _httpClientFactory;
|
||||
private IWebSocketManager _webSocketManager;
|
||||
|
||||
private string[] _urlPrefixes;
|
||||
|
||||
/// <summary>
|
||||
@@ -163,6 +162,11 @@ namespace Emby.Server.Implementations
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="INetworkManager"/> singleton instance.
|
||||
/// </summary>
|
||||
public INetworkManager NetManager { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when [has pending restart changed].
|
||||
/// </summary>
|
||||
@@ -215,7 +219,7 @@ namespace Emby.Server.Implementations
|
||||
private readonly List<IDisposable> _disposableParts = new List<IDisposable>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the configuration manager.
|
||||
/// Gets or sets the configuration manager.
|
||||
/// </summary>
|
||||
/// <value>The configuration manager.</value>
|
||||
protected IConfigurationManager ConfigurationManager { get; set; }
|
||||
@@ -248,29 +252,30 @@ namespace Emby.Server.Implementations
|
||||
/// <param name="loggerFactory">Instance of the <see cref="ILoggerFactory"/> interface.</param>
|
||||
/// <param name="options">Instance of the <see cref="IStartupOptions"/> interface.</param>
|
||||
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
|
||||
/// <param name="networkManager">Instance of the <see cref="INetworkManager"/> interface.</param>
|
||||
/// <param name="serviceCollection">Instance of the <see cref="IServiceCollection"/> interface.</param>
|
||||
public ApplicationHost(
|
||||
IServerApplicationPaths applicationPaths,
|
||||
ILoggerFactory loggerFactory,
|
||||
IStartupOptions options,
|
||||
IFileSystem fileSystem,
|
||||
INetworkManager networkManager,
|
||||
IServiceCollection serviceCollection)
|
||||
{
|
||||
_xmlSerializer = new MyXmlSerializer();
|
||||
_jsonSerializer = new JsonSerializer();
|
||||
|
||||
ServiceCollection = serviceCollection;
|
||||
_jsonSerializer = new JsonSerializer();
|
||||
|
||||
_networkManager = networkManager;
|
||||
networkManager.LocalSubnetsFn = GetConfiguredLocalSubnets;
|
||||
ServiceCollection = serviceCollection;
|
||||
|
||||
ApplicationPaths = applicationPaths;
|
||||
LoggerFactory = loggerFactory;
|
||||
_fileSystemManager = fileSystem;
|
||||
|
||||
ConfigurationManager = new ServerConfigurationManager(ApplicationPaths, LoggerFactory, _xmlSerializer, _fileSystemManager);
|
||||
// Have to migrate settings here as migration subsystem not yet initialised.
|
||||
MigrateNetworkConfiguration();
|
||||
|
||||
// Have to pre-register the NetworkConfigurationFactory, as the configuration sub-system is not yet initialised.
|
||||
ConfigurationManager.RegisterConfiguration<NetworkConfigurationFactory>();
|
||||
NetManager = new NetworkManager((IServerConfigurationManager)ConfigurationManager, LoggerFactory.CreateLogger<NetworkManager>());
|
||||
|
||||
Logger = LoggerFactory.CreateLogger<ApplicationHost>();
|
||||
|
||||
@@ -284,8 +289,6 @@ namespace Emby.Server.Implementations
|
||||
|
||||
fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));
|
||||
|
||||
_networkManager.NetworkChanged += OnNetworkChanged;
|
||||
|
||||
CertificateInfo = new CertificateInfo
|
||||
{
|
||||
Path = ServerConfigurationManager.Configuration.CertificatePath,
|
||||
@@ -298,6 +301,22 @@ namespace Emby.Server.Implementations
|
||||
ApplicationUserAgent = Name.Replace(' ', '-') + "/" + ApplicationVersionString;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Temporary function to migration network settings out of system.xml and into network.xml.
|
||||
/// TODO: remove at the point when a fixed migration path has been decided upon.
|
||||
/// </summary>
|
||||
private void MigrateNetworkConfiguration()
|
||||
{
|
||||
string path = Path.Combine(ConfigurationManager.CommonApplicationPaths.ConfigurationDirectoryPath, "network.xml");
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
var networkSettings = new NetworkConfiguration();
|
||||
ClassMigrationHelper.CopyProperties(ServerConfigurationManager.Configuration, networkSettings);
|
||||
_xmlSerializer.SerializeToFile(networkSettings, path);
|
||||
Logger?.LogDebug("Successfully migrated network settings.");
|
||||
}
|
||||
}
|
||||
|
||||
public string ExpandVirtualPath(string path)
|
||||
{
|
||||
var appPaths = ApplicationPaths;
|
||||
@@ -314,16 +333,6 @@ namespace Emby.Server.Implementations
|
||||
.Replace(appPaths.InternalMetadataPath, appPaths.VirtualInternalMetadataPath, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private string[] GetConfiguredLocalSubnets()
|
||||
{
|
||||
return ServerConfigurationManager.Configuration.LocalNetworkSubnets;
|
||||
}
|
||||
|
||||
private void OnNetworkChanged(object sender, EventArgs e)
|
||||
{
|
||||
_validAddressResults.Clear();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Version ApplicationVersion { get; }
|
||||
|
||||
@@ -340,7 +349,7 @@ namespace Emby.Server.Implementations
|
||||
/// Gets the email address for use within a comment section of a user agent field.
|
||||
/// Presently used to provide contact information to MusicBrainz service.
|
||||
/// </summary>
|
||||
public string ApplicationUserAgentAddress { get; } = "team@jellyfin.org";
|
||||
public string ApplicationUserAgentAddress => "team@jellyfin.org";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current application name.
|
||||
@@ -404,7 +413,7 @@ namespace Emby.Server.Implementations
|
||||
/// <summary>
|
||||
/// Resolves this instance.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type</typeparam>
|
||||
/// <typeparam name="T">The type.</typeparam>
|
||||
/// <returns>``0.</returns>
|
||||
public T Resolve<T>() => ServiceProvider.GetService<T>();
|
||||
|
||||
@@ -490,34 +499,22 @@ namespace Emby.Server.Implementations
|
||||
/// <inheritdoc/>
|
||||
public void Init()
|
||||
{
|
||||
HttpPort = ServerConfigurationManager.Configuration.HttpServerPortNumber;
|
||||
HttpsPort = ServerConfigurationManager.Configuration.HttpsPortNumber;
|
||||
var networkConfiguration = ServerConfigurationManager.GetNetworkConfiguration();
|
||||
HttpPort = networkConfiguration.HttpServerPortNumber;
|
||||
HttpsPort = networkConfiguration.HttpsPortNumber;
|
||||
|
||||
// Safeguard against invalid configuration
|
||||
if (HttpPort == HttpsPort)
|
||||
{
|
||||
HttpPort = ServerConfiguration.DefaultHttpPort;
|
||||
HttpsPort = ServerConfiguration.DefaultHttpsPort;
|
||||
}
|
||||
|
||||
if (Plugins != null)
|
||||
{
|
||||
var pluginBuilder = new StringBuilder();
|
||||
|
||||
foreach (var plugin in Plugins)
|
||||
{
|
||||
pluginBuilder.Append(plugin.Name)
|
||||
.Append(' ')
|
||||
.Append(plugin.Version)
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
Logger.LogInformation("Plugins: {Plugins}", pluginBuilder.ToString());
|
||||
HttpPort = NetworkConfiguration.DefaultHttpPort;
|
||||
HttpsPort = NetworkConfiguration.DefaultHttpsPort;
|
||||
}
|
||||
|
||||
DiscoverTypes();
|
||||
|
||||
RegisterServices();
|
||||
|
||||
RegisterPluginServices();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -537,10 +534,9 @@ namespace Emby.Server.Implementations
|
||||
ServiceCollection.AddSingleton<IJsonSerializer, JsonSerializer>();
|
||||
|
||||
ServiceCollection.AddSingleton(_fileSystemManager);
|
||||
ServiceCollection.AddSingleton<TvdbClientManager>();
|
||||
ServiceCollection.AddSingleton<TmdbClientManager>();
|
||||
|
||||
ServiceCollection.AddSingleton(_networkManager);
|
||||
ServiceCollection.AddSingleton(NetManager);
|
||||
|
||||
ServiceCollection.AddSingleton<IIsoManager, IsoManager>();
|
||||
|
||||
@@ -644,7 +640,6 @@ namespace Emby.Server.Implementations
|
||||
|
||||
ServiceCollection.AddSingleton<ISubtitleEncoder, MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder>();
|
||||
|
||||
ServiceCollection.AddSingleton<IResourceFileManager, ResourceFileManager>();
|
||||
ServiceCollection.AddSingleton<EncodingHelper>();
|
||||
|
||||
ServiceCollection.AddSingleton<IAttachmentExtractor, MediaBrowser.MediaEncoding.Attachments.AttachmentExtractor>();
|
||||
@@ -667,7 +662,6 @@ namespace Emby.Server.Implementations
|
||||
_mediaEncoder = Resolve<IMediaEncoder>();
|
||||
_sessionManager = Resolve<ISessionManager>();
|
||||
_httpClientFactory = Resolve<IHttpClientFactory>();
|
||||
_webSocketManager = Resolve<IWebSocketManager>();
|
||||
|
||||
((AuthenticationRepository)Resolve<IAuthenticationRepository>()).Initialize();
|
||||
|
||||
@@ -783,12 +777,25 @@ namespace Emby.Server.Implementations
|
||||
|
||||
ConfigurationManager.AddParts(GetExports<IConfigurationFactory>());
|
||||
_plugins = GetExports<IPlugin>()
|
||||
.Select(LoadPlugin)
|
||||
.Where(i => i != null)
|
||||
.ToArray();
|
||||
|
||||
if (Plugins != null)
|
||||
{
|
||||
var pluginBuilder = new StringBuilder();
|
||||
|
||||
foreach (var plugin in Plugins)
|
||||
{
|
||||
pluginBuilder.Append(plugin.Name)
|
||||
.Append(' ')
|
||||
.Append(plugin.Version)
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
Logger.LogInformation("Plugins: {Plugins}", pluginBuilder.ToString());
|
||||
}
|
||||
|
||||
_urlPrefixes = GetUrlPrefixes().ToArray();
|
||||
_webSocketManager.Init(GetExports<IWebSocketListener>());
|
||||
|
||||
Resolve<ILibraryManager>().AddParts(
|
||||
GetExports<IResolverIgnoreRule>(),
|
||||
@@ -817,21 +824,6 @@ namespace Emby.Server.Implementations
|
||||
Resolve<IIsoManager>().AddParts(GetExports<IIsoMounter>());
|
||||
}
|
||||
|
||||
private IPlugin LoadPlugin(IPlugin plugin)
|
||||
{
|
||||
try
|
||||
{
|
||||
plugin.RegisterServices(ServiceCollection);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex, "Error loading plugin {PluginName}", plugin.GetType().FullName);
|
||||
return null;
|
||||
}
|
||||
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Discovers the types.
|
||||
/// </summary>
|
||||
@@ -842,6 +834,22 @@ namespace Emby.Server.Implementations
|
||||
_allConcreteTypes = GetTypes(GetComposablePartAssemblies()).ToArray();
|
||||
}
|
||||
|
||||
private void RegisterPluginServices()
|
||||
{
|
||||
foreach (var pluginServiceRegistrator in GetExportTypes<IPluginServiceRegistrator>())
|
||||
{
|
||||
try
|
||||
{
|
||||
var instance = (IPluginServiceRegistrator)Activator.CreateInstance(pluginServiceRegistrator);
|
||||
instance.RegisterServices(ServiceCollection);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex, "Error registering plugin services from {Assembly}.", pluginServiceRegistrator.Assembly);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<Type> GetTypes(IEnumerable<Assembly> assemblies)
|
||||
{
|
||||
foreach (var ass in assemblies)
|
||||
@@ -908,9 +916,10 @@ namespace Emby.Server.Implementations
|
||||
// Don't do anything if these haven't been set yet
|
||||
if (HttpPort != 0 && HttpsPort != 0)
|
||||
{
|
||||
var networkConfiguration = ServerConfigurationManager.GetNetworkConfiguration();
|
||||
// Need to restart if ports have changed
|
||||
if (ServerConfigurationManager.Configuration.HttpServerPortNumber != HttpPort ||
|
||||
ServerConfigurationManager.Configuration.HttpsPortNumber != HttpsPort)
|
||||
if (networkConfiguration.HttpServerPortNumber != HttpPort ||
|
||||
networkConfiguration.HttpsPortNumber != HttpsPort)
|
||||
{
|
||||
if (ServerConfigurationManager.Configuration.IsPortAuthorized)
|
||||
{
|
||||
@@ -996,80 +1005,60 @@ namespace Emby.Server.Implementations
|
||||
|
||||
protected abstract void RestartInternal();
|
||||
|
||||
/// <summary>
|
||||
/// Comparison function used in <see cref="GetPlugins" />.
|
||||
/// </summary>
|
||||
/// <param name="a">Item to compare.</param>
|
||||
/// <param name="b">Item to compare with.</param>
|
||||
/// <returns>Boolean result of the operation.</returns>
|
||||
private static int VersionCompare(
|
||||
(Version PluginVersion, string Name, string Path) a,
|
||||
(Version PluginVersion, string Name, string Path) b)
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<LocalPlugin> GetLocalPlugins(string path, bool cleanup = true)
|
||||
{
|
||||
int compare = string.Compare(a.Name, b.Name, true, CultureInfo.InvariantCulture);
|
||||
|
||||
if (compare == 0)
|
||||
var minimumVersion = new Version(0, 0, 0, 1);
|
||||
var versions = new List<LocalPlugin>();
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
return a.PluginVersion.CompareTo(b.PluginVersion);
|
||||
// Plugin path doesn't exist, don't try to enumerate subfolders.
|
||||
return Enumerable.Empty<LocalPlugin>();
|
||||
}
|
||||
|
||||
return compare;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of plugins to install.
|
||||
/// </summary>
|
||||
/// <param name="path">Path to check.</param>
|
||||
/// <param name="cleanup">True if an attempt should be made to delete old plugs.</param>
|
||||
/// <returns>Enumerable list of dlls to load.</returns>
|
||||
private IEnumerable<string> GetPlugins(string path, bool cleanup = true)
|
||||
{
|
||||
var dllList = new List<string>();
|
||||
var versions = new List<(Version PluginVersion, string Name, string Path)>();
|
||||
var directories = Directory.EnumerateDirectories(path, "*.*", SearchOption.TopDirectoryOnly);
|
||||
string metafile;
|
||||
|
||||
foreach (var dir in directories)
|
||||
{
|
||||
try
|
||||
{
|
||||
metafile = Path.Combine(dir, "meta.json");
|
||||
var metafile = Path.Combine(dir, "meta.json");
|
||||
if (File.Exists(metafile))
|
||||
{
|
||||
var manifest = _jsonSerializer.DeserializeFromFile<PluginManifest>(metafile);
|
||||
|
||||
if (!Version.TryParse(manifest.TargetAbi, out var targetAbi))
|
||||
{
|
||||
targetAbi = new Version(0, 0, 0, 1);
|
||||
targetAbi = minimumVersion;
|
||||
}
|
||||
|
||||
if (!Version.TryParse(manifest.Version, out var version))
|
||||
{
|
||||
version = new Version(0, 0, 0, 1);
|
||||
version = minimumVersion;
|
||||
}
|
||||
|
||||
if (ApplicationVersion >= targetAbi)
|
||||
{
|
||||
// Only load Plugins if the plugin is built for this version or below.
|
||||
versions.Add((version, manifest.Name, dir));
|
||||
versions.Add(new LocalPlugin(manifest.Guid, manifest.Name, version, dir));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// No metafile, so lets see if the folder is versioned.
|
||||
metafile = dir.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries)[^1];
|
||||
|
||||
metafile = dir.Split(Path.DirectorySeparatorChar, StringSplitOptions.RemoveEmptyEntries)[^1];
|
||||
|
||||
int versionIndex = dir.LastIndexOf('_');
|
||||
if (versionIndex != -1 && Version.TryParse(dir.Substring(versionIndex + 1), out Version ver))
|
||||
if (versionIndex != -1 && Version.TryParse(dir.Substring(versionIndex + 1), out Version parsedVersion))
|
||||
{
|
||||
// Versioned folder.
|
||||
versions.Add((ver, metafile, dir));
|
||||
versions.Add(new LocalPlugin(Guid.Empty, metafile, parsedVersion, dir));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Un-versioned folder - Add it under the path name and version 0.0.0.1.
|
||||
versions.Add((new Version(0, 0, 0, 1), metafile, dir));
|
||||
}
|
||||
// Un-versioned folder - Add it under the path name and version 0.0.0.1.
|
||||
versions.Add(new LocalPlugin(Guid.Empty, metafile, minimumVersion, dir));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
@@ -1079,14 +1068,14 @@ namespace Emby.Server.Implementations
|
||||
}
|
||||
|
||||
string lastName = string.Empty;
|
||||
versions.Sort(VersionCompare);
|
||||
versions.Sort(LocalPlugin.Compare);
|
||||
// Traverse backwards through the list.
|
||||
// The first item will be the latest version.
|
||||
for (int x = versions.Count - 1; x >= 0; x--)
|
||||
{
|
||||
if (!string.Equals(lastName, versions[x].Name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
dllList.AddRange(Directory.EnumerateFiles(versions[x].Path, "*.dll", SearchOption.AllDirectories));
|
||||
versions[x].DllFiles.AddRange(Directory.EnumerateFiles(versions[x].Path, "*.dll", SearchOption.AllDirectories));
|
||||
lastName = versions[x].Name;
|
||||
continue;
|
||||
}
|
||||
@@ -1103,10 +1092,12 @@ namespace Emby.Server.Implementations
|
||||
{
|
||||
Logger.LogWarning(e, "Unable to delete {Path}", versions[x].Path);
|
||||
}
|
||||
|
||||
versions.RemoveAt(x);
|
||||
}
|
||||
}
|
||||
|
||||
return dllList;
|
||||
return versions;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1117,21 +1108,24 @@ namespace Emby.Server.Implementations
|
||||
{
|
||||
if (Directory.Exists(ApplicationPaths.PluginsPath))
|
||||
{
|
||||
foreach (var file in GetPlugins(ApplicationPaths.PluginsPath))
|
||||
foreach (var plugin in GetLocalPlugins(ApplicationPaths.PluginsPath))
|
||||
{
|
||||
Assembly plugAss;
|
||||
try
|
||||
foreach (var file in plugin.DllFiles)
|
||||
{
|
||||
plugAss = Assembly.LoadFrom(file);
|
||||
}
|
||||
catch (FileLoadException ex)
|
||||
{
|
||||
Logger.LogError(ex, "Failed to load assembly {Path}", file);
|
||||
continue;
|
||||
}
|
||||
Assembly plugAss;
|
||||
try
|
||||
{
|
||||
plugAss = Assembly.LoadFrom(file);
|
||||
}
|
||||
catch (FileLoadException ex)
|
||||
{
|
||||
Logger.LogError(ex, "Failed to load assembly {Path}", file);
|
||||
continue;
|
||||
}
|
||||
|
||||
Logger.LogInformation("Loaded assembly {Assembly} from {Path}", plugAss.FullName, file);
|
||||
yield return plugAss;
|
||||
Logger.LogInformation("Loaded assembly {Assembly} from {Path}", plugAss.FullName, file);
|
||||
yield return plugAss;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1168,6 +1162,9 @@ namespace Emby.Server.Implementations
|
||||
// Xbmc
|
||||
yield return typeof(ArtistNfoProvider).Assembly;
|
||||
|
||||
// Network
|
||||
yield return typeof(NetworkManager).Assembly;
|
||||
|
||||
foreach (var i in GetAssembliesWithPartsInternal())
|
||||
{
|
||||
yield return i;
|
||||
@@ -1179,13 +1176,10 @@ namespace Emby.Server.Implementations
|
||||
/// <summary>
|
||||
/// Gets the system status.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <param name="source">Where this request originated.</param>
|
||||
/// <returns>SystemInfo.</returns>
|
||||
public async Task<SystemInfo> GetSystemInfo(CancellationToken cancellationToken)
|
||||
public SystemInfo GetSystemInfo(IPAddress source)
|
||||
{
|
||||
var localAddress = await GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
|
||||
var transcodingTempPath = ConfigurationManager.GetTranscodePath();
|
||||
|
||||
return new SystemInfo
|
||||
{
|
||||
HasPendingRestart = HasPendingRestart,
|
||||
@@ -1205,9 +1199,9 @@ namespace Emby.Server.Implementations
|
||||
CanSelfRestart = CanSelfRestart,
|
||||
CanLaunchWebBrowser = CanLaunchWebBrowser,
|
||||
HasUpdateAvailable = HasUpdateAvailable,
|
||||
TranscodingTempPath = transcodingTempPath,
|
||||
TranscodingTempPath = ConfigurationManager.GetTranscodePath(),
|
||||
ServerName = FriendlyName,
|
||||
LocalAddress = localAddress,
|
||||
LocalAddress = GetSmartApiUrl(source),
|
||||
SupportsLibraryMonitor = true,
|
||||
EncoderLocation = _mediaEncoder.EncoderLocation,
|
||||
SystemArchitecture = RuntimeInformation.OSArchitecture,
|
||||
@@ -1216,14 +1210,12 @@ namespace Emby.Server.Implementations
|
||||
}
|
||||
|
||||
public IEnumerable<WakeOnLanInfo> GetWakeOnLanInfo()
|
||||
=> _networkManager.GetMacAddresses()
|
||||
=> NetManager.GetMacAddresses()
|
||||
.Select(i => new WakeOnLanInfo(i))
|
||||
.ToList();
|
||||
|
||||
public async Task<PublicSystemInfo> GetPublicSystemInfo(CancellationToken cancellationToken)
|
||||
public PublicSystemInfo GetPublicSystemInfo(IPAddress source)
|
||||
{
|
||||
var localAddress = await GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return new PublicSystemInfo
|
||||
{
|
||||
Version = ApplicationVersionString,
|
||||
@@ -1231,195 +1223,100 @@ namespace Emby.Server.Implementations
|
||||
Id = SystemId,
|
||||
OperatingSystem = OperatingSystem.Id.ToString(),
|
||||
ServerName = FriendlyName,
|
||||
LocalAddress = localAddress,
|
||||
LocalAddress = GetSmartApiUrl(source),
|
||||
StartupWizardCompleted = ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted
|
||||
};
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool ListenWithHttps => Certificate != null && ServerConfigurationManager.Configuration.EnableHttps;
|
||||
public bool ListenWithHttps => Certificate != null && ServerConfigurationManager.GetNetworkConfiguration().EnableHttps;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<string> GetLocalApiUrl(CancellationToken cancellationToken)
|
||||
public string GetSmartApiUrl(IPAddress ipAddress, int? port = null)
|
||||
{
|
||||
try
|
||||
// Published server ends with a /
|
||||
if (_startupOptions.PublishedServerUrl != null)
|
||||
{
|
||||
// Return the first matched address, if found, or the first known local address
|
||||
var addresses = await GetLocalIpAddressesInternal(false, 1, cancellationToken).ConfigureAwait(false);
|
||||
if (addresses.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return GetLocalApiUrl(addresses[0]);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex, "Error getting local Ip address information");
|
||||
// Published server ends with a '/', so we need to remove it.
|
||||
return _startupOptions.PublishedServerUrl.ToString().Trim('/');
|
||||
}
|
||||
|
||||
return null;
|
||||
string smart = NetManager.GetBindInterface(ipAddress, out port);
|
||||
// If the smartAPI doesn't start with http then treat it as a host or ip.
|
||||
if (smart.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return smart.Trim('/');
|
||||
}
|
||||
|
||||
return GetLocalApiUrl(smart.Trim('/'), null, port);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the scope id from IPv6 addresses.
|
||||
/// </summary>
|
||||
/// <param name="address">The IPv6 address.</param>
|
||||
/// <returns>The IPv6 address without the scope id.</returns>
|
||||
private ReadOnlySpan<char> RemoveScopeId(ReadOnlySpan<char> address)
|
||||
/// <inheritdoc/>
|
||||
public string GetSmartApiUrl(HttpRequest request, int? port = null)
|
||||
{
|
||||
var index = address.IndexOf('%');
|
||||
if (index == -1)
|
||||
// Published server ends with a /
|
||||
if (_startupOptions.PublishedServerUrl != null)
|
||||
{
|
||||
return address;
|
||||
// Published server ends with a '/', so we need to remove it.
|
||||
return _startupOptions.PublishedServerUrl.ToString().Trim('/');
|
||||
}
|
||||
|
||||
return address.Slice(0, index);
|
||||
string smart = NetManager.GetBindInterface(request, out port);
|
||||
// If the smartAPI doesn't start with http then treat it as a host or ip.
|
||||
if (smart.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return smart.Trim('/');
|
||||
}
|
||||
|
||||
return GetLocalApiUrl(smart.Trim('/'), request.Scheme, port);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string GetLocalApiUrl(IPAddress ipAddress)
|
||||
/// <inheritdoc/>
|
||||
public string GetSmartApiUrl(string hostname, int? port = null)
|
||||
{
|
||||
if (ipAddress.AddressFamily == AddressFamily.InterNetworkV6)
|
||||
// Published server ends with a /
|
||||
if (_startupOptions.PublishedServerUrl != null)
|
||||
{
|
||||
var str = RemoveScopeId(ipAddress.ToString());
|
||||
Span<char> span = new char[str.Length + 2];
|
||||
span[0] = '[';
|
||||
str.CopyTo(span.Slice(1));
|
||||
span[^1] = ']';
|
||||
|
||||
return GetLocalApiUrl(span);
|
||||
// Published server ends with a '/', so we need to remove it.
|
||||
return _startupOptions.PublishedServerUrl.ToString().Trim('/');
|
||||
}
|
||||
|
||||
return GetLocalApiUrl(ipAddress.ToString());
|
||||
string smart = NetManager.GetBindInterface(hostname, out port);
|
||||
|
||||
// If the smartAPI doesn't start with http then treat it as a host or ip.
|
||||
if (smart.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return smart.Trim('/');
|
||||
}
|
||||
|
||||
return GetLocalApiUrl(smart.Trim('/'), null, port);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string GetLoopbackHttpApiUrl()
|
||||
{
|
||||
if (NetManager.IsIP6Enabled)
|
||||
{
|
||||
return GetLocalApiUrl("::1", Uri.UriSchemeHttp, HttpPort);
|
||||
}
|
||||
|
||||
return GetLocalApiUrl("127.0.0.1", Uri.UriSchemeHttp, HttpPort);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string GetLocalApiUrl(ReadOnlySpan<char> host, string scheme = null, int? port = null)
|
||||
public string GetLocalApiUrl(string host, string scheme = null, int? port = null)
|
||||
{
|
||||
// NOTE: If no BaseUrl is set then UriBuilder appends a trailing slash, but if there is no BaseUrl it does
|
||||
// not. For consistency, always trim the trailing slash.
|
||||
return new UriBuilder
|
||||
{
|
||||
Scheme = scheme ?? (ListenWithHttps ? Uri.UriSchemeHttps : Uri.UriSchemeHttp),
|
||||
Host = host.ToString(),
|
||||
Host = host,
|
||||
Port = port ?? (ListenWithHttps ? HttpsPort : HttpPort),
|
||||
Path = ServerConfigurationManager.Configuration.BaseUrl
|
||||
Path = ServerConfigurationManager.GetNetworkConfiguration().BaseUrl
|
||||
}.ToString().TrimEnd('/');
|
||||
}
|
||||
|
||||
public Task<List<IPAddress>> GetLocalIpAddresses(CancellationToken cancellationToken)
|
||||
{
|
||||
return GetLocalIpAddressesInternal(true, 0, cancellationToken);
|
||||
}
|
||||
|
||||
private async Task<List<IPAddress>> GetLocalIpAddressesInternal(bool allowLoopback, int limit, CancellationToken cancellationToken)
|
||||
{
|
||||
var addresses = ServerConfigurationManager
|
||||
.Configuration
|
||||
.LocalNetworkAddresses
|
||||
.Select(x => NormalizeConfiguredLocalAddress(x))
|
||||
.Where(i => i != null)
|
||||
.ToList();
|
||||
|
||||
if (addresses.Count == 0)
|
||||
{
|
||||
addresses.AddRange(_networkManager.GetLocalIpAddresses());
|
||||
}
|
||||
|
||||
var resultList = new List<IPAddress>();
|
||||
|
||||
foreach (var address in addresses)
|
||||
{
|
||||
if (!allowLoopback)
|
||||
{
|
||||
if (address.Equals(IPAddress.Loopback) || address.Equals(IPAddress.IPv6Loopback))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (await IsLocalIpAddressValidAsync(address, cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
resultList.Add(address);
|
||||
|
||||
if (limit > 0 && resultList.Count >= limit)
|
||||
{
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
public IPAddress NormalizeConfiguredLocalAddress(ReadOnlySpan<char> address)
|
||||
{
|
||||
var index = address.Trim('/').IndexOf('/');
|
||||
if (index != -1)
|
||||
{
|
||||
address = address.Slice(index + 1);
|
||||
}
|
||||
|
||||
if (IPAddress.TryParse(address.Trim('/'), out IPAddress result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private readonly ConcurrentDictionary<string, bool> _validAddressResults = new ConcurrentDictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
private async Task<bool> IsLocalIpAddressValidAsync(IPAddress address, CancellationToken cancellationToken)
|
||||
{
|
||||
if (address.Equals(IPAddress.Loopback)
|
||||
|| address.Equals(IPAddress.IPv6Loopback))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var apiUrl = GetLocalApiUrl(address) + "/system/ping";
|
||||
|
||||
if (_validAddressResults.TryGetValue(apiUrl, out var cachedResult))
|
||||
{
|
||||
return cachedResult;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using var request = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||
using var response = await _httpClientFactory.CreateClient(NamedClient.Default)
|
||||
.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
var result = await System.Text.Json.JsonSerializer.DeserializeAsync<string>(stream, JsonDefaults.GetOptions(), cancellationToken).ConfigureAwait(false);
|
||||
var valid = string.Equals(Name, result, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
_validAddressResults.AddOrUpdate(apiUrl, valid, (k, v) => valid);
|
||||
Logger.LogDebug("Ping test result to {0}. Success: {1}", apiUrl, valid);
|
||||
return valid;
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
Logger.LogDebug("Ping test result to {0}. Success: {1}", apiUrl, "Cancelled");
|
||||
throw;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogDebug(ex, "Ping test result to {0}. Success: {1}", apiUrl, false);
|
||||
|
||||
_validAddressResults.AddOrUpdate(apiUrl, false, (k, v) => false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public string FriendlyName =>
|
||||
string.IsNullOrEmpty(ServerConfigurationManager.Configuration.ServerName)
|
||||
? Environment.MachineName
|
||||
|
||||
@@ -250,21 +250,16 @@ namespace Emby.Server.Implementations.Channels
|
||||
var all = channels;
|
||||
var totalCount = all.Count;
|
||||
|
||||
if (query.StartIndex.HasValue)
|
||||
if (query.StartIndex.HasValue || query.Limit.HasValue)
|
||||
{
|
||||
all = all.Skip(query.StartIndex.Value).ToList();
|
||||
int startIndex = query.StartIndex ?? 0;
|
||||
int count = query.Limit == null ? totalCount - startIndex : Math.Min(query.Limit.Value, totalCount - startIndex);
|
||||
all = all.GetRange(startIndex, count);
|
||||
}
|
||||
|
||||
if (query.Limit.HasValue)
|
||||
{
|
||||
all = all.Take(query.Limit.Value).ToList();
|
||||
}
|
||||
|
||||
var returnItems = all.ToArray();
|
||||
|
||||
if (query.RefreshLatestChannelItems)
|
||||
{
|
||||
foreach (var item in returnItems)
|
||||
foreach (var item in all)
|
||||
{
|
||||
RefreshLatestChannelItems(GetChannelProvider(item), CancellationToken.None).GetAwaiter().GetResult();
|
||||
}
|
||||
@@ -272,7 +267,7 @@ namespace Emby.Server.Implementations.Channels
|
||||
|
||||
return new QueryResult<Channel>
|
||||
{
|
||||
Items = returnItems,
|
||||
Items = all,
|
||||
TotalRecordCount = totalCount
|
||||
};
|
||||
}
|
||||
@@ -543,7 +538,7 @@ namespace Emby.Server.Implementations.Channels
|
||||
return _libraryManager.GetItemIds(
|
||||
new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(Channel).Name },
|
||||
IncludeItemTypes = new[] { nameof(Channel) },
|
||||
OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) }
|
||||
}).Select(i => GetChannelFeatures(i.ToString("N", CultureInfo.InvariantCulture))).ToArray();
|
||||
}
|
||||
@@ -639,7 +634,7 @@ namespace Emby.Server.Implementations.Channels
|
||||
{
|
||||
var channels = GetAllChannels().Where(i => i is ISupportsLatestMedia).ToArray();
|
||||
|
||||
if (query.ChannelIds.Length > 0)
|
||||
if (query.ChannelIds.Count > 0)
|
||||
{
|
||||
// Avoid implicitly captured closure
|
||||
var ids = query.ChannelIds;
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Emby.Server.Implementations.Channels
|
||||
|
||||
var uninstalledChannels = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(Channel).Name },
|
||||
IncludeItemTypes = new[] { nameof(Channel) },
|
||||
ExcludeItemIds = installedChannelIds.ToArray()
|
||||
});
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Model.Cryptography;
|
||||
using static MediaBrowser.Common.Cryptography.Constants;
|
||||
|
||||
@@ -80,7 +81,7 @@ namespace Emby.Server.Implementations.Cryptography
|
||||
throw new CryptographicException($"Requested hash method is not supported: {hashMethod}");
|
||||
}
|
||||
|
||||
using var h = HashAlgorithm.Create(hashMethod);
|
||||
using var h = HashAlgorithm.Create(hashMethod) ?? throw new ResourceNotFoundException($"Unknown hash method: {hashMethod}.");
|
||||
if (salt.Length == 0)
|
||||
{
|
||||
return h.ComputeHash(bytes);
|
||||
|
||||
@@ -107,20 +107,6 @@ namespace Emby.Server.Implementations.Data
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void Attach(SQLiteDatabaseConnection db, string path, string alias)
|
||||
{
|
||||
var commandText = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"attach @path as {0};",
|
||||
alias);
|
||||
|
||||
using (var statement = db.PrepareStatement(commandText))
|
||||
{
|
||||
statement.TryBind("@path", path);
|
||||
statement.MoveNext();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsDBNull(this IReadOnlyList<IResultSetValue> result, int index)
|
||||
{
|
||||
return result[index].SQLiteType == SQLiteType.Null;
|
||||
|
||||
@@ -1007,7 +1007,7 @@ namespace Emby.Server.Implementations.Data
|
||||
return;
|
||||
}
|
||||
|
||||
var parts = value.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var parts = value.Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
foreach (var part in parts)
|
||||
{
|
||||
@@ -1057,7 +1057,7 @@ namespace Emby.Server.Implementations.Data
|
||||
return;
|
||||
}
|
||||
|
||||
var parts = value.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var parts = value.Split('|' , StringSplitOptions.RemoveEmptyEntries);
|
||||
var list = new List<ItemImageInfo>();
|
||||
foreach (var part in parts)
|
||||
{
|
||||
@@ -1096,7 +1096,7 @@ namespace Emby.Server.Implementations.Data
|
||||
|
||||
public ItemImageInfo ItemImageInfoFromValueString(string value)
|
||||
{
|
||||
var parts = value.Split(new[] { '*' }, StringSplitOptions.None);
|
||||
var parts = value.Split('*', StringSplitOptions.None);
|
||||
|
||||
if (parts.Length < 3)
|
||||
{
|
||||
@@ -1532,7 +1532,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
item.Genres = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
item.Genres = reader.GetString(index).Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
index++;
|
||||
@@ -1593,7 +1593,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
IEnumerable<MetadataField> GetLockedFields(string s)
|
||||
{
|
||||
foreach (var i in s.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
foreach (var i in s.Split('|', StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
if (Enum.TryParse(i, true, out MetadataField parsedValue))
|
||||
{
|
||||
@@ -1612,7 +1612,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
item.Studios = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
item.Studios = reader.GetString(index).Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
index++;
|
||||
@@ -1622,7 +1622,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
item.Tags = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
item.Tags = reader.GetString(index).Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
index++;
|
||||
@@ -1636,7 +1636,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
IEnumerable<TrailerType> GetTrailerTypes(string s)
|
||||
{
|
||||
foreach (var i in s.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
foreach (var i in s.Split('|', StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
if (Enum.TryParse(i, true, out TrailerType parsedValue))
|
||||
{
|
||||
@@ -1811,7 +1811,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
item.ProductionLocations = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).ToArray();
|
||||
item.ProductionLocations = reader.GetString(index).Split('|', StringSplitOptions.RemoveEmptyEntries).ToArray();
|
||||
}
|
||||
|
||||
index++;
|
||||
@@ -1848,14 +1848,14 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
if (item is IHasArtist hasArtists && !reader.IsDBNull(index))
|
||||
{
|
||||
hasArtists.Artists = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
hasArtists.Artists = reader.GetString(index).Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
if (item is IHasAlbumArtist hasAlbumArtists && !reader.IsDBNull(index))
|
||||
{
|
||||
hasAlbumArtists.AlbumArtists = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
hasAlbumArtists.AlbumArtists = reader.GetString(index).Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
index++;
|
||||
@@ -2403,11 +2403,11 @@ namespace Emby.Server.Implementations.Data
|
||||
|
||||
if (string.IsNullOrEmpty(item.OfficialRating))
|
||||
{
|
||||
builder.Append("((OfficialRating is null) * 10)");
|
||||
builder.Append("(OfficialRating is null * 10)");
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.Append("((OfficialRating=@ItemOfficialRating) * 10)");
|
||||
builder.Append("(OfficialRating=@ItemOfficialRating * 10)");
|
||||
}
|
||||
|
||||
if (item.ProductionYear.HasValue)
|
||||
@@ -2416,8 +2416,26 @@ namespace Emby.Server.Implementations.Data
|
||||
builder.Append("+(Select Case When Abs(COALESCE(ProductionYear, 0) - @ItemProductionYear) < 5 Then 5 Else 0 End )");
|
||||
}
|
||||
|
||||
//// genres, tags
|
||||
builder.Append("+ ((Select count(CleanValue) from ItemValues where ItemId=Guid and CleanValue in (select CleanValue from itemvalues where ItemId=@SimilarItemId)) * 10)");
|
||||
// genres, tags, studios, person, year?
|
||||
builder.Append("+ (Select count(1) * 10 from ItemValues where ItemId=Guid and CleanValue in (select CleanValue from itemvalues where ItemId=@SimilarItemId))");
|
||||
|
||||
if (item is MusicArtist)
|
||||
{
|
||||
// Match albums where the artist is AlbumArtist against other albums.
|
||||
// It is assumed that similar albums => similar artists.
|
||||
builder.Append(
|
||||
@"+ (WITH artistValues AS (
|
||||
SELECT DISTINCT albumValues.CleanValue
|
||||
FROM ItemValues albumValues
|
||||
INNER JOIN ItemValues artistAlbums ON albumValues.ItemId = artistAlbums.ItemId
|
||||
INNER JOIN TypedBaseItems artistItem ON artistAlbums.CleanValue = artistItem.CleanName AND artistAlbums.TYPE = 1 AND artistItem.Guid = @SimilarItemId
|
||||
), similarArtist AS (
|
||||
SELECT albumValues.ItemId
|
||||
FROM ItemValues albumValues
|
||||
INNER JOIN ItemValues artistAlbums ON albumValues.ItemId = artistAlbums.ItemId
|
||||
INNER JOIN TypedBaseItems artistItem ON artistAlbums.CleanValue = artistItem.CleanName AND artistAlbums.TYPE = 1 AND artistItem.Guid = A.Guid
|
||||
) SELECT COUNT(DISTINCT(CleanValue)) * 10 FROM ItemValues WHERE ItemId IN (SELECT ItemId FROM similarArtist) AND CleanValue IN (SELECT CleanValue FROM artistValues))");
|
||||
}
|
||||
|
||||
builder.Append(") as SimilarityScore");
|
||||
|
||||
@@ -3593,12 +3611,12 @@ namespace Emby.Server.Implementations.Data
|
||||
whereClauses.Add($"type in ({inClause})");
|
||||
}
|
||||
|
||||
if (query.ChannelIds.Length == 1)
|
||||
if (query.ChannelIds.Count == 1)
|
||||
{
|
||||
whereClauses.Add("ChannelId=@ChannelId");
|
||||
statement?.TryBind("@ChannelId", query.ChannelIds[0].ToString("N", CultureInfo.InvariantCulture));
|
||||
}
|
||||
else if (query.ChannelIds.Length > 1)
|
||||
else if (query.ChannelIds.Count > 1)
|
||||
{
|
||||
var inClause = string.Join(",", query.ChannelIds.Select(i => "'" + i.ToString("N", CultureInfo.InvariantCulture) + "'"));
|
||||
whereClauses.Add($"ChannelId in ({inClause})");
|
||||
@@ -3914,7 +3932,7 @@ namespace Emby.Server.Implementations.Data
|
||||
if (query.IsPlayed.HasValue)
|
||||
{
|
||||
// We should probably figure this out for all folders, but for right now, this is the only place where we need it
|
||||
if (query.IncludeItemTypes.Length == 1 && string.Equals(query.IncludeItemTypes[0], typeof(Series).Name, StringComparison.OrdinalIgnoreCase))
|
||||
if (query.IncludeItemTypes.Length == 1 && string.Equals(query.IncludeItemTypes[0], nameof(Series), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (query.IsPlayed.Value)
|
||||
{
|
||||
@@ -4058,7 +4076,7 @@ namespace Emby.Server.Implementations.Data
|
||||
whereClauses.Add(clause);
|
||||
}
|
||||
|
||||
if (query.GenreIds.Length > 0)
|
||||
if (query.GenreIds.Count > 0)
|
||||
{
|
||||
var clauses = new List<string>();
|
||||
var index = 0;
|
||||
@@ -4079,7 +4097,7 @@ namespace Emby.Server.Implementations.Data
|
||||
whereClauses.Add(clause);
|
||||
}
|
||||
|
||||
if (query.Genres.Length > 0)
|
||||
if (query.Genres.Count > 0)
|
||||
{
|
||||
var clauses = new List<string>();
|
||||
var index = 0;
|
||||
@@ -4755,29 +4773,29 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
var list = new List<string>();
|
||||
|
||||
if (IsTypeInQuery(typeof(Person).Name, query))
|
||||
if (IsTypeInQuery(nameof(Person), query))
|
||||
{
|
||||
list.Add(typeof(Person).Name);
|
||||
list.Add(nameof(Person));
|
||||
}
|
||||
|
||||
if (IsTypeInQuery(typeof(Genre).Name, query))
|
||||
if (IsTypeInQuery(nameof(Genre), query))
|
||||
{
|
||||
list.Add(typeof(Genre).Name);
|
||||
list.Add(nameof(Genre));
|
||||
}
|
||||
|
||||
if (IsTypeInQuery(typeof(MusicGenre).Name, query))
|
||||
if (IsTypeInQuery(nameof(MusicGenre), query))
|
||||
{
|
||||
list.Add(typeof(MusicGenre).Name);
|
||||
list.Add(nameof(MusicGenre));
|
||||
}
|
||||
|
||||
if (IsTypeInQuery(typeof(MusicArtist).Name, query))
|
||||
if (IsTypeInQuery(nameof(MusicArtist), query))
|
||||
{
|
||||
list.Add(typeof(MusicArtist).Name);
|
||||
list.Add(nameof(MusicArtist));
|
||||
}
|
||||
|
||||
if (IsTypeInQuery(typeof(Studio).Name, query))
|
||||
if (IsTypeInQuery(nameof(Studio), query))
|
||||
{
|
||||
list.Add(typeof(Studio).Name);
|
||||
list.Add(nameof(Studio));
|
||||
}
|
||||
|
||||
return list;
|
||||
@@ -4832,12 +4850,12 @@ namespace Emby.Server.Implementations.Data
|
||||
|
||||
var types = new[]
|
||||
{
|
||||
typeof(Episode).Name,
|
||||
typeof(Video).Name,
|
||||
typeof(Movie).Name,
|
||||
typeof(MusicVideo).Name,
|
||||
typeof(Series).Name,
|
||||
typeof(Season).Name
|
||||
nameof(Episode),
|
||||
nameof(Video),
|
||||
nameof(Movie),
|
||||
nameof(MusicVideo),
|
||||
nameof(Series),
|
||||
nameof(Season)
|
||||
};
|
||||
|
||||
if (types.Any(i => query.IncludeItemTypes.Contains(i, StringComparer.OrdinalIgnoreCase)))
|
||||
@@ -5002,26 +5020,33 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
|
||||
CheckDisposed();
|
||||
|
||||
var commandText = "select Distinct Name from People";
|
||||
var commandText = new StringBuilder("select Distinct p.Name from People p");
|
||||
|
||||
if (query.User != null && query.IsFavorite.HasValue)
|
||||
{
|
||||
commandText.Append(" LEFT JOIN TypedBaseItems tbi ON tbi.Name=p.Name AND tbi.Type='");
|
||||
commandText.Append(typeof(Person).FullName);
|
||||
commandText.Append("' LEFT JOIN UserDatas ON tbi.UserDataKey=key AND userId=@UserId");
|
||||
}
|
||||
|
||||
var whereClauses = GetPeopleWhereClauses(query, null);
|
||||
|
||||
if (whereClauses.Count != 0)
|
||||
{
|
||||
commandText += " where " + string.Join(" AND ", whereClauses);
|
||||
commandText.Append(" where ").Append(string.Join(" AND ", whereClauses));
|
||||
}
|
||||
|
||||
commandText += " order by ListOrder";
|
||||
commandText.Append(" order by ListOrder");
|
||||
|
||||
if (query.Limit > 0)
|
||||
{
|
||||
commandText += " LIMIT " + query.Limit;
|
||||
commandText.Append(" LIMIT ").Append(query.Limit);
|
||||
}
|
||||
|
||||
using (var connection = GetConnection(true))
|
||||
{
|
||||
var list = new List<string>();
|
||||
using (var statement = PrepareStatement(connection, commandText))
|
||||
using (var statement = PrepareStatement(connection, commandText.ToString()))
|
||||
{
|
||||
// Run this again to bind the params
|
||||
GetPeopleWhereClauses(query, statement);
|
||||
@@ -5045,7 +5070,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
|
||||
CheckDisposed();
|
||||
|
||||
var commandText = "select ItemId, Name, Role, PersonType, SortOrder from People";
|
||||
var commandText = "select ItemId, Name, Role, PersonType, SortOrder from People p";
|
||||
|
||||
var whereClauses = GetPeopleWhereClauses(query, null);
|
||||
|
||||
@@ -5087,19 +5112,13 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
if (!query.ItemId.Equals(Guid.Empty))
|
||||
{
|
||||
whereClauses.Add("ItemId=@ItemId");
|
||||
if (statement != null)
|
||||
{
|
||||
statement.TryBind("@ItemId", query.ItemId.ToByteArray());
|
||||
}
|
||||
statement?.TryBind("@ItemId", query.ItemId.ToByteArray());
|
||||
}
|
||||
|
||||
if (!query.AppearsInItemId.Equals(Guid.Empty))
|
||||
{
|
||||
whereClauses.Add("Name in (Select Name from People where ItemId=@AppearsInItemId)");
|
||||
if (statement != null)
|
||||
{
|
||||
statement.TryBind("@AppearsInItemId", query.AppearsInItemId.ToByteArray());
|
||||
}
|
||||
whereClauses.Add("p.Name in (Select Name from People where ItemId=@AppearsInItemId)");
|
||||
statement?.TryBind("@AppearsInItemId", query.AppearsInItemId.ToByteArray());
|
||||
}
|
||||
|
||||
var queryPersonTypes = query.PersonTypes.Where(IsValidPersonType).ToList();
|
||||
@@ -5107,10 +5126,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
if (queryPersonTypes.Count == 1)
|
||||
{
|
||||
whereClauses.Add("PersonType=@PersonType");
|
||||
if (statement != null)
|
||||
{
|
||||
statement.TryBind("@PersonType", queryPersonTypes[0]);
|
||||
}
|
||||
statement?.TryBind("@PersonType", queryPersonTypes[0]);
|
||||
}
|
||||
else if (queryPersonTypes.Count > 1)
|
||||
{
|
||||
@@ -5124,10 +5140,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
if (queryExcludePersonTypes.Count == 1)
|
||||
{
|
||||
whereClauses.Add("PersonType<>@PersonType");
|
||||
if (statement != null)
|
||||
{
|
||||
statement.TryBind("@PersonType", queryExcludePersonTypes[0]);
|
||||
}
|
||||
statement?.TryBind("@PersonType", queryExcludePersonTypes[0]);
|
||||
}
|
||||
else if (queryExcludePersonTypes.Count > 1)
|
||||
{
|
||||
@@ -5139,19 +5152,24 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
if (query.MaxListOrder.HasValue)
|
||||
{
|
||||
whereClauses.Add("ListOrder<=@MaxListOrder");
|
||||
if (statement != null)
|
||||
{
|
||||
statement.TryBind("@MaxListOrder", query.MaxListOrder.Value);
|
||||
}
|
||||
statement?.TryBind("@MaxListOrder", query.MaxListOrder.Value);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(query.NameContains))
|
||||
{
|
||||
whereClauses.Add("Name like @NameContains");
|
||||
if (statement != null)
|
||||
{
|
||||
statement.TryBind("@NameContains", "%" + query.NameContains + "%");
|
||||
}
|
||||
whereClauses.Add("p.Name like @NameContains");
|
||||
statement?.TryBind("@NameContains", "%" + query.NameContains + "%");
|
||||
}
|
||||
|
||||
if (query.IsFavorite.HasValue)
|
||||
{
|
||||
whereClauses.Add("isFavorite=@IsFavorite");
|
||||
statement?.TryBind("@IsFavorite", query.IsFavorite.Value);
|
||||
}
|
||||
|
||||
if (query.User != null)
|
||||
{
|
||||
statement?.TryBind("@UserId", query.User.InternalId);
|
||||
}
|
||||
|
||||
return whereClauses;
|
||||
@@ -5420,6 +5438,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
NameStartsWithOrGreater = query.NameStartsWithOrGreater,
|
||||
Tags = query.Tags,
|
||||
OfficialRatings = query.OfficialRatings,
|
||||
StudioIds = query.StudioIds,
|
||||
GenreIds = query.GenreIds,
|
||||
Genres = query.Genres,
|
||||
Years = query.Years,
|
||||
@@ -5592,7 +5611,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
return counts;
|
||||
}
|
||||
|
||||
var allTypes = typeString.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
var allTypes = typeString.Split('|', StringSplitOptions.RemoveEmptyEntries)
|
||||
.ToLookup(x => x);
|
||||
|
||||
foreach (var type in allTypes)
|
||||
|
||||
@@ -1,61 +1,38 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Jellyfin.Data.Entities;
|
||||
using Jellyfin.Data.Enums;
|
||||
using Jellyfin.Data.Events;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Devices;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Security;
|
||||
using MediaBrowser.Model.Devices;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Session;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace Emby.Server.Implementations.Devices
|
||||
{
|
||||
public class DeviceManager : IDeviceManager
|
||||
{
|
||||
private readonly IMemoryCache _memoryCache;
|
||||
private readonly IJsonSerializer _json;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IAuthenticationRepository _authRepo;
|
||||
private readonly object _capabilitiesSyncLock = new object();
|
||||
private readonly ConcurrentDictionary<string, ClientCapabilities> _capabilitiesMap = new ();
|
||||
|
||||
public event EventHandler<GenericEventArgs<Tuple<string, DeviceOptions>>> DeviceOptionsUpdated;
|
||||
|
||||
public DeviceManager(
|
||||
IAuthenticationRepository authRepo,
|
||||
IJsonSerializer json,
|
||||
IUserManager userManager,
|
||||
IServerConfigurationManager config,
|
||||
IMemoryCache memoryCache)
|
||||
public DeviceManager(IAuthenticationRepository authRepo, IUserManager userManager)
|
||||
{
|
||||
_json = json;
|
||||
_userManager = userManager;
|
||||
_config = config;
|
||||
_memoryCache = memoryCache;
|
||||
_authRepo = authRepo;
|
||||
}
|
||||
|
||||
public event EventHandler<GenericEventArgs<Tuple<string, DeviceOptions>>> DeviceOptionsUpdated;
|
||||
|
||||
public void SaveCapabilities(string deviceId, ClientCapabilities capabilities)
|
||||
{
|
||||
var path = Path.Combine(GetDevicePath(deviceId), "capabilities.json");
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
lock (_capabilitiesSyncLock)
|
||||
{
|
||||
_memoryCache.Set(deviceId, capabilities);
|
||||
_json.SerializeToFile(capabilities, path);
|
||||
}
|
||||
_capabilitiesMap[deviceId] = capabilities;
|
||||
}
|
||||
|
||||
public void UpdateDeviceOptions(string deviceId, DeviceOptions options)
|
||||
@@ -72,32 +49,12 @@ namespace Emby.Server.Implementations.Devices
|
||||
|
||||
public ClientCapabilities GetCapabilities(string id)
|
||||
{
|
||||
if (_memoryCache.TryGetValue(id, out ClientCapabilities result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
lock (_capabilitiesSyncLock)
|
||||
{
|
||||
var path = Path.Combine(GetDevicePath(id), "capabilities.json");
|
||||
try
|
||||
{
|
||||
return _json.DeserializeFromFile<ClientCapabilities>(path) ?? new ClientCapabilities();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return new ClientCapabilities();
|
||||
return _capabilitiesMap.TryGetValue(id, out ClientCapabilities result)
|
||||
? result
|
||||
: new ClientCapabilities();
|
||||
}
|
||||
|
||||
public DeviceInfo GetDevice(string id)
|
||||
{
|
||||
return GetDevice(id, true);
|
||||
}
|
||||
|
||||
private DeviceInfo GetDevice(string id, bool includeCapabilities)
|
||||
{
|
||||
var session = _authRepo.Get(new AuthenticationInfoQuery
|
||||
{
|
||||
@@ -154,16 +111,6 @@ namespace Emby.Server.Implementations.Devices
|
||||
};
|
||||
}
|
||||
|
||||
private string GetDevicesPath()
|
||||
{
|
||||
return Path.Combine(_config.ApplicationPaths.DataPath, "devices");
|
||||
}
|
||||
|
||||
private string GetDevicePath(string id)
|
||||
{
|
||||
return Path.Combine(GetDevicesPath(), id.GetMD5().ToString("N", CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
public bool CanAccessDevice(User user, string deviceId)
|
||||
{
|
||||
if (user == null)
|
||||
|
||||
@@ -275,7 +275,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
continue;
|
||||
}
|
||||
|
||||
var containers = container.Split(new[] { ',' });
|
||||
var containers = container.Split(',');
|
||||
if (containers.Length < 2)
|
||||
{
|
||||
continue;
|
||||
@@ -465,7 +465,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
{
|
||||
var parentAlbumIds = _libraryManager.GetItemIds(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(MusicAlbum).Name },
|
||||
IncludeItemTypes = new[] { nameof(MusicAlbum) },
|
||||
Name = item.Album,
|
||||
Limit = 1
|
||||
});
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="IPNetwork2" Version="2.5.226" />
|
||||
<PackageReference Include="Jellyfin.XmlTv" Version="10.6.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
|
||||
@@ -32,13 +31,13 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.ResponseCompression" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="2.2.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="3.1.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.1.9" />
|
||||
<PackageReference Include="Mono.Nat" Version="3.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="5.0.0" />
|
||||
<PackageReference Include="Mono.Nat" Version="3.0.1" />
|
||||
<PackageReference Include="prometheus-net.DotNetRuntime" Version="3.4.0" />
|
||||
<PackageReference Include="ServiceStack.Text.Core" Version="5.9.2" />
|
||||
<PackageReference Include="ServiceStack.Text.Core" Version="5.10.0" />
|
||||
<PackageReference Include="sharpcompress" Version="0.26.0" />
|
||||
<PackageReference Include="SQLitePCL.pretty.netstandard" Version="2.1.0" />
|
||||
<PackageReference Include="DotNet.Glob" Version="3.1.0" />
|
||||
@@ -49,10 +48,12 @@
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<TreatWarningsAsErrors Condition=" '$(Configuration)' == 'Release'">true</TreatWarningsAsErrors>
|
||||
<!-- https://github.com/microsoft/ApplicationInsights-dotnet/issues/2047 -->
|
||||
<NoWarn>AD0001</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Code Analyzers-->
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Events;
|
||||
using Jellyfin.Networking.Configuration;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
@@ -56,7 +57,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
private string GetConfigIdentifier()
|
||||
{
|
||||
const char Separator = '|';
|
||||
var config = _config.Configuration;
|
||||
var config = _config.GetNetworkConfiguration();
|
||||
|
||||
return new StringBuilder(32)
|
||||
.Append(config.EnableUPnP).Append(Separator)
|
||||
@@ -93,7 +94,8 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (!_config.Configuration.EnableUPnP || !_config.Configuration.EnableRemoteAccess)
|
||||
var config = _config.GetNetworkConfiguration();
|
||||
if (!config.EnableUPnP || !config.EnableRemoteAccess)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -156,11 +158,12 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
|
||||
private IEnumerable<Task> CreatePortMaps(INatDevice device)
|
||||
{
|
||||
yield return CreatePortMap(device, _appHost.HttpPort, _config.Configuration.PublicPort);
|
||||
var config = _config.GetNetworkConfiguration();
|
||||
yield return CreatePortMap(device, _appHost.HttpPort, config.PublicPort);
|
||||
|
||||
if (_appHost.ListenWithHttps)
|
||||
{
|
||||
yield return CreatePortMap(device, _appHost.HttpsPort, _config.Configuration.PublicHttpsPort);
|
||||
yield return CreatePortMap(device, _appHost.HttpsPort, config.PublicHttpsPort);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Authentication;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
@@ -19,12 +20,12 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
public AuthorizationInfo Authenticate(HttpRequest request)
|
||||
{
|
||||
var auth = _authorizationContext.GetAuthorizationInfo(request);
|
||||
if (auth?.User == null)
|
||||
if (!auth.IsAuthenticated)
|
||||
{
|
||||
return null;
|
||||
throw new AuthenticationException("Invalid token.");
|
||||
}
|
||||
|
||||
if (auth.User.HasPermission(PermissionKind.IsDisabled))
|
||||
if (auth.User?.HasPermission(PermissionKind.IsDisabled) ?? false)
|
||||
{
|
||||
throw new SecurityException("User account has been disabled.");
|
||||
}
|
||||
|
||||
@@ -36,8 +36,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
public AuthorizationInfo GetAuthorizationInfo(HttpRequest requestContext)
|
||||
{
|
||||
var auth = GetAuthorizationDictionary(requestContext);
|
||||
var (authInfo, _) =
|
||||
GetAuthorizationInfoFromDictionary(auth, requestContext.Headers, requestContext.Query);
|
||||
var authInfo = GetAuthorizationInfoFromDictionary(auth, requestContext.Headers, requestContext.Query);
|
||||
return authInfo;
|
||||
}
|
||||
|
||||
@@ -49,19 +48,13 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
private AuthorizationInfo GetAuthorization(HttpContext httpReq)
|
||||
{
|
||||
var auth = GetAuthorizationDictionary(httpReq);
|
||||
var (authInfo, originalAuthInfo) =
|
||||
GetAuthorizationInfoFromDictionary(auth, httpReq.Request.Headers, httpReq.Request.Query);
|
||||
|
||||
if (originalAuthInfo != null)
|
||||
{
|
||||
httpReq.Request.HttpContext.Items["OriginalAuthenticationInfo"] = originalAuthInfo;
|
||||
}
|
||||
var authInfo = GetAuthorizationInfoFromDictionary(auth, httpReq.Request.Headers, httpReq.Request.Query);
|
||||
|
||||
httpReq.Request.HttpContext.Items["AuthorizationInfo"] = authInfo;
|
||||
return authInfo;
|
||||
}
|
||||
|
||||
private (AuthorizationInfo authInfo, AuthenticationInfo originalAuthenticationInfo) GetAuthorizationInfoFromDictionary(
|
||||
private AuthorizationInfo GetAuthorizationInfoFromDictionary(
|
||||
in Dictionary<string, string> auth,
|
||||
in IHeaderDictionary headers,
|
||||
in IQueryCollection queryString)
|
||||
@@ -108,88 +101,102 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
Device = device,
|
||||
DeviceId = deviceId,
|
||||
Version = version,
|
||||
Token = token
|
||||
Token = token,
|
||||
IsAuthenticated = false
|
||||
};
|
||||
|
||||
AuthenticationInfo originalAuthenticationInfo = null;
|
||||
if (!string.IsNullOrWhiteSpace(token))
|
||||
if (string.IsNullOrWhiteSpace(token))
|
||||
{
|
||||
var result = _authRepo.Get(new AuthenticationInfoQuery
|
||||
// Request doesn't contain a token.
|
||||
return authInfo;
|
||||
}
|
||||
|
||||
var result = _authRepo.Get(new AuthenticationInfoQuery
|
||||
{
|
||||
AccessToken = token
|
||||
});
|
||||
|
||||
if (result.Items.Count > 0)
|
||||
{
|
||||
authInfo.IsAuthenticated = true;
|
||||
}
|
||||
|
||||
var originalAuthenticationInfo = result.Items.Count > 0 ? result.Items[0] : null;
|
||||
|
||||
if (originalAuthenticationInfo != null)
|
||||
{
|
||||
var updateToken = false;
|
||||
|
||||
// TODO: Remove these checks for IsNullOrWhiteSpace
|
||||
if (string.IsNullOrWhiteSpace(authInfo.Client))
|
||||
{
|
||||
AccessToken = token
|
||||
});
|
||||
authInfo.Client = originalAuthenticationInfo.AppName;
|
||||
}
|
||||
|
||||
originalAuthenticationInfo = result.Items.Count > 0 ? result.Items[0] : null;
|
||||
|
||||
if (originalAuthenticationInfo != null)
|
||||
if (string.IsNullOrWhiteSpace(authInfo.DeviceId))
|
||||
{
|
||||
var updateToken = false;
|
||||
authInfo.DeviceId = originalAuthenticationInfo.DeviceId;
|
||||
}
|
||||
|
||||
// TODO: Remove these checks for IsNullOrWhiteSpace
|
||||
if (string.IsNullOrWhiteSpace(authInfo.Client))
|
||||
{
|
||||
authInfo.Client = originalAuthenticationInfo.AppName;
|
||||
}
|
||||
// Temporary. TODO - allow clients to specify that the token has been shared with a casting device
|
||||
var allowTokenInfoUpdate = authInfo.Client == null || authInfo.Client.IndexOf("chromecast", StringComparison.OrdinalIgnoreCase) == -1;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(authInfo.DeviceId))
|
||||
if (string.IsNullOrWhiteSpace(authInfo.Device))
|
||||
{
|
||||
authInfo.Device = originalAuthenticationInfo.DeviceName;
|
||||
}
|
||||
else if (!string.Equals(authInfo.Device, originalAuthenticationInfo.DeviceName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (allowTokenInfoUpdate)
|
||||
{
|
||||
authInfo.DeviceId = originalAuthenticationInfo.DeviceId;
|
||||
updateToken = true;
|
||||
originalAuthenticationInfo.DeviceName = authInfo.Device;
|
||||
}
|
||||
}
|
||||
|
||||
// Temporary. TODO - allow clients to specify that the token has been shared with a casting device
|
||||
var allowTokenInfoUpdate = authInfo.Client == null || authInfo.Client.IndexOf("chromecast", StringComparison.OrdinalIgnoreCase) == -1;
|
||||
if (string.IsNullOrWhiteSpace(authInfo.Version))
|
||||
{
|
||||
authInfo.Version = originalAuthenticationInfo.AppVersion;
|
||||
}
|
||||
else if (!string.Equals(authInfo.Version, originalAuthenticationInfo.AppVersion, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (allowTokenInfoUpdate)
|
||||
{
|
||||
updateToken = true;
|
||||
originalAuthenticationInfo.AppVersion = authInfo.Version;
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(authInfo.Device))
|
||||
{
|
||||
authInfo.Device = originalAuthenticationInfo.DeviceName;
|
||||
}
|
||||
else if (!string.Equals(authInfo.Device, originalAuthenticationInfo.DeviceName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (allowTokenInfoUpdate)
|
||||
{
|
||||
updateToken = true;
|
||||
originalAuthenticationInfo.DeviceName = authInfo.Device;
|
||||
}
|
||||
}
|
||||
if ((DateTime.UtcNow - originalAuthenticationInfo.DateLastActivity).TotalMinutes > 3)
|
||||
{
|
||||
originalAuthenticationInfo.DateLastActivity = DateTime.UtcNow;
|
||||
updateToken = true;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(authInfo.Version))
|
||||
{
|
||||
authInfo.Version = originalAuthenticationInfo.AppVersion;
|
||||
}
|
||||
else if (!string.Equals(authInfo.Version, originalAuthenticationInfo.AppVersion, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (allowTokenInfoUpdate)
|
||||
{
|
||||
updateToken = true;
|
||||
originalAuthenticationInfo.AppVersion = authInfo.Version;
|
||||
}
|
||||
}
|
||||
if (!originalAuthenticationInfo.UserId.Equals(Guid.Empty))
|
||||
{
|
||||
authInfo.User = _userManager.GetUserById(originalAuthenticationInfo.UserId);
|
||||
|
||||
if ((DateTime.UtcNow - originalAuthenticationInfo.DateLastActivity).TotalMinutes > 3)
|
||||
if (authInfo.User != null && !string.Equals(authInfo.User.Username, originalAuthenticationInfo.UserName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
originalAuthenticationInfo.DateLastActivity = DateTime.UtcNow;
|
||||
originalAuthenticationInfo.UserName = authInfo.User.Username;
|
||||
updateToken = true;
|
||||
}
|
||||
|
||||
if (!originalAuthenticationInfo.UserId.Equals(Guid.Empty))
|
||||
{
|
||||
authInfo.User = _userManager.GetUserById(originalAuthenticationInfo.UserId);
|
||||
authInfo.IsApiKey = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
authInfo.IsApiKey = false;
|
||||
}
|
||||
|
||||
if (authInfo.User != null && !string.Equals(authInfo.User.Username, originalAuthenticationInfo.UserName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
originalAuthenticationInfo.UserName = authInfo.User.Username;
|
||||
updateToken = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (updateToken)
|
||||
{
|
||||
_authRepo.Update(originalAuthenticationInfo);
|
||||
}
|
||||
if (updateToken)
|
||||
{
|
||||
_authRepo.Update(originalAuthenticationInfo);
|
||||
}
|
||||
}
|
||||
|
||||
return (authInfo, originalAuthenticationInfo);
|
||||
return authInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -238,7 +245,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
return null;
|
||||
}
|
||||
|
||||
var parts = authorizationHeader.Split(new[] { ' ' }, 2);
|
||||
var parts = authorizationHeader.Split(' ', 2);
|
||||
|
||||
// There should be at least to parts
|
||||
if (parts.Length != 2)
|
||||
@@ -262,12 +269,12 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
|
||||
foreach (var item in parts)
|
||||
{
|
||||
var param = item.Trim().Split(new[] { '=' }, 2);
|
||||
var param = item.Trim().Split('=', 2);
|
||||
|
||||
if (param.Length == 2)
|
||||
{
|
||||
var value = NormalizeValue(param[1].Trim(new[] { '"' }));
|
||||
result.Add(param[0], value);
|
||||
var value = NormalizeValue(param[1].Trim('"'));
|
||||
result[param[0]] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.WebSockets;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Events;
|
||||
@@ -14,16 +13,18 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
{
|
||||
public class WebSocketManager : IWebSocketManager
|
||||
{
|
||||
private readonly Lazy<IEnumerable<IWebSocketListener>> _webSocketListeners;
|
||||
private readonly ILogger<WebSocketManager> _logger;
|
||||
private readonly ILoggerFactory _loggerFactory;
|
||||
|
||||
private IWebSocketListener[] _webSocketListeners = Array.Empty<IWebSocketListener>();
|
||||
private bool _disposed = false;
|
||||
|
||||
public WebSocketManager(
|
||||
Lazy<IEnumerable<IWebSocketListener>> webSocketListeners,
|
||||
ILogger<WebSocketManager> logger,
|
||||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
_webSocketListeners = webSocketListeners;
|
||||
_logger = logger;
|
||||
_loggerFactory = loggerFactory;
|
||||
}
|
||||
@@ -68,15 +69,6 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the rest handlers.
|
||||
/// </summary>
|
||||
/// <param name="listeners">The web socket listeners.</param>
|
||||
public void Init(IEnumerable<IWebSocketListener> listeners)
|
||||
{
|
||||
_webSocketListeners = listeners.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the web socket message received.
|
||||
/// </summary>
|
||||
@@ -90,7 +82,8 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
|
||||
IEnumerable<Task> GetTasks()
|
||||
{
|
||||
foreach (var x in _webSocketListeners)
|
||||
var listeners = _webSocketListeners.Value;
|
||||
foreach (var x in listeners)
|
||||
{
|
||||
yield return x.ProcessMessageAsync(result);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Emby.Server.Implementations.Images
|
||||
// return _libraryManager.GetItemList(new InternalItemsQuery
|
||||
// {
|
||||
// ArtistIds = new[] { item.Id },
|
||||
// IncludeItemTypes = new[] { typeof(MusicAlbum).Name },
|
||||
// IncludeItemTypes = new[] { nameof(MusicAlbum) },
|
||||
// OrderBy = new[] { (ItemSortBy.Random, SortOrder.Ascending) },
|
||||
// Limit = 4,
|
||||
// Recursive = true,
|
||||
|
||||
@@ -42,7 +42,12 @@ namespace Emby.Server.Implementations.Images
|
||||
return _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
Genres = new[] { item.Name },
|
||||
IncludeItemTypes = new[] { typeof(MusicAlbum).Name, typeof(MusicVideo).Name, typeof(Audio).Name },
|
||||
IncludeItemTypes = new[]
|
||||
{
|
||||
nameof(MusicAlbum),
|
||||
nameof(MusicVideo),
|
||||
nameof(Audio)
|
||||
},
|
||||
OrderBy = new[] { (ItemSortBy.Random, SortOrder.Ascending) },
|
||||
Limit = 4,
|
||||
Recursive = true,
|
||||
@@ -77,7 +82,7 @@ namespace Emby.Server.Implementations.Images
|
||||
return _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
Genres = new[] { item.Name },
|
||||
IncludeItemTypes = new[] { typeof(Series).Name, typeof(Movie).Name },
|
||||
IncludeItemTypes = new[] { nameof(Series), nameof(Movie) },
|
||||
OrderBy = new[] { (ItemSortBy.Random, SortOrder.Ascending) },
|
||||
Limit = 4,
|
||||
Recursive = true,
|
||||
|
||||
130
Emby.Server.Implementations/Library/ImageFetcherPostScanTask.cs
Normal file
130
Emby.Server.Implementations/Library/ImageFetcherPostScanTask.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Events;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Net;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// A library post scan/refresh task for pre-fetching remote images.
|
||||
/// </summary>
|
||||
public class ImageFetcherPostScanTask : ILibraryPostScanTask
|
||||
{
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IProviderManager _providerManager;
|
||||
private readonly ILogger<ImageFetcherPostScanTask> _logger;
|
||||
private readonly SemaphoreSlim _imageFetcherLock;
|
||||
|
||||
private ConcurrentDictionary<Guid, (BaseItem item, ItemUpdateType updateReason)> _queuedItems;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ImageFetcherPostScanTask"/> class.
|
||||
/// </summary>
|
||||
/// <param name="libraryManager">An instance of <see cref="ILibraryManager"/>.</param>
|
||||
/// <param name="providerManager">An instance of <see cref="IProviderManager"/>.</param>
|
||||
/// <param name="logger">An instance of <see cref="ILogger{ImageFetcherPostScanTask}"/>.</param>
|
||||
public ImageFetcherPostScanTask(
|
||||
ILibraryManager libraryManager,
|
||||
IProviderManager providerManager,
|
||||
ILogger<ImageFetcherPostScanTask> logger)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
_providerManager = providerManager;
|
||||
_logger = logger;
|
||||
_queuedItems = new ConcurrentDictionary<Guid, (BaseItem item, ItemUpdateType updateReason)>();
|
||||
_imageFetcherLock = new SemaphoreSlim(1, 1);
|
||||
_libraryManager.ItemAdded += OnLibraryManagerItemAddedOrUpdated;
|
||||
_libraryManager.ItemUpdated += OnLibraryManagerItemAddedOrUpdated;
|
||||
_providerManager.RefreshCompleted += OnProviderManagerRefreshCompleted;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
// Sometimes a library scan will cause this to run twice if there's an item refresh going on.
|
||||
await _imageFetcherLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
try
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
var itemGuids = _queuedItems.Keys.ToList();
|
||||
|
||||
for (var i = 0; i < itemGuids.Count; i++)
|
||||
{
|
||||
if (!_queuedItems.TryGetValue(itemGuids[i], out var queuedItem))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var itemId = queuedItem.item.Id.ToString("N", CultureInfo.InvariantCulture);
|
||||
var itemType = queuedItem.item.GetType();
|
||||
_logger.LogDebug(
|
||||
"Updating remote images for item {ItemId} with media type {ItemMediaType}",
|
||||
itemId,
|
||||
itemType);
|
||||
try
|
||||
{
|
||||
await _libraryManager.UpdateImagesAsync(queuedItem.item, queuedItem.updateReason >= ItemUpdateType.ImageUpdate).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Failed to fetch images for {Type} item with id {ItemId}", itemType, itemId);
|
||||
}
|
||||
|
||||
_queuedItems.TryRemove(queuedItem.item.Id, out _);
|
||||
}
|
||||
|
||||
if (itemGuids.Count > 0)
|
||||
{
|
||||
_logger.LogInformation(
|
||||
"Finished updating/pre-fetching {NumberOfImages} images. Elapsed time: {TimeElapsed}s.",
|
||||
itemGuids.Count.ToString(CultureInfo.InvariantCulture),
|
||||
(DateTime.UtcNow - now).TotalSeconds.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogDebug("No images were updated.");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_imageFetcherLock.Release();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLibraryManagerItemAddedOrUpdated(object sender, ItemChangeEventArgs itemChangeEventArgs)
|
||||
{
|
||||
if (!_queuedItems.ContainsKey(itemChangeEventArgs.Item.Id) && itemChangeEventArgs.Item.ImageInfos.Length > 0)
|
||||
{
|
||||
_queuedItems.AddOrUpdate(
|
||||
itemChangeEventArgs.Item.Id,
|
||||
(itemChangeEventArgs.Item, itemChangeEventArgs.UpdateReason),
|
||||
(key, existingValue) => existingValue);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnProviderManagerRefreshCompleted(object sender, GenericEventArgs<BaseItem> e)
|
||||
{
|
||||
if (!_queuedItems.ContainsKey(e.Argument.Id) && e.Argument.ImageInfos.Length > 0)
|
||||
{
|
||||
_queuedItems.AddOrUpdate(
|
||||
e.Argument.Id,
|
||||
(e.Argument, ItemUpdateType.None),
|
||||
(key, existingValue) => existingValue);
|
||||
}
|
||||
|
||||
// The RefreshCompleted event is a bit awkward in that it seems to _only_ be fired on
|
||||
// the item that was refreshed regardless of children refreshes. So we take it as a signal
|
||||
// that the refresh is entirely completed.
|
||||
Run(null, CancellationToken.None).GetAwaiter().GetResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Emby.Naming.Audio;
|
||||
@@ -857,7 +858,21 @@ namespace Emby.Server.Implementations.Library
|
||||
/// <returns>Task{Person}.</returns>
|
||||
public Person GetPerson(string name)
|
||||
{
|
||||
return CreateItemByName<Person>(Person.GetPath, name, new DtoOptions(true));
|
||||
var path = Person.GetPath(name);
|
||||
var id = GetItemByNameId<Person>(path);
|
||||
if (!(GetItemById(id) is Person item))
|
||||
{
|
||||
item = new Person
|
||||
{
|
||||
Name = name,
|
||||
Id = id,
|
||||
DateCreated = DateTime.UtcNow,
|
||||
DateModified = DateTime.UtcNow,
|
||||
Path = path
|
||||
};
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1502,7 +1517,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (query.AncestorIds.Length == 0 &&
|
||||
query.ParentId.Equals(Guid.Empty) &&
|
||||
query.ChannelIds.Length == 0 &&
|
||||
query.ChannelIds.Count == 0 &&
|
||||
query.TopParentIds.Length == 0 &&
|
||||
string.IsNullOrEmpty(query.AncestorWithPresentationUniqueKey) &&
|
||||
string.IsNullOrEmpty(query.SeriesPresentationUniqueKey) &&
|
||||
@@ -1940,19 +1955,9 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task UpdateItemsAsync(IReadOnlyList<BaseItem> items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
|
||||
public Task UpdateItemsAsync(IReadOnlyList<BaseItem> items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (item.IsFileProtocol)
|
||||
{
|
||||
ProviderManager.SaveMetadata(item, updateReason);
|
||||
}
|
||||
|
||||
item.DateLastSaved = DateTime.UtcNow;
|
||||
|
||||
await UpdateImagesAsync(item, updateReason >= ItemUpdateType.ImageUpdate).ConfigureAwait(false);
|
||||
}
|
||||
RunMetadataSavers(items, updateReason);
|
||||
|
||||
_itemRepository.SaveItems(items, cancellationToken);
|
||||
|
||||
@@ -1983,12 +1988,27 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task UpdateItemAsync(BaseItem item, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
|
||||
=> UpdateItemsAsync(new[] { item }, parent, updateReason, cancellationToken);
|
||||
|
||||
public void RunMetadataSavers(IReadOnlyList<BaseItem> items, ItemUpdateType updateReason)
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (item.IsFileProtocol)
|
||||
{
|
||||
ProviderManager.SaveMetadata(item, updateReason);
|
||||
}
|
||||
|
||||
item.DateLastSaved = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports the item removed.
|
||||
/// </summary>
|
||||
@@ -2440,6 +2460,21 @@ namespace Emby.Server.Implementations.Library
|
||||
new SubtitleResolver(BaseItem.LocalizationManager).AddExternalSubtitleStreams(streams, videoPath, streams.Count, files);
|
||||
}
|
||||
|
||||
public BaseItem GetParentItem(string parentId, Guid? userId)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(parentId))
|
||||
{
|
||||
return GetItemById(new Guid(parentId));
|
||||
}
|
||||
|
||||
if (userId.HasValue && userId != Guid.Empty)
|
||||
{
|
||||
return GetUserRootFolder();
|
||||
}
|
||||
|
||||
return RootFolder;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsVideoFile(string path)
|
||||
{
|
||||
@@ -2470,9 +2505,10 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
var isFolder = episode.VideoType == VideoType.BluRay || episode.VideoType == VideoType.Dvd;
|
||||
|
||||
// TODO nullable - what are we trying to do there with empty episodeInfo?
|
||||
var episodeInfo = episode.IsFileProtocol
|
||||
? resolver.Resolve(episode.Path, isFolder, null, null, isAbsoluteNaming) ?? new Naming.TV.EpisodeInfo()
|
||||
: new Naming.TV.EpisodeInfo();
|
||||
? resolver.Resolve(episode.Path, isFolder, null, null, isAbsoluteNaming) ?? new Naming.TV.EpisodeInfo(episode.Path)
|
||||
: new Naming.TV.EpisodeInfo(episode.Path);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -2561,12 +2597,12 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
if (!episode.IndexNumberEnd.HasValue || forceRefresh)
|
||||
{
|
||||
if (episode.IndexNumberEnd != episodeInfo.EndingEpsiodeNumber)
|
||||
if (episode.IndexNumberEnd != episodeInfo.EndingEpisodeNumber)
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
|
||||
episode.IndexNumberEnd = episodeInfo.EndingEpsiodeNumber;
|
||||
episode.IndexNumberEnd = episodeInfo.EndingEpisodeNumber;
|
||||
}
|
||||
|
||||
if (!episode.ParentIndexNumber.HasValue || forceRefresh)
|
||||
@@ -2690,7 +2726,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
var videos = videoListResolver.Resolve(fileSystemChildren);
|
||||
|
||||
var currentVideo = videos.FirstOrDefault(i => string.Equals(owner.Path, i.Files.First().Path, StringComparison.OrdinalIgnoreCase));
|
||||
var currentVideo = videos.FirstOrDefault(i => string.Equals(owner.Path, i.Files[0].Path, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (currentVideo != null)
|
||||
{
|
||||
@@ -2892,7 +2928,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
return item.GetImageInfo(image.Type, imageIndex);
|
||||
}
|
||||
catch (HttpException ex)
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
if (ex.StatusCode.HasValue
|
||||
&& (ex.StatusCode.Value == HttpStatusCode.NotFound || ex.StatusCode.Value == HttpStatusCode.Forbidden))
|
||||
|
||||
@@ -849,7 +849,7 @@ namespace Emby.Server.Implementations.Library
|
||||
throw new ArgumentException("Key can't be empty.", nameof(key));
|
||||
}
|
||||
|
||||
var keys = key.Split(new[] { LiveStreamIdDelimeter }, 2);
|
||||
var keys = key.Split(LiveStreamIdDelimeter, 2);
|
||||
|
||||
var provider = _providers.FirstOrDefault(i => string.Equals(i.GetType().FullName.GetMD5().ToString("N", CultureInfo.InvariantCulture), keys[0], StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
private static IEnumerable<MediaStream> GetSortedStreams(IEnumerable<MediaStream> streams, MediaStreamType type, string[] languagePreferences)
|
||||
{
|
||||
// Give some preferance to external text subs for better performance
|
||||
// Give some preference to external text subs for better performance
|
||||
return streams.Where(i => i.Type == type)
|
||||
.OrderBy(i =>
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Emby.Server.Implementations.Library
|
||||
var genres = item
|
||||
.GetRecursiveChildren(user, new InternalItemsQuery(user)
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(Audio).Name },
|
||||
IncludeItemTypes = new[] { nameof(Audio) },
|
||||
DtoOptions = dtoOptions
|
||||
})
|
||||
.Cast<Audio>()
|
||||
@@ -86,7 +86,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
return _libraryManager.GetItemList(new InternalItemsQuery(user)
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(Audio).Name },
|
||||
IncludeItemTypes = new[] { nameof(Audio) },
|
||||
|
||||
GenreIds = genreIds.ToArray(),
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||
continue;
|
||||
}
|
||||
|
||||
var firstMedia = resolvedItem.Files.First();
|
||||
var firstMedia = resolvedItem.Files[0];
|
||||
|
||||
var libraryItem = new T
|
||||
{
|
||||
|
||||
@@ -87,61 +87,61 @@ namespace Emby.Server.Implementations.Library
|
||||
var excludeItemTypes = query.ExcludeItemTypes.ToList();
|
||||
var includeItemTypes = (query.IncludeItemTypes ?? Array.Empty<string>()).ToList();
|
||||
|
||||
excludeItemTypes.Add(typeof(Year).Name);
|
||||
excludeItemTypes.Add(typeof(Folder).Name);
|
||||
excludeItemTypes.Add(nameof(Year));
|
||||
excludeItemTypes.Add(nameof(Folder));
|
||||
|
||||
if (query.IncludeGenres && (includeItemTypes.Count == 0 || includeItemTypes.Contains("Genre", StringComparer.OrdinalIgnoreCase)))
|
||||
{
|
||||
if (!query.IncludeMedia)
|
||||
{
|
||||
AddIfMissing(includeItemTypes, typeof(Genre).Name);
|
||||
AddIfMissing(includeItemTypes, typeof(MusicGenre).Name);
|
||||
AddIfMissing(includeItemTypes, nameof(Genre));
|
||||
AddIfMissing(includeItemTypes, nameof(MusicGenre));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddIfMissing(excludeItemTypes, typeof(Genre).Name);
|
||||
AddIfMissing(excludeItemTypes, typeof(MusicGenre).Name);
|
||||
AddIfMissing(excludeItemTypes, nameof(Genre));
|
||||
AddIfMissing(excludeItemTypes, nameof(MusicGenre));
|
||||
}
|
||||
|
||||
if (query.IncludePeople && (includeItemTypes.Count == 0 || includeItemTypes.Contains("People", StringComparer.OrdinalIgnoreCase) || includeItemTypes.Contains("Person", StringComparer.OrdinalIgnoreCase)))
|
||||
{
|
||||
if (!query.IncludeMedia)
|
||||
{
|
||||
AddIfMissing(includeItemTypes, typeof(Person).Name);
|
||||
AddIfMissing(includeItemTypes, nameof(Person));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddIfMissing(excludeItemTypes, typeof(Person).Name);
|
||||
AddIfMissing(excludeItemTypes, nameof(Person));
|
||||
}
|
||||
|
||||
if (query.IncludeStudios && (includeItemTypes.Count == 0 || includeItemTypes.Contains("Studio", StringComparer.OrdinalIgnoreCase)))
|
||||
{
|
||||
if (!query.IncludeMedia)
|
||||
{
|
||||
AddIfMissing(includeItemTypes, typeof(Studio).Name);
|
||||
AddIfMissing(includeItemTypes, nameof(Studio));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddIfMissing(excludeItemTypes, typeof(Studio).Name);
|
||||
AddIfMissing(excludeItemTypes, nameof(Studio));
|
||||
}
|
||||
|
||||
if (query.IncludeArtists && (includeItemTypes.Count == 0 || includeItemTypes.Contains("MusicArtist", StringComparer.OrdinalIgnoreCase)))
|
||||
{
|
||||
if (!query.IncludeMedia)
|
||||
{
|
||||
AddIfMissing(includeItemTypes, typeof(MusicArtist).Name);
|
||||
AddIfMissing(includeItemTypes, nameof(MusicArtist));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddIfMissing(excludeItemTypes, typeof(MusicArtist).Name);
|
||||
AddIfMissing(excludeItemTypes, nameof(MusicArtist));
|
||||
}
|
||||
|
||||
AddIfMissing(excludeItemTypes, typeof(CollectionFolder).Name);
|
||||
AddIfMissing(excludeItemTypes, typeof(Folder).Name);
|
||||
AddIfMissing(excludeItemTypes, nameof(CollectionFolder));
|
||||
AddIfMissing(excludeItemTypes, nameof(Folder));
|
||||
var mediaTypes = query.MediaTypes.ToList();
|
||||
|
||||
if (includeItemTypes.Count > 0)
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
|
||||
var deadEntities = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(MusicArtist).Name },
|
||||
IncludeItemTypes = new[] { nameof(MusicArtist) },
|
||||
IsDeadArtist = true,
|
||||
IsLocked = false
|
||||
}).Cast<MusicArtist>().ToList();
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
|
||||
var deadEntities = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(Person).Name },
|
||||
IncludeItemTypes = new[] { nameof(Person) },
|
||||
IsDeadPerson = true,
|
||||
IsLocked = false
|
||||
});
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
|
||||
var deadEntities = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(Studio).Name },
|
||||
IncludeItemTypes = new[] { nameof(Studio) },
|
||||
IsDeadStudio = true,
|
||||
IsLocked = false
|
||||
});
|
||||
|
||||
@@ -77,11 +77,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
_logger.LogInformation("Copying recording stream to file {0}", targetFile);
|
||||
|
||||
// The media source if infinite so we need to handle stopping ourselves
|
||||
var durationToken = new CancellationTokenSource(duration);
|
||||
cancellationToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, durationToken.Token).Token;
|
||||
using var durationToken = new CancellationTokenSource(duration);
|
||||
using var linkedCancellationToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, durationToken.Token);
|
||||
cancellationToken = linkedCancellationToken.Token;
|
||||
|
||||
await _streamHelper.CopyUntilCancelled(
|
||||
await response.Content.ReadAsStreamAsync().ConfigureAwait(false),
|
||||
await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false),
|
||||
output,
|
||||
IODefaults.CopyToBufferSize,
|
||||
cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@@ -1635,7 +1635,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
if (mediaSource.RequiresLooping || !(mediaSource.Container ?? string.Empty).EndsWith("ts", StringComparison.OrdinalIgnoreCase) || (mediaSource.Protocol != MediaProtocol.File && mediaSource.Protocol != MediaProtocol.Http))
|
||||
{
|
||||
return new EncodedRecorder(_logger, _mediaEncoder, _config.ApplicationPaths, _jsonSerializer);
|
||||
return new EncodedRecorder(_logger, _mediaEncoder, _config.ApplicationPaths, _jsonSerializer, _config);
|
||||
}
|
||||
|
||||
return new DirectRecorder(_logger, _httpClientFactory, _streamHelper);
|
||||
@@ -1790,7 +1790,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
var program = string.IsNullOrWhiteSpace(timer.ProgramId) ? null : _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(LiveTvProgram).Name },
|
||||
IncludeItemTypes = new[] { nameof(LiveTvProgram) },
|
||||
Limit = 1,
|
||||
ExternalId = timer.ProgramId,
|
||||
DtoOptions = new DtoOptions(true)
|
||||
@@ -2151,7 +2151,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
var query = new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new string[] { typeof(LiveTvProgram).Name },
|
||||
IncludeItemTypes = new string[] { nameof(LiveTvProgram) },
|
||||
Limit = 1,
|
||||
DtoOptions = new DtoOptions(true)
|
||||
{
|
||||
@@ -2370,7 +2370,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
var query = new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new string[] { typeof(LiveTvProgram).Name },
|
||||
IncludeItemTypes = new string[] { nameof(LiveTvProgram) },
|
||||
ExternalSeriesId = seriesTimer.SeriesId,
|
||||
DtoOptions = new DtoOptions(true)
|
||||
{
|
||||
@@ -2405,7 +2405,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
channel = _libraryManager.GetItemList(
|
||||
new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new string[] { typeof(LiveTvChannel).Name },
|
||||
IncludeItemTypes = new string[] { nameof(LiveTvChannel) },
|
||||
ItemIds = new[] { parent.ChannelId },
|
||||
DtoOptions = new DtoOptions()
|
||||
}).FirstOrDefault() as LiveTvChannel;
|
||||
@@ -2464,7 +2464,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
channel = _libraryManager.GetItemList(
|
||||
new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new string[] { typeof(LiveTvChannel).Name },
|
||||
IncludeItemTypes = new string[] { nameof(LiveTvChannel) },
|
||||
ItemIds = new[] { programInfo.ChannelId },
|
||||
DtoOptions = new DtoOptions()
|
||||
}).FirstOrDefault() as LiveTvChannel;
|
||||
@@ -2529,7 +2529,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
var seriesIds = _libraryManager.GetItemIds(
|
||||
new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(Series).Name },
|
||||
IncludeItemTypes = new[] { nameof(Series) },
|
||||
Name = program.Name
|
||||
}).ToArray();
|
||||
|
||||
@@ -2542,7 +2542,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
var result = _libraryManager.GetItemIds(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(Episode).Name },
|
||||
IncludeItemTypes = new[] { nameof(Episode) },
|
||||
ParentIndexNumber = program.SeasonNumber.Value,
|
||||
IndexNumber = program.EpisodeNumber.Value,
|
||||
AncestorIds = seriesIds,
|
||||
|
||||
@@ -8,7 +8,9 @@ using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.MediaEncoding;
|
||||
using MediaBrowser.Model.Dto;
|
||||
@@ -25,6 +27,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
private readonly IServerApplicationPaths _appPaths;
|
||||
private readonly IJsonSerializer _json;
|
||||
private readonly TaskCompletionSource<bool> _taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
private readonly IServerConfigurationManager _serverConfigurationManager;
|
||||
|
||||
private bool _hasExited;
|
||||
private Stream _logFileStream;
|
||||
@@ -35,12 +38,14 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
ILogger logger,
|
||||
IMediaEncoder mediaEncoder,
|
||||
IServerApplicationPaths appPaths,
|
||||
IJsonSerializer json)
|
||||
IJsonSerializer json,
|
||||
IServerConfigurationManager serverConfigurationManager)
|
||||
{
|
||||
_logger = logger;
|
||||
_mediaEncoder = mediaEncoder;
|
||||
_appPaths = appPaths;
|
||||
_json = json;
|
||||
_serverConfigurationManager = serverConfigurationManager;
|
||||
}
|
||||
|
||||
private static bool CopySubtitles => false;
|
||||
@@ -179,15 +184,17 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
var outputParam = string.Empty;
|
||||
|
||||
var threads = EncodingHelper.GetNumberOfThreads(null, _serverConfigurationManager.GetEncodingOptions(), null);
|
||||
var commandLineArgs = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"-i \"{0}\" {2} -map_metadata -1 -threads 0 {3}{4}{5} -y \"{1}\"",
|
||||
"-i \"{0}\" {2} -map_metadata -1 -threads {6} {3}{4}{5} -y \"{1}\"",
|
||||
inputTempFile,
|
||||
targetFile,
|
||||
videoArgs,
|
||||
GetAudioArgs(mediaSource),
|
||||
subtitleArgs,
|
||||
outputParam);
|
||||
outputParam,
|
||||
threads);
|
||||
|
||||
return inputModifier + " " + commandLineArgs;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Threading.Tasks;
|
||||
using MediaBrowser.Common;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Model.Cryptography;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.LiveTv;
|
||||
@@ -33,17 +34,20 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly SemaphoreSlim _tokenSemaphore = new SemaphoreSlim(1, 1);
|
||||
private readonly IApplicationHost _appHost;
|
||||
private readonly ICryptoProvider _cryptoProvider;
|
||||
|
||||
public SchedulesDirect(
|
||||
ILogger<SchedulesDirect> logger,
|
||||
IJsonSerializer jsonSerializer,
|
||||
IHttpClientFactory httpClientFactory,
|
||||
IApplicationHost appHost)
|
||||
IApplicationHost appHost,
|
||||
ICryptoProvider cryptoProvider)
|
||||
{
|
||||
_logger = logger;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_appHost = appHost;
|
||||
_cryptoProvider = cryptoProvider;
|
||||
}
|
||||
|
||||
private string UserAgent => _appHost.ApplicationUserAgent;
|
||||
@@ -108,7 +112,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
options.Content = new StringContent(requestString, Encoding.UTF8, MediaTypeNames.Application.Json);
|
||||
options.Headers.TryAddWithoutValidation("token", token);
|
||||
using var response = await Send(options, true, info, cancellationToken).ConfigureAwait(false);
|
||||
await using var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
await using var responseStream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
var dailySchedules = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.Day>>(responseStream).ConfigureAwait(false);
|
||||
_logger.LogDebug("Found {ScheduleCount} programs on {ChannelID} ScheduleDirect", dailySchedules.Count, channelId);
|
||||
|
||||
@@ -119,7 +123,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
programRequestOptions.Content = new StringContent("[\"" + string.Join("\", \"", programsID) + "\"]", Encoding.UTF8, MediaTypeNames.Application.Json);
|
||||
|
||||
using var innerResponse = await Send(programRequestOptions, true, info, cancellationToken).ConfigureAwait(false);
|
||||
await using var innerResponseStream = await innerResponse.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
await using var innerResponseStream = await innerResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
var programDetails = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.ProgramDetails>>(innerResponseStream).ConfigureAwait(false);
|
||||
var programDict = programDetails.ToDictionary(p => p.programID, y => y);
|
||||
|
||||
@@ -257,7 +261,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
Id = newID,
|
||||
StartDate = startAt,
|
||||
EndDate = endAt,
|
||||
Name = details.titles[0].title120 ?? "Unkown",
|
||||
Name = details.titles[0].title120 ?? "Unknown",
|
||||
OfficialRating = null,
|
||||
CommunityRating = null,
|
||||
EpisodeTitle = episodeTitle,
|
||||
@@ -476,9 +480,8 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
try
|
||||
{
|
||||
using var innerResponse2 = await Send(message, true, info, cancellationToken).ConfigureAwait(false);
|
||||
await using var response = await innerResponse2.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
return await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.ShowImages>>(
|
||||
response).ConfigureAwait(false);
|
||||
await using var response = await innerResponse2.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
return await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.ShowImages>>(response).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -505,7 +508,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
try
|
||||
{
|
||||
using var httpResponse = await Send(options, false, info, cancellationToken).ConfigureAwait(false);
|
||||
await using var response = await httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
await using var response = await httpResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var root = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.Headends>>(response).ConfigureAwait(false);
|
||||
|
||||
@@ -538,6 +541,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
|
||||
private readonly ConcurrentDictionary<string, NameValuePair> _tokens = new ConcurrentDictionary<string, NameValuePair>();
|
||||
private DateTime _lastErrorResponse;
|
||||
|
||||
private async Task<string> GetToken(ListingsProviderInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
var username = info.Username;
|
||||
@@ -587,7 +591,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
savedToken.Value = DateTime.UtcNow.Ticks.ToString(CultureInfo.InvariantCulture);
|
||||
return result;
|
||||
}
|
||||
catch (HttpException ex)
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
if (ex.StatusCode.HasValue)
|
||||
{
|
||||
@@ -617,7 +621,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
{
|
||||
return await _httpClientFactory.CreateClient(NamedClient.Default).SendAsync(options, completionOption, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (HttpException ex)
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
_tokens.Clear();
|
||||
|
||||
@@ -642,10 +646,14 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
using var options = new HttpRequestMessage(HttpMethod.Post, ApiUrl + "/token");
|
||||
options.Content = new StringContent("{\"username\":\"" + username + "\",\"password\":\"" + password + "\"}", Encoding.UTF8, MediaTypeNames.Application.Json);
|
||||
var hashedPasswordBytes = _cryptoProvider.ComputeHash("SHA1", Encoding.ASCII.GetBytes(password), Array.Empty<byte>());
|
||||
// TODO: remove ToLower when Convert.ToHexString supports lowercase
|
||||
// Schedules Direct requires the hex to be lowercase
|
||||
string hashedPassword = Convert.ToHexString(hashedPasswordBytes).ToLowerInvariant();
|
||||
options.Content = new StringContent("{\"username\":\"" + username + "\",\"password\":\"" + hashedPassword + "\"}", Encoding.UTF8, MediaTypeNames.Application.Json);
|
||||
|
||||
using var response = await Send(options, false, null, cancellationToken).ConfigureAwait(false);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
var root = await _jsonSerializer.DeserializeFromStreamAsync<ScheduleDirect.Token>(stream).ConfigureAwait(false);
|
||||
if (root.message == "OK")
|
||||
{
|
||||
@@ -699,13 +707,13 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
try
|
||||
{
|
||||
using var httpResponse = await Send(options, false, null, cancellationToken).ConfigureAwait(false);
|
||||
await using var stream = await httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
await using var stream = await httpResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
using var response = httpResponse.Content;
|
||||
var root = await _jsonSerializer.DeserializeFromStreamAsync<ScheduleDirect.Lineups>(stream).ConfigureAwait(false);
|
||||
|
||||
return root.lineups.Any(i => string.Equals(info.ListingsId, i.lineup, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
catch (HttpException ex)
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
// Apparently we're supposed to swallow this
|
||||
if (ex.StatusCode.HasValue && ex.StatusCode.Value == HttpStatusCode.BadRequest)
|
||||
@@ -774,7 +782,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
var list = new List<ChannelInfo>();
|
||||
|
||||
using var httpResponse = await Send(options, true, info, cancellationToken).ConfigureAwait(false);
|
||||
await using var stream = await httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
await using var stream = await httpResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
var root = await _jsonSerializer.DeserializeFromStreamAsync<ScheduleDirect.Channel>(stream).ConfigureAwait(false);
|
||||
_logger.LogInformation("Found {ChannelCount} channels on the lineup on ScheduleDirect", root.map.Count);
|
||||
_logger.LogInformation("Mapping Stations to Channel");
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(cacheFile));
|
||||
|
||||
using var response = await _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(path, cancellationToken).ConfigureAwait(false);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
await using (var fileStream = new FileStream(cacheFile, FileMode.CreateNew))
|
||||
{
|
||||
await stream.CopyToAsync(fileStream, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
var librarySeries = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new string[] { typeof(Series).Name },
|
||||
IncludeItemTypes = new string[] { nameof(Series) },
|
||||
Name = seriesName,
|
||||
Limit = 1,
|
||||
ImageTypes = new ImageType[] { ImageType.Thumb },
|
||||
@@ -253,7 +253,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
var librarySeries = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new string[] { typeof(Series).Name },
|
||||
IncludeItemTypes = new string[] { nameof(Series) },
|
||||
Name = seriesName,
|
||||
Limit = 1,
|
||||
ImageTypes = new ImageType[] { ImageType.Thumb },
|
||||
@@ -296,7 +296,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
var program = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new string[] { typeof(Series).Name },
|
||||
IncludeItemTypes = new string[] { nameof(Series) },
|
||||
Name = seriesName,
|
||||
Limit = 1,
|
||||
ImageTypes = new ImageType[] { ImageType.Primary },
|
||||
@@ -307,7 +307,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
program = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new string[] { typeof(LiveTvProgram).Name },
|
||||
IncludeItemTypes = new string[] { nameof(LiveTvProgram) },
|
||||
ExternalSeriesId = programSeriesId,
|
||||
Limit = 1,
|
||||
ImageTypes = new ImageType[] { ImageType.Primary },
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
IsKids = query.IsKids,
|
||||
IsSports = query.IsSports,
|
||||
IsSeries = query.IsSeries,
|
||||
IncludeItemTypes = new[] { typeof(LiveTvChannel).Name },
|
||||
IncludeItemTypes = new[] { nameof(LiveTvChannel) },
|
||||
TopParentIds = new[] { topFolder.Id },
|
||||
IsFavorite = query.IsFavorite,
|
||||
IsLiked = query.IsLiked,
|
||||
@@ -808,7 +808,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
var internalQuery = new InternalItemsQuery(user)
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(LiveTvProgram).Name },
|
||||
IncludeItemTypes = new[] { nameof(LiveTvProgram) },
|
||||
MinEndDate = query.MinEndDate,
|
||||
MinStartDate = query.MinStartDate,
|
||||
MaxEndDate = query.MaxEndDate,
|
||||
@@ -872,7 +872,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
var internalQuery = new InternalItemsQuery(user)
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(LiveTvProgram).Name },
|
||||
IncludeItemTypes = new[] { nameof(LiveTvProgram) },
|
||||
IsAiring = query.IsAiring,
|
||||
HasAired = query.HasAired,
|
||||
IsNews = query.IsNews,
|
||||
@@ -1089,8 +1089,8 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
if (cleanDatabase)
|
||||
{
|
||||
CleanDatabaseInternal(newChannelIdList.ToArray(), new[] { typeof(LiveTvChannel).Name }, progress, cancellationToken);
|
||||
CleanDatabaseInternal(newProgramIdList.ToArray(), new[] { typeof(LiveTvProgram).Name }, progress, cancellationToken);
|
||||
CleanDatabaseInternal(newChannelIdList.ToArray(), new[] { nameof(LiveTvChannel) }, progress, cancellationToken);
|
||||
CleanDatabaseInternal(newProgramIdList.ToArray(), new[] { nameof(LiveTvProgram) }, progress, cancellationToken);
|
||||
}
|
||||
|
||||
var coreService = _services.OfType<EmbyTV.EmbyTV>().FirstOrDefault();
|
||||
@@ -1181,7 +1181,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
var existingPrograms = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new string[] { typeof(LiveTvProgram).Name },
|
||||
IncludeItemTypes = new string[] { nameof(LiveTvProgram) },
|
||||
ChannelIds = new Guid[] { currentChannel.Id },
|
||||
DtoOptions = new DtoOptions(true)
|
||||
}).Cast<LiveTvProgram>().ToDictionary(i => i.Id);
|
||||
@@ -1346,11 +1346,11 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
if (query.IsMovie.Value)
|
||||
{
|
||||
includeItemTypes.Add(typeof(Movie).Name);
|
||||
includeItemTypes.Add(nameof(Movie));
|
||||
}
|
||||
else
|
||||
{
|
||||
excludeItemTypes.Add(typeof(Movie).Name);
|
||||
excludeItemTypes.Add(nameof(Movie));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1358,11 +1358,11 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
if (query.IsSeries.Value)
|
||||
{
|
||||
includeItemTypes.Add(typeof(Episode).Name);
|
||||
includeItemTypes.Add(nameof(Episode));
|
||||
}
|
||||
else
|
||||
{
|
||||
excludeItemTypes.Add(typeof(Episode).Name);
|
||||
excludeItemTypes.Add(nameof(Episode));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1429,7 +1429,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
return result;
|
||||
}
|
||||
|
||||
public Task AddInfoToProgramDto(IReadOnlyCollection<(BaseItem, BaseItemDto)> tuples, ItemFields[] fields, User user = null)
|
||||
public Task AddInfoToProgramDto(IReadOnlyCollection<(BaseItem, BaseItemDto)> tuples, IReadOnlyList<ItemFields> fields, User user = null)
|
||||
{
|
||||
var programTuples = new List<Tuple<BaseItemDto, string, string>>();
|
||||
var hasChannelImage = fields.Contains(ItemFields.ChannelImage);
|
||||
@@ -1883,7 +1883,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
var programs = options.AddCurrentProgram ? _libraryManager.GetItemList(new InternalItemsQuery(user)
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(LiveTvProgram).Name },
|
||||
IncludeItemTypes = new[] { nameof(LiveTvProgram) },
|
||||
ChannelIds = channelIds,
|
||||
MaxStartDate = now,
|
||||
MinEndDate = now,
|
||||
@@ -2208,7 +2208,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
/// <returns>Task.</returns>
|
||||
public Task ResetTuner(string id, CancellationToken cancellationToken)
|
||||
{
|
||||
var parts = id.Split(new[] { '_' }, 2);
|
||||
var parts = id.Split('_', 2);
|
||||
|
||||
var service = _services.FirstOrDefault(i => string.Equals(i.GetType().FullName.GetMD5().ToString("N", CultureInfo.InvariantCulture), parts[0], StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
|
||||
@@ -76,7 +76,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
}
|
||||
|
||||
var list = sources.ToList();
|
||||
var serverUrl = await _appHost.GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
foreach (var source in list)
|
||||
{
|
||||
@@ -103,7 +102,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
// Dummy this up so that direct play checks can still run
|
||||
if (string.IsNullOrEmpty(source.Path) && source.Protocol == MediaProtocol.Http)
|
||||
{
|
||||
source.Path = serverUrl;
|
||||
source.Path = _appHost.GetSmartApiUrl(string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
var model = await GetModelInfo(info, false, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
using var response = await _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(model.LineupURL, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
var lineup = await JsonSerializer.DeserializeAsync<List<Channels>>(stream, cancellationToken: cancellationToken)
|
||||
.ConfigureAwait(false) ?? new List<Channels>();
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
using var response = await _httpClientFactory.CreateClient(NamedClient.Default)
|
||||
.GetAsync(string.Format(CultureInfo.InvariantCulture, "{0}/discover.json", GetApiUrl(info)), HttpCompletionOption.ResponseHeadersRead, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
var discoverResponse = await JsonSerializer.DeserializeAsync<DiscoverResponse>(stream, cancellationToken: cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
|
||||
return discoverResponse;
|
||||
}
|
||||
catch (HttpException ex)
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
if (!throwAllExceptions && ex.StatusCode.HasValue && ex.StatusCode.Value == HttpStatusCode.NotFound)
|
||||
{
|
||||
@@ -175,7 +175,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
using var response = await _httpClientFactory.CreateClient(NamedClient.Default)
|
||||
.GetAsync(string.Format(CultureInfo.InvariantCulture, "{0}/tuners.html", GetApiUrl(info)), HttpCompletionOption.ResponseHeadersRead, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
using var sr = new StreamReader(stream, System.Text.Encoding.UTF8);
|
||||
var tuners = new List<LiveTvTunerInfo>();
|
||||
while (!sr.EndOfStream)
|
||||
@@ -663,7 +663,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
var modelInfo = await GetModelInfo(info, true, CancellationToken.None).ConfigureAwait(false);
|
||||
info.DeviceId = modelInfo.DeviceID;
|
||||
}
|
||||
catch (HttpException ex)
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
if (ex.StatusCode.HasValue && ex.StatusCode.Value == System.Net.HttpStatusCode.NotFound)
|
||||
{
|
||||
|
||||
@@ -111,11 +111,11 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
|
||||
public async Task<bool> CheckTunerAvailability(IPAddress remoteIp, int tuner, CancellationToken cancellationToken)
|
||||
{
|
||||
using (var client = new TcpClient(new IPEndPoint(remoteIp, HdHomeRunPort)))
|
||||
using (var stream = client.GetStream())
|
||||
{
|
||||
return await CheckTunerAvailability(stream, tuner, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
using var client = new TcpClient();
|
||||
client.Connect(remoteIp, HdHomeRunPort);
|
||||
|
||||
using var stream = client.GetStream();
|
||||
return await CheckTunerAvailability(stream, tuner, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static async Task<bool> CheckTunerAvailability(NetworkStream stream, int tuner, CancellationToken cancellationToken)
|
||||
@@ -142,7 +142,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
{
|
||||
_remoteEndPoint = new IPEndPoint(remoteIp, HdHomeRunPort);
|
||||
|
||||
_tcpClient = new TcpClient(_remoteEndPoint);
|
||||
_tcpClient = new TcpClient();
|
||||
_tcpClient.Connect(_remoteEndPoint);
|
||||
|
||||
if (!_lockkey.HasValue)
|
||||
{
|
||||
@@ -221,30 +222,30 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
return;
|
||||
}
|
||||
|
||||
using (var tcpClient = new TcpClient(_remoteEndPoint))
|
||||
using (var stream = tcpClient.GetStream())
|
||||
{
|
||||
var commandList = commands.GetCommands();
|
||||
byte[] buffer = ArrayPool<byte>.Shared.Rent(8192);
|
||||
try
|
||||
{
|
||||
foreach (var command in commandList)
|
||||
{
|
||||
var channelMsg = CreateSetMessage(_activeTuner, command.Item1, command.Item2, _lockkey);
|
||||
await stream.WriteAsync(channelMsg, 0, channelMsg.Length, cancellationToken).ConfigureAwait(false);
|
||||
int receivedBytes = await stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false);
|
||||
using var tcpClient = new TcpClient();
|
||||
tcpClient.Connect(_remoteEndPoint);
|
||||
|
||||
// parse response to make sure it worked
|
||||
if (!ParseReturnMessage(buffer, receivedBytes, out _))
|
||||
{
|
||||
return;
|
||||
}
|
||||
using var stream = tcpClient.GetStream();
|
||||
var commandList = commands.GetCommands();
|
||||
byte[] buffer = ArrayPool<byte>.Shared.Rent(8192);
|
||||
try
|
||||
{
|
||||
foreach (var command in commandList)
|
||||
{
|
||||
var channelMsg = CreateSetMessage(_activeTuner, command.Item1, command.Item2, _lockkey);
|
||||
await stream.WriteAsync(channelMsg, 0, channelMsg.Length, cancellationToken).ConfigureAwait(false);
|
||||
int receivedBytes = await stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// parse response to make sure it worked
|
||||
if (!ParseReturnMessage(buffer, receivedBytes, out _))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ArrayPool<byte>.Shared.Return(buffer);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ArrayPool<byte>.Shared.Return(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -50,6 +52,26 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
EnableStreamSharing = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an unused UDP port number in the range specified.
|
||||
/// Temporarily placed here until future network PR merged.
|
||||
/// </summary>
|
||||
/// <param name="range">Upper and Lower boundary of ports to select.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
private static int GetUdpPortFromRange((int Min, int Max) range)
|
||||
{
|
||||
var properties = IPGlobalProperties.GetIPGlobalProperties();
|
||||
|
||||
// Get active udp listeners.
|
||||
var udpListenerPorts = properties.GetActiveUdpListeners()
|
||||
.Where(n => n.Port >= range.Min && n.Port <= range.Max)
|
||||
.Select(n => n.Port);
|
||||
|
||||
return Enumerable
|
||||
.Range(range.Min, range.Max)
|
||||
.FirstOrDefault(i => !udpListenerPorts.Contains(i));
|
||||
}
|
||||
|
||||
public override async Task Open(CancellationToken openCancellationToken)
|
||||
{
|
||||
LiveStreamCancellationTokenSource.Token.ThrowIfCancellationRequested();
|
||||
@@ -57,7 +79,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
var mediaSource = OriginalMediaSource;
|
||||
|
||||
var uri = new Uri(mediaSource.Path);
|
||||
var localPort = _networkManager.GetRandomUnusedUdpPort();
|
||||
// Temporary code to reduce PR size. This will be updated by a future network pr.
|
||||
var localPort = GetUdpPortFromRange((49152, 65535));
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(TempFilePath));
|
||||
|
||||
@@ -70,7 +93,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
try
|
||||
{
|
||||
await tcpClient.ConnectAsync(remoteAddress, HdHomerunManager.HdHomeRunPort).ConfigureAwait(false);
|
||||
localAddress = ((IPEndPoint)tcpClient.Client.RemoteEndPoint).Address;
|
||||
localAddress = ((IPEndPoint)tcpClient.Client.LocalEndPoint).Address;
|
||||
tcpClient.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -80,6 +103,10 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
}
|
||||
}
|
||||
|
||||
if (localAddress.IsIPv4MappedToIPv6) {
|
||||
localAddress = localAddress.MapToIPv4();
|
||||
}
|
||||
|
||||
var udpClient = new UdpClient(localPort, AddressFamily.InterNetwork);
|
||||
var hdHomerunManager = new HdHomerunManager();
|
||||
|
||||
@@ -110,12 +137,12 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
await StartStreaming(
|
||||
_ = StartStreaming(
|
||||
udpClient,
|
||||
hdHomerunManager,
|
||||
remoteAddress,
|
||||
taskCompletionSource,
|
||||
LiveStreamCancellationTokenSource.Token).ConfigureAwait(false);
|
||||
LiveStreamCancellationTokenSource.Token);
|
||||
|
||||
// OpenedMediaSource.Protocol = MediaProtocol.File;
|
||||
// OpenedMediaSource.Path = tempFile;
|
||||
@@ -131,33 +158,35 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
await taskCompletionSource.Task.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private Task StartStreaming(UdpClient udpClient, HdHomerunManager hdHomerunManager, IPAddress remoteAddress, TaskCompletionSource<bool> openTaskCompletionSource, CancellationToken cancellationToken)
|
||||
public string GetFilePath()
|
||||
{
|
||||
return Task.Run(async () =>
|
||||
{
|
||||
using (udpClient)
|
||||
using (hdHomerunManager)
|
||||
{
|
||||
try
|
||||
{
|
||||
await CopyTo(udpClient, TempFilePath, openTaskCompletionSource, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (OperationCanceledException ex)
|
||||
{
|
||||
Logger.LogInformation("HDHR UDP stream cancelled or timed out from {0}", remoteAddress);
|
||||
openTaskCompletionSource.TrySetException(ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex, "Error opening live stream:");
|
||||
openTaskCompletionSource.TrySetException(ex);
|
||||
}
|
||||
return TempFilePath;
|
||||
}
|
||||
|
||||
EnableStreamSharing = false;
|
||||
private async Task StartStreaming(UdpClient udpClient, HdHomerunManager hdHomerunManager, IPAddress remoteAddress, TaskCompletionSource<bool> openTaskCompletionSource, CancellationToken cancellationToken)
|
||||
{
|
||||
using (udpClient)
|
||||
using (hdHomerunManager)
|
||||
{
|
||||
try
|
||||
{
|
||||
await CopyTo(udpClient, TempFilePath, openTaskCompletionSource, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (OperationCanceledException ex)
|
||||
{
|
||||
Logger.LogInformation("HDHR UDP stream cancelled or timed out from {0}", remoteAddress);
|
||||
openTaskCompletionSource.TrySetException(ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex, "Error opening live stream:");
|
||||
openTaskCompletionSource.TrySetException(ex);
|
||||
}
|
||||
|
||||
await DeleteTempFiles(new List<string> { TempFilePath }).ConfigureAwait(false);
|
||||
});
|
||||
EnableStreamSharing = false;
|
||||
}
|
||||
|
||||
await DeleteTempFiles(new List<string> { TempFilePath }).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task CopyTo(UdpClient udpClient, string file, TaskCompletionSource<bool> openTaskCompletionSource, CancellationToken cancellationToken)
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
|
||||
if (string.IsNullOrEmpty(currentFile))
|
||||
{
|
||||
return (files.Last(), true);
|
||||
return (files[^1], true);
|
||||
}
|
||||
|
||||
var nextIndex = files.FindIndex(i => string.Equals(i, currentFile, StringComparison.OrdinalIgnoreCase)) + 1;
|
||||
|
||||
@@ -65,7 +65,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
{
|
||||
var channelIdPrefix = GetFullChannelIdPrefix(info);
|
||||
|
||||
return await new M3uParser(Logger, _httpClientFactory, _appHost).Parse(info.Url, channelIdPrefix, info.Id, cancellationToken).ConfigureAwait(false);
|
||||
return await new M3uParser(Logger, _httpClientFactory, _appHost)
|
||||
.Parse(info, channelIdPrefix, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public Task<List<LiveTvTunerInfo>> GetTunerInfos(CancellationToken cancellationToken)
|
||||
@@ -126,7 +128,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
|
||||
public async Task Validate(TunerHostInfo info)
|
||||
{
|
||||
using (var stream = await new M3uParser(Logger, _httpClientFactory, _appHost).GetListingsStream(info.Url, CancellationToken.None).ConfigureAwait(false))
|
||||
using (var stream = await new M3uParser(Logger, _httpClientFactory, _appHost).GetListingsStream(info, CancellationToken.None).ConfigureAwait(false))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Model.LiveTv;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
@@ -30,12 +31,12 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
_appHost = appHost;
|
||||
}
|
||||
|
||||
public async Task<List<ChannelInfo>> Parse(string url, string channelIdPrefix, string tunerHostId, CancellationToken cancellationToken)
|
||||
public async Task<List<ChannelInfo>> Parse(TunerHostInfo info, string channelIdPrefix, CancellationToken cancellationToken)
|
||||
{
|
||||
// Read the file and display it line by line.
|
||||
using (var reader = new StreamReader(await GetListingsStream(url, cancellationToken).ConfigureAwait(false)))
|
||||
using (var reader = new StreamReader(await GetListingsStream(info, cancellationToken).ConfigureAwait(false)))
|
||||
{
|
||||
return GetChannels(reader, channelIdPrefix, tunerHostId);
|
||||
return GetChannels(reader, channelIdPrefix, info.Id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,15 +49,24 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
}
|
||||
}
|
||||
|
||||
public Task<Stream> GetListingsStream(string url, CancellationToken cancellationToken)
|
||||
public async Task<Stream> GetListingsStream(TunerHostInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
if (url.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||
if (info.Url.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return _httpClientFactory.CreateClient(NamedClient.Default)
|
||||
.GetStreamAsync(url);
|
||||
using var requestMessage = new HttpRequestMessage(HttpMethod.Get, info.Url);
|
||||
if (!string.IsNullOrEmpty(info.UserAgent))
|
||||
{
|
||||
requestMessage.Headers.UserAgent.TryParseAdd(info.UserAgent);
|
||||
}
|
||||
|
||||
var response = await _httpClientFactory.CreateClient(NamedClient.Default)
|
||||
.SendAsync(requestMessage, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
response.EnsureSuccessStatusCode();
|
||||
return await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return Task.FromResult((Stream)File.OpenRead(url));
|
||||
return File.OpenRead(info.Url);
|
||||
}
|
||||
|
||||
private const string ExtInfPrefix = "#EXTINF:";
|
||||
@@ -153,7 +163,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
|
||||
private string GetChannelNumber(string extInf, Dictionary<string, string> attributes, string mediaUrl)
|
||||
{
|
||||
var nameParts = extInf.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var nameParts = extInf.Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||
var nameInExtInf = nameParts.Length > 1 ? nameParts[^1].AsSpan().Trim() : ReadOnlySpan<char>.Empty;
|
||||
|
||||
string numberString = null;
|
||||
@@ -187,7 +197,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
if (string.IsNullOrWhiteSpace(numberString))
|
||||
{
|
||||
// Using this as a fallback now as this leads to Problems with channels like "5 USA"
|
||||
// where 5 isnt ment to be the channel number
|
||||
// where 5 isn't ment to be the channel number
|
||||
// Check for channel number with the format from SatIp
|
||||
// #EXTINF:0,84. VOX Schweiz
|
||||
// #EXTINF:0,84.0 - VOX Schweiz
|
||||
@@ -263,8 +273,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
|
||||
private static string GetChannelName(string extInf, Dictionary<string, string> attributes)
|
||||
{
|
||||
var nameParts = extInf.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var nameInExtInf = nameParts.Length > 1 ? nameParts.Last().Trim() : null;
|
||||
var nameParts = extInf.Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||
var nameInExtInf = nameParts.Length > 1 ? nameParts[^1].Trim() : null;
|
||||
|
||||
// Check for channel number with the format from SatIp
|
||||
// #EXTINF:0,84. VOX Schweiz
|
||||
|
||||
@@ -55,14 +55,15 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
var typeName = GetType().Name;
|
||||
Logger.LogInformation("Opening " + typeName + " Live stream from {0}", url);
|
||||
|
||||
using var response = await _httpClientFactory.CreateClient(NamedClient.Default)
|
||||
// Response stream is disposed manually.
|
||||
var response = await _httpClientFactory.CreateClient(NamedClient.Default)
|
||||
.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, CancellationToken.None)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
var extension = "ts";
|
||||
var requiresRemux = false;
|
||||
|
||||
var contentType = response.Content.Headers.ContentType.ToString();
|
||||
var contentType = response.Content.Headers.ContentType?.ToString() ?? string.Empty;
|
||||
if (contentType.IndexOf("matroska", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
requiresRemux = true;
|
||||
@@ -121,6 +122,11 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
}
|
||||
}
|
||||
|
||||
public string GetFilePath()
|
||||
{
|
||||
return TempFilePath;
|
||||
}
|
||||
|
||||
private Task StartStreaming(HttpResponseMessage response, TaskCompletionSource<bool> openTaskCompletionSource, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.Run(async () =>
|
||||
@@ -129,7 +135,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
{
|
||||
Logger.LogInformation("Beginning {0} stream to {1}", GetType().Name, TempFilePath);
|
||||
using var message = response;
|
||||
await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
await using var fileStream = new FileStream(TempFilePath, FileMode.Create, FileAccess.Write, FileShare.Read);
|
||||
await StreamHelper.CopyToAsync(
|
||||
stream,
|
||||
|
||||
@@ -113,5 +113,10 @@
|
||||
"TasksChannelsCategory": "Internetové kanály",
|
||||
"TasksApplicationCategory": "Aplikace",
|
||||
"TasksLibraryCategory": "Knihovna",
|
||||
"TasksMaintenanceCategory": "Údržba"
|
||||
"TasksMaintenanceCategory": "Údržba",
|
||||
"TaskCleanActivityLogDescription": "Smazat záznamy o aktivitě, které jsou starší než zadaná doba.",
|
||||
"TaskCleanActivityLog": "Smazat záznam aktivity",
|
||||
"Undefined": "Nedefinované",
|
||||
"Forced": "Vynucené",
|
||||
"Default": "Výchozí"
|
||||
}
|
||||
|
||||
@@ -113,5 +113,10 @@
|
||||
"TasksChannelsCategory": "Internet Kanäle",
|
||||
"TasksApplicationCategory": "Anwendung",
|
||||
"TasksLibraryCategory": "Bibliothek",
|
||||
"TasksMaintenanceCategory": "Wartung"
|
||||
"TasksMaintenanceCategory": "Wartung",
|
||||
"TaskCleanActivityLogDescription": "Löscht Aktivitätsprotokolleinträge, die älter als das konfigurierte Alter sind.",
|
||||
"TaskCleanActivityLog": "Aktivitätsprotokoll aufräumen",
|
||||
"Undefined": "Undefiniert",
|
||||
"Forced": "Erzwungen",
|
||||
"Default": "Standard"
|
||||
}
|
||||
|
||||
@@ -113,5 +113,10 @@
|
||||
"TaskCleanTranscode": "Καθαρισμός Kαταλόγου Διακωδικοποιητή",
|
||||
"TaskUpdatePluginsDescription": "Κατεβάζει και εγκαθιστά ενημερώσεις για τις προσθήκες που έχουν ρυθμιστεί για αυτόματη ενημέρωση.",
|
||||
"TaskUpdatePlugins": "Ενημέρωση Προσθηκών",
|
||||
"TaskRefreshPeopleDescription": "Ενημερώνει μεταδεδομένα για ηθοποιούς και σκηνοθέτες στην βιβλιοθήκη των πολυμέσων σας."
|
||||
"TaskRefreshPeopleDescription": "Ενημερώνει μεταδεδομένα για ηθοποιούς και σκηνοθέτες στην βιβλιοθήκη των πολυμέσων σας.",
|
||||
"TaskCleanActivityLogDescription": "Διαγράφει καταχωρήσεις απο το αρχείο καταγραφής δραστηριοτήτων παλαιότερες από την ηλικία που έχει διαμορφωθεί.",
|
||||
"TaskCleanActivityLog": "Καθαρό Αρχείο Καταγραφής Δραστηριοτήτων",
|
||||
"Undefined": "Απροσδιόριστο",
|
||||
"Forced": "Εξαναγκασμένο",
|
||||
"Default": "Προεπιλογή"
|
||||
}
|
||||
|
||||
@@ -113,5 +113,7 @@
|
||||
"TasksChannelsCategory": "Internet Channels",
|
||||
"TasksApplicationCategory": "Application",
|
||||
"TasksLibraryCategory": "Library",
|
||||
"TasksMaintenanceCategory": "Maintenance"
|
||||
"TasksMaintenanceCategory": "Maintenance",
|
||||
"TaskCleanActivityLogDescription": "Deletes activity log entries older than the configured age.",
|
||||
"TaskCleanActivityLog": "Clean Activity Log"
|
||||
}
|
||||
|
||||
@@ -9,11 +9,13 @@
|
||||
"Channels": "Channels",
|
||||
"ChapterNameValue": "Chapter {0}",
|
||||
"Collections": "Collections",
|
||||
"Default": "Default",
|
||||
"DeviceOfflineWithName": "{0} has disconnected",
|
||||
"DeviceOnlineWithName": "{0} is connected",
|
||||
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
|
||||
"Favorites": "Favorites",
|
||||
"Folders": "Folders",
|
||||
"Forced": "Forced",
|
||||
"Genres": "Genres",
|
||||
"HeaderAlbumArtists": "Album Artists",
|
||||
"HeaderContinueWatching": "Continue Watching",
|
||||
@@ -77,6 +79,7 @@
|
||||
"Sync": "Sync",
|
||||
"System": "System",
|
||||
"TvShows": "TV Shows",
|
||||
"Undefined": "Undefined",
|
||||
"User": "User",
|
||||
"UserCreatedWithName": "User {0} has been created",
|
||||
"UserDeletedWithName": "User {0} has been deleted",
|
||||
@@ -95,6 +98,8 @@
|
||||
"TasksLibraryCategory": "Library",
|
||||
"TasksApplicationCategory": "Application",
|
||||
"TasksChannelsCategory": "Internet Channels",
|
||||
"TaskCleanActivityLog": "Clean Activity Log",
|
||||
"TaskCleanActivityLogDescription": "Deletes activity log entries older than the configured age.",
|
||||
"TaskCleanCache": "Clean Cache Directory",
|
||||
"TaskCleanCacheDescription": "Deletes cache files no longer needed by the system.",
|
||||
"TaskRefreshChapterImages": "Extract Chapter Images",
|
||||
|
||||
@@ -113,5 +113,10 @@
|
||||
"TasksChannelsCategory": "Canales de internet",
|
||||
"TasksApplicationCategory": "Aplicación",
|
||||
"TasksLibraryCategory": "Biblioteca",
|
||||
"TasksMaintenanceCategory": "Mantenimiento"
|
||||
"TasksMaintenanceCategory": "Mantenimiento",
|
||||
"TaskCleanActivityLogDescription": "Borrar log de actividades anteriores a la fecha establecida.",
|
||||
"TaskCleanActivityLog": "Borrar log de actividades",
|
||||
"Undefined": "Indefinido",
|
||||
"Forced": "Forzado",
|
||||
"Default": "Por Defecto"
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
"SubtitleDownloadFailureFromForItem": "Fallo de descarga de subtítulos desde {0} para {1}",
|
||||
"Sync": "Sincronizar",
|
||||
"System": "Sistema",
|
||||
"TvShows": "Programas de televisión",
|
||||
"TvShows": "Series",
|
||||
"User": "Usuario",
|
||||
"UserCreatedWithName": "El usuario {0} ha sido creado",
|
||||
"UserDeletedWithName": "El usuario {0} ha sido borrado",
|
||||
@@ -113,5 +113,10 @@
|
||||
"TaskRefreshChannels": "Actualizar canales",
|
||||
"TaskRefreshChannelsDescription": "Actualiza la información de los canales de internet.",
|
||||
"TaskDownloadMissingSubtitles": "Descargar los subtítulos que faltan",
|
||||
"TaskDownloadMissingSubtitlesDescription": "Busca en internet los subtítulos que falten en el contenido de tus bibliotecas, basándose en la configuración de los metadatos."
|
||||
"TaskDownloadMissingSubtitlesDescription": "Busca en internet los subtítulos que falten en el contenido de tus bibliotecas, basándose en la configuración de los metadatos.",
|
||||
"TaskCleanActivityLogDescription": "Elimina todos los registros de actividad anteriores a la fecha configurada.",
|
||||
"TaskCleanActivityLog": "Limpiar registro de actividad",
|
||||
"Undefined": "Indefinido",
|
||||
"Forced": "Forzado",
|
||||
"Default": "Predeterminado"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"HeaderLiveTV": "Live-TV",
|
||||
"NewVersionIsAvailable": "Uusi versio Jellyfin palvelimesta on ladattavissa.",
|
||||
"NameSeasonUnknown": "Tuntematon Kausi",
|
||||
"NameSeasonUnknown": "Tuntematon kausi",
|
||||
"NameSeasonNumber": "Kausi {0}",
|
||||
"NameInstallFailed": "{0} asennus epäonnistui",
|
||||
"MusicVideos": "Musiikkivideot",
|
||||
@@ -19,23 +19,23 @@
|
||||
"ItemAddedWithName": "{0} lisättiin kirjastoon",
|
||||
"Inherit": "Periytyä",
|
||||
"HomeVideos": "Kotivideot",
|
||||
"HeaderRecordingGroups": "Nauhoiteryhmät",
|
||||
"HeaderRecordingGroups": "Tallennusryhmät",
|
||||
"HeaderNextUp": "Seuraavaksi",
|
||||
"HeaderFavoriteSongs": "Lempikappaleet",
|
||||
"HeaderFavoriteShows": "Lempisarjat",
|
||||
"HeaderFavoriteEpisodes": "Lempijaksot",
|
||||
"HeaderFavoriteArtists": "Lempiartistit",
|
||||
"HeaderFavoriteAlbums": "Lempialbumit",
|
||||
"HeaderFavoriteSongs": "Suosikkikappaleet",
|
||||
"HeaderFavoriteShows": "Suosikkisarjat",
|
||||
"HeaderFavoriteEpisodes": "Suosikkijaksot",
|
||||
"HeaderFavoriteArtists": "Suosikkiartistit",
|
||||
"HeaderFavoriteAlbums": "Suosikkialbumit",
|
||||
"HeaderContinueWatching": "Jatka katsomista",
|
||||
"HeaderAlbumArtists": "Albumin esittäjä",
|
||||
"HeaderAlbumArtists": "Albumin artistit",
|
||||
"Genres": "Tyylilajit",
|
||||
"Folders": "Kansiot",
|
||||
"Favorites": "Suosikit",
|
||||
"FailedLoginAttemptWithUserName": "Kirjautuminen epäonnistui kohteesta {0}",
|
||||
"DeviceOnlineWithName": "{0} on yhdistetty",
|
||||
"DeviceOfflineWithName": "{0} on katkaissut yhteytensä",
|
||||
"DeviceOfflineWithName": "{0} yhteys on katkaistu",
|
||||
"Collections": "Kokoelmat",
|
||||
"ChapterNameValue": "Luku: {0}",
|
||||
"ChapterNameValue": "Jakso: {0}",
|
||||
"Channels": "Kanavat",
|
||||
"CameraImageUploadedFrom": "Uusi kamerakuva on ladattu {0}",
|
||||
"Books": "Kirjat",
|
||||
@@ -61,25 +61,25 @@
|
||||
"UserPolicyUpdatedWithName": "Käyttöoikeudet päivitetty käyttäjälle {0}",
|
||||
"UserPasswordChangedWithName": "Salasana vaihdettu käyttäjälle {0}",
|
||||
"UserOnlineFromDevice": "{0} on paikalla osoitteesta {1}",
|
||||
"UserOfflineFromDevice": "{0} yhteys katkaistu {1}",
|
||||
"UserOfflineFromDevice": "{0} yhteys katkaistu kohteesta {1}",
|
||||
"UserLockedOutWithName": "Käyttäjä {0} lukittu",
|
||||
"UserDownloadingItemWithValues": "{0} lataa {1}",
|
||||
"UserDeletedWithName": "Käyttäjä {0} poistettu",
|
||||
"UserCreatedWithName": "Käyttäjä {0} luotu",
|
||||
"TvShows": "TV-sarjat",
|
||||
"TvShows": "TV-ohjelmat",
|
||||
"Sync": "Synkronoi",
|
||||
"SubtitleDownloadFailureFromForItem": "Tekstitysten lataus ({0} -> {1}) epäonnistui //this string would have to be generated for each provider and movie because of finnish cases, sorry",
|
||||
"StartupEmbyServerIsLoading": "Jellyfin palvelin latautuu. Kokeile hetken kuluttua uudelleen.",
|
||||
"SubtitleDownloadFailureFromForItem": "Tekstitystä ei voitu ladata osoitteesta {0} kohteelle {1}",
|
||||
"StartupEmbyServerIsLoading": "Jellyfin palvelin latautuu. Yritä hetken kuluttua uudelleen.",
|
||||
"Songs": "Kappaleet",
|
||||
"Shows": "Sarjat",
|
||||
"ServerNameNeedsToBeRestarted": "{0} täytyy käynnistää uudelleen",
|
||||
"Shows": "Ohjelmat",
|
||||
"ServerNameNeedsToBeRestarted": "{0} on käynnistettävä uudelleen",
|
||||
"ProviderValue": "Tarjoaja: {0}",
|
||||
"Plugin": "Liitännäinen",
|
||||
"NotificationOptionVideoPlaybackStopped": "Videon toisto pysäytetty",
|
||||
"NotificationOptionVideoPlayback": "Videota toistetaan",
|
||||
"NotificationOptionUserLockedOut": "Käyttäjä kirjautui ulos",
|
||||
"NotificationOptionTaskFailed": "Ajastettu tehtävä epäonnistui",
|
||||
"NotificationOptionServerRestartRequired": "Palvelin pitää käynnistää uudelleen",
|
||||
"NotificationOptionServerRestartRequired": "Palvelin on käynnistettävä uudelleen",
|
||||
"NotificationOptionPluginUpdateInstalled": "Liitännäinen päivitetty",
|
||||
"NotificationOptionPluginUninstalled": "Liitännäinen poistettu",
|
||||
"NotificationOptionPluginInstalled": "Liitännäinen asennettu",
|
||||
@@ -104,13 +104,15 @@
|
||||
"TaskRefreshPeople": "Päivitä henkilöt",
|
||||
"TaskCleanLogsDescription": "Poistaa lokitiedostot jotka ovat yli {0} päivää vanhoja.",
|
||||
"TaskCleanLogs": "Puhdista lokihakemisto",
|
||||
"TaskRefreshLibraryDescription": "Skannaa mediakirjastosi uusien tiedostojen varalle, sekä virkistää metatiedot.",
|
||||
"TaskRefreshLibraryDescription": "Skannaa mediakirjastosi uudet tiedostot ja päivittää metatiedot.",
|
||||
"TaskRefreshLibrary": "Skannaa mediakirjasto",
|
||||
"TaskRefreshChapterImagesDescription": "Luo pienoiskuvat videoille joissa on lukuja.",
|
||||
"TaskRefreshChapterImages": "Eristä lukujen kuvat",
|
||||
"TaskRefreshChapterImagesDescription": "Luo pienoiskuvat videoille joissa on jaksoja.",
|
||||
"TaskRefreshChapterImages": "Pura jakson kuvat",
|
||||
"TaskCleanCacheDescription": "Poistaa järjestelmälle tarpeettomat väliaikaistiedostot.",
|
||||
"TaskCleanCache": "Tyhjennä välimuisti-hakemisto",
|
||||
"TasksChannelsCategory": "Internet kanavat",
|
||||
"TasksApplicationCategory": "Sovellus",
|
||||
"TasksLibraryCategory": "Kirjasto"
|
||||
"TasksLibraryCategory": "Kirjasto",
|
||||
"Forced": "Pakotettu",
|
||||
"Default": "Oletus"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"VersionNumber": "Bersyon {0}",
|
||||
"ValueSpecialEpisodeName": "Espesyal - {0}",
|
||||
"ValueHasBeenAddedToLibrary": "Naidagdag na ang {0} sa iyong media library",
|
||||
"ValueHasBeenAddedToLibrary": "Naidagdag na ang {0} sa iyong librerya ng medya",
|
||||
"UserStoppedPlayingItemWithValues": "Natapos ni {0} ang {1} sa {2}",
|
||||
"UserStartedPlayingItemWithValues": "Si {0} ay nagplaplay ng {1} sa {2}",
|
||||
"UserPolicyUpdatedWithName": "Ang user policy ay naiupdate para kay {0}",
|
||||
@@ -61,8 +61,8 @@
|
||||
"Latest": "Pinakabago",
|
||||
"LabelRunningTimeValue": "Oras: {0}",
|
||||
"LabelIpAddressValue": "Ang IP Address ay {0}",
|
||||
"ItemRemovedWithName": "Naitanggal ang {0} sa library",
|
||||
"ItemAddedWithName": "Naidagdag ang {0} sa library",
|
||||
"ItemRemovedWithName": "Naitanggal ang {0} sa librerya",
|
||||
"ItemAddedWithName": "Naidagdag ang {0} sa librerya",
|
||||
"Inherit": "Manahin",
|
||||
"HeaderRecordingGroups": "Pagtatalang Grupo",
|
||||
"HeaderNextUp": "Susunod",
|
||||
@@ -90,12 +90,29 @@
|
||||
"Application": "Aplikasyon",
|
||||
"AppDeviceValues": "Aplikasyon: {0}, Aparato: {1}",
|
||||
"Albums": "Albums",
|
||||
"TaskRefreshLibrary": "Suriin ang nasa librerya",
|
||||
"TaskRefreshChapterImagesDescription": "Gumawa ng larawan para sa mga pelikula na may kabanata",
|
||||
"TaskRefreshLibrary": "Suriin and Librerya ng Medya",
|
||||
"TaskRefreshChapterImagesDescription": "Gumawa ng larawan para sa mga pelikula na may kabanata.",
|
||||
"TaskRefreshChapterImages": "Kunin ang mga larawan ng kabanata",
|
||||
"TaskCleanCacheDescription": "Tanggalin ang mga cache file na hindi na kailangan ng systema.",
|
||||
"TasksChannelsCategory": "Palabas sa internet",
|
||||
"TasksLibraryCategory": "Librerya",
|
||||
"TasksMaintenanceCategory": "Pagpapanatili",
|
||||
"HomeVideos": "Sariling pelikula"
|
||||
"HomeVideos": "Sariling pelikula",
|
||||
"TaskRefreshPeopleDescription": "Ini-update ang metadata para sa mga aktor at direktor sa iyong librerya ng medya.",
|
||||
"TaskRefreshPeople": "I-refresh ang Tauhan",
|
||||
"TaskDownloadMissingSubtitlesDescription": "Hinahanap sa internet ang mga nawawalang subtiles base sa metadata configuration.",
|
||||
"TaskDownloadMissingSubtitles": "I-download and nawawalang subtitles",
|
||||
"TaskRefreshChannelsDescription": "Ni-rerefresh ang impormasyon sa internet channels.",
|
||||
"TaskRefreshChannels": "I-refresh ang Channels",
|
||||
"TaskCleanTranscodeDescription": "Binubura ang transcode files na mas matanda ng isang araw.",
|
||||
"TaskUpdatePluginsDescription": "Nag download at install ng updates sa plugins na naka configure para sa automatikong pag update.",
|
||||
"TaskUpdatePlugins": "I-update ang Plugins",
|
||||
"TaskCleanLogsDescription": "Binubura and files ng talaan na mas mantanda ng {0} araw.",
|
||||
"TaskCleanTranscode": "Linisin and Direktoryo ng Transcode",
|
||||
"TaskCleanLogs": "Linisin and Direktoryo ng Talaan",
|
||||
"TaskRefreshLibraryDescription": "Sinusuri ang iyong librerya ng medya para sa bagong files at irefresh ang metadata.",
|
||||
"TaskCleanCache": "Linisin and Direktoryo ng Cache",
|
||||
"TasksApplicationCategory": "Application",
|
||||
"TaskCleanActivityLog": "Linisin ang Tala ng Aktibidad",
|
||||
"TaskCleanActivityLogDescription": "Tanggalin ang mga tala ng aktibidad na mas matanda sa naka configure na edad."
|
||||
}
|
||||
|
||||
@@ -93,8 +93,8 @@
|
||||
"ValueSpecialEpisodeName": "Spécial - {0}",
|
||||
"VersionNumber": "Version {0}",
|
||||
"TasksChannelsCategory": "Chaines en ligne",
|
||||
"TaskDownloadMissingSubtitlesDescription": "Cherche les sous-titres manquant sur internet en se basant sur la configuration des métadonnées.",
|
||||
"TaskDownloadMissingSubtitles": "Télécharger les sous-titres manquant",
|
||||
"TaskDownloadMissingSubtitlesDescription": "Recherche les sous-titres manquants sur internet en se basant sur la configuration des métadonnées.",
|
||||
"TaskDownloadMissingSubtitles": "Télécharger les sous-titres manquants",
|
||||
"TaskRefreshChannelsDescription": "Rafraîchit les informations des chaines en ligne.",
|
||||
"TaskRefreshChannels": "Rafraîchir les chaines",
|
||||
"TaskCleanTranscodeDescription": "Supprime les fichiers transcodés de plus d'un jour.",
|
||||
@@ -113,5 +113,10 @@
|
||||
"TaskCleanCache": "Vider le répertoire cache",
|
||||
"TasksApplicationCategory": "Application",
|
||||
"TasksLibraryCategory": "Bibliothèque",
|
||||
"TasksMaintenanceCategory": "Maintenance"
|
||||
"TasksMaintenanceCategory": "Maintenance",
|
||||
"TaskCleanActivityLogDescription": "Supprime les entrées du journal d'activité antérieures à l'âge configuré.",
|
||||
"TaskCleanActivityLog": "Nettoyer le journal d'activité",
|
||||
"Undefined": "Non défini",
|
||||
"Forced": "Forcé",
|
||||
"Default": "Par défaut"
|
||||
}
|
||||
|
||||
@@ -113,5 +113,10 @@
|
||||
"TaskRefreshChannels": "רענן ערוץ",
|
||||
"TaskCleanTranscodeDescription": "מחק קבצי transcode שנוצרו מלפני יותר מיום.",
|
||||
"TaskCleanTranscode": "נקה תקיית Transcode",
|
||||
"TaskUpdatePluginsDescription": "הורד והתקן עדכונים עבור תוספים שמוגדרים לעדכון אוטומטי."
|
||||
"TaskUpdatePluginsDescription": "הורד והתקן עדכונים עבור תוספים שמוגדרים לעדכון אוטומטי.",
|
||||
"TaskCleanActivityLogDescription": "מחק רשומת פעילות הישנה יותר מהגיל המוגדר.",
|
||||
"TaskCleanActivityLog": "נקה רשומת פעילות",
|
||||
"Undefined": "לא מוגדר",
|
||||
"Forced": "כפוי",
|
||||
"Default": "ברירת מחדל"
|
||||
}
|
||||
|
||||
3
Emby.Server.Implementations/Localization/Core/hi.json
Normal file
3
Emby.Server.Implementations/Localization/Core/hi.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"Albums": "आल्बुम्"
|
||||
}
|
||||
@@ -5,13 +5,13 @@
|
||||
"Artists": "Izvođači",
|
||||
"AuthenticationSucceededWithUserName": "{0} uspješno ovjerena",
|
||||
"Books": "Knjige",
|
||||
"CameraImageUploadedFrom": "Nova fotografija sa kamere je uploadana iz {0}",
|
||||
"CameraImageUploadedFrom": "Nova fotografija sa kamere je učitana iz {0}",
|
||||
"Channels": "Kanali",
|
||||
"ChapterNameValue": "Poglavlje {0}",
|
||||
"Collections": "Kolekcije",
|
||||
"DeviceOfflineWithName": "{0} se odspojilo",
|
||||
"DeviceOnlineWithName": "{0} je spojeno",
|
||||
"FailedLoginAttemptWithUserName": "Neuspjeli pokušaj prijave za {0}",
|
||||
"DeviceOfflineWithName": "{0} je prekinuo vezu",
|
||||
"DeviceOnlineWithName": "{0} je povezan",
|
||||
"FailedLoginAttemptWithUserName": "Neuspjeli pokušaj prijave od {0}",
|
||||
"Favorites": "Favoriti",
|
||||
"Folders": "Mape",
|
||||
"Genres": "Žanrovi",
|
||||
@@ -23,95 +23,97 @@
|
||||
"HeaderFavoriteShows": "Omiljene serije",
|
||||
"HeaderFavoriteSongs": "Omiljene pjesme",
|
||||
"HeaderLiveTV": "TV uživo",
|
||||
"HeaderNextUp": "Sljedeće je",
|
||||
"HeaderNextUp": "Slijedi",
|
||||
"HeaderRecordingGroups": "Grupa snimka",
|
||||
"HomeVideos": "Kućni videi",
|
||||
"HomeVideos": "Kućni video",
|
||||
"Inherit": "Naslijedi",
|
||||
"ItemAddedWithName": "{0} je dodano u biblioteku",
|
||||
"ItemRemovedWithName": "{0} je uklonjen iz biblioteke",
|
||||
"ItemRemovedWithName": "{0} je uklonjeno iz biblioteke",
|
||||
"LabelIpAddressValue": "IP adresa: {0}",
|
||||
"LabelRunningTimeValue": "Vrijeme rada: {0}",
|
||||
"Latest": "Najnovije",
|
||||
"MessageApplicationUpdated": "Jellyfin Server je ažuriran",
|
||||
"MessageApplicationUpdatedTo": "Jellyfin Server je ažuriran na {0}",
|
||||
"MessageNamedServerConfigurationUpdatedWithValue": "Odjeljak postavka servera {0} je ažuriran",
|
||||
"MessageServerConfigurationUpdated": "Postavke servera su ažurirane",
|
||||
"MessageApplicationUpdated": "Jellyfin server je ažuriran",
|
||||
"MessageApplicationUpdatedTo": "Jellyfin server je ažuriran na {0}",
|
||||
"MessageNamedServerConfigurationUpdatedWithValue": "Dio konfiguracije servera {0} je ažuriran",
|
||||
"MessageServerConfigurationUpdated": "Konfiguracija servera je ažurirana",
|
||||
"MixedContent": "Miješani sadržaj",
|
||||
"Movies": "Filmovi",
|
||||
"Music": "Glazba",
|
||||
"MusicVideos": "Glazbeni spotovi",
|
||||
"NameInstallFailed": "{0} neuspješnih instalacija",
|
||||
"NameSeasonNumber": "Sezona {0}",
|
||||
"NameSeasonUnknown": "Nepoznata sezona",
|
||||
"NameSeasonUnknown": "Sezona nepoznata",
|
||||
"NewVersionIsAvailable": "Nova verzija Jellyfin servera je dostupna za preuzimanje.",
|
||||
"NotificationOptionApplicationUpdateAvailable": "Dostupno ažuriranje aplikacije",
|
||||
"NotificationOptionApplicationUpdateInstalled": "Instalirano ažuriranje aplikacije",
|
||||
"NotificationOptionAudioPlayback": "Reprodukcija glazbe započeta",
|
||||
"NotificationOptionAudioPlaybackStopped": "Reprodukcija audiozapisa je zaustavljena",
|
||||
"NotificationOptionCameraImageUploaded": "Slike kamere preuzete",
|
||||
"NotificationOptionInstallationFailed": "Instalacija neuspješna",
|
||||
"NotificationOptionNewLibraryContent": "Novi sadržaj je dodan",
|
||||
"NotificationOptionPluginError": "Dodatak otkazao",
|
||||
"NotificationOptionApplicationUpdateAvailable": "Dostupno je ažuriranje aplikacije",
|
||||
"NotificationOptionApplicationUpdateInstalled": "Instalirano je ažuriranje aplikacije",
|
||||
"NotificationOptionAudioPlayback": "Reprodukcija glazbe započela",
|
||||
"NotificationOptionAudioPlaybackStopped": "Reprodukcija glazbe zaustavljena",
|
||||
"NotificationOptionCameraImageUploaded": "Slika s kamere učitana",
|
||||
"NotificationOptionInstallationFailed": "Instalacija nije uspjela",
|
||||
"NotificationOptionNewLibraryContent": "Novi sadržaj dodan",
|
||||
"NotificationOptionPluginError": "Dodatak zakazao",
|
||||
"NotificationOptionPluginInstalled": "Dodatak instaliran",
|
||||
"NotificationOptionPluginUninstalled": "Dodatak uklonjen",
|
||||
"NotificationOptionPluginUpdateInstalled": "Instalirano ažuriranje za dodatak",
|
||||
"NotificationOptionServerRestartRequired": "Potrebno ponovo pokretanje servera",
|
||||
"NotificationOptionTaskFailed": "Zakazan zadatak nije izvršen",
|
||||
"NotificationOptionPluginUninstalled": "Dodatak deinstaliran",
|
||||
"NotificationOptionPluginUpdateInstalled": "Instalirano ažuriranje dodatka",
|
||||
"NotificationOptionServerRestartRequired": "Ponovno pokrenite server",
|
||||
"NotificationOptionTaskFailed": "Greška zakazanog zadatka",
|
||||
"NotificationOptionUserLockedOut": "Korisnik zaključan",
|
||||
"NotificationOptionVideoPlayback": "Reprodukcija videa započeta",
|
||||
"NotificationOptionVideoPlaybackStopped": "Reprodukcija videozapisa je zaustavljena",
|
||||
"Photos": "Slike",
|
||||
"Playlists": "Popis za reprodukciju",
|
||||
"NotificationOptionVideoPlayback": "Reprodukcija videa započela",
|
||||
"NotificationOptionVideoPlaybackStopped": "Reprodukcija videa zaustavljena",
|
||||
"Photos": "Fotografije",
|
||||
"Playlists": "Popisi za reprodukciju",
|
||||
"Plugin": "Dodatak",
|
||||
"PluginInstalledWithName": "{0} je instalirano",
|
||||
"PluginUninstalledWithName": "{0} je deinstalirano",
|
||||
"PluginUpdatedWithName": "{0} je ažurirano",
|
||||
"ProviderValue": "Pružitelj: {0}",
|
||||
"ProviderValue": "Pružatelj: {0}",
|
||||
"ScheduledTaskFailedWithName": "{0} neuspjelo",
|
||||
"ScheduledTaskStartedWithName": "{0} pokrenuto",
|
||||
"ServerNameNeedsToBeRestarted": "{0} treba biti ponovno pokrenuto",
|
||||
"ServerNameNeedsToBeRestarted": "{0} treba ponovno pokrenuti",
|
||||
"Shows": "Serije",
|
||||
"Songs": "Pjesme",
|
||||
"StartupEmbyServerIsLoading": "Jellyfin Server se učitava. Pokušajte ponovo kasnije.",
|
||||
"StartupEmbyServerIsLoading": "Jellyfin server se učitava. Pokušajte ponovo uskoro.",
|
||||
"SubtitleDownloadFailureForItem": "Titlovi prijevoda nisu preuzeti za {0}",
|
||||
"SubtitleDownloadFailureFromForItem": "Prijevodi nisu uspješno preuzeti {0} od {1}",
|
||||
"Sync": "Sink.",
|
||||
"System": "Sistem",
|
||||
"SubtitleDownloadFailureFromForItem": "Prijevod nije uspješno preuzet od {0} za {1}",
|
||||
"Sync": "Sinkronizacija",
|
||||
"System": "Sustav",
|
||||
"TvShows": "Serije",
|
||||
"User": "Korisnik",
|
||||
"UserCreatedWithName": "Korisnik {0} je stvoren",
|
||||
"UserCreatedWithName": "Korisnik {0} je kreiran",
|
||||
"UserDeletedWithName": "Korisnik {0} je obrisan",
|
||||
"UserDownloadingItemWithValues": "{0} se preuzima {1}",
|
||||
"UserDownloadingItemWithValues": "{0} preuzima {1}",
|
||||
"UserLockedOutWithName": "Korisnik {0} je zaključan",
|
||||
"UserOfflineFromDevice": "{0} se odspojilo od {1}",
|
||||
"UserOnlineFromDevice": "{0} je online od {1}",
|
||||
"UserOfflineFromDevice": "{0} prekinuo vezu od {1}",
|
||||
"UserOnlineFromDevice": "{0} povezan od {1}",
|
||||
"UserPasswordChangedWithName": "Lozinka je promijenjena za korisnika {0}",
|
||||
"UserPolicyUpdatedWithName": "Pravila za korisnika su ažurirana za {0}",
|
||||
"UserStartedPlayingItemWithValues": "{0} je pokrenuo {1}",
|
||||
"UserStoppedPlayingItemWithValues": "{0} je zaustavio {1}",
|
||||
"UserPolicyUpdatedWithName": "Pravila za korisnika ažurirana su za {0}",
|
||||
"UserStartedPlayingItemWithValues": "{0} je pokrenuo reprodukciju {1} na {2}",
|
||||
"UserStoppedPlayingItemWithValues": "{0} je završio reprodukciju {1} na {2}",
|
||||
"ValueHasBeenAddedToLibrary": "{0} je dodano u medijsku biblioteku",
|
||||
"ValueSpecialEpisodeName": "Specijal - {0}",
|
||||
"ValueSpecialEpisodeName": "Posebno - {0}",
|
||||
"VersionNumber": "Verzija {0}",
|
||||
"TaskRefreshLibraryDescription": "Skenira vašu medijsku knjižnicu sa novim datotekama i osvježuje metapodatke.",
|
||||
"TaskRefreshLibrary": "Skeniraj medijsku knjižnicu",
|
||||
"TaskRefreshChapterImagesDescription": "Stvara sličice za videozapise koji imaju poglavlja.",
|
||||
"TaskRefreshChapterImages": "Raspakiraj slike poglavlja",
|
||||
"TaskCleanCacheDescription": "Briše priručne datoteke nepotrebne za sistem.",
|
||||
"TaskCleanCache": "Očisti priručnu memoriju",
|
||||
"TaskRefreshLibraryDescription": "Skenira medijsku biblioteku radi novih datoteka i osvježava metapodatke.",
|
||||
"TaskRefreshLibrary": "Skeniraj medijsku biblioteku",
|
||||
"TaskRefreshChapterImagesDescription": "Kreira sličice za videozapise koji imaju poglavlja.",
|
||||
"TaskRefreshChapterImages": "Izdvoji slike poglavlja",
|
||||
"TaskCleanCacheDescription": "Briše nepotrebne datoteke iz predmemorije.",
|
||||
"TaskCleanCache": "Očisti mapu predmemorije",
|
||||
"TasksApplicationCategory": "Aplikacija",
|
||||
"TasksMaintenanceCategory": "Održavanje",
|
||||
"TaskDownloadMissingSubtitlesDescription": "Pretraživanje interneta za prijevodima koji nedostaju bazirano na konfiguraciji meta podataka.",
|
||||
"TaskDownloadMissingSubtitles": "Preuzimanje prijevoda koji nedostaju",
|
||||
"TaskRefreshChannelsDescription": "Osvježava informacije o internet kanalima.",
|
||||
"TaskDownloadMissingSubtitlesDescription": "Pretraži Internet za prijevodima koji nedostaju prema konfiguraciji metapodataka.",
|
||||
"TaskDownloadMissingSubtitles": "Preuzmi prijevod koji nedostaje",
|
||||
"TaskRefreshChannelsDescription": "Osvježava informacije Internet kanala.",
|
||||
"TaskRefreshChannels": "Osvježi kanale",
|
||||
"TaskCleanTranscodeDescription": "Briše transkodirane fajlove starije od jednog dana.",
|
||||
"TaskCleanTranscode": "Očisti direktorij za transkodiranje",
|
||||
"TaskUpdatePluginsDescription": "Preuzima i instalira ažuriranja za dodatke koji su podešeni da se ažuriraju automatski.",
|
||||
"TaskCleanTranscodeDescription": "Briše transkodirane datoteke starije od jednog dana.",
|
||||
"TaskCleanTranscode": "Očisti mapu transkodiranja",
|
||||
"TaskUpdatePluginsDescription": "Preuzima i instalira ažuriranja za dodatke koji su konfigurirani da se ažuriraju automatski.",
|
||||
"TaskUpdatePlugins": "Ažuriraj dodatke",
|
||||
"TaskRefreshPeopleDescription": "Ažurira meta podatke za glumce i redatelje u vašoj medijskoj biblioteci.",
|
||||
"TaskRefreshPeople": "Osvježi ljude",
|
||||
"TaskCleanLogsDescription": "Briši logove koji su stariji od {0} dana.",
|
||||
"TaskCleanLogs": "Očisti direktorij sa logovima",
|
||||
"TaskRefreshPeopleDescription": "Ažurira metapodatke za glumce i redatelje u medijskoj biblioteci.",
|
||||
"TaskRefreshPeople": "Osvježi osobe",
|
||||
"TaskCleanLogsDescription": "Briše zapise dnevnika koji su stariji od {0} dana.",
|
||||
"TaskCleanLogs": "Očisti mapu dnevnika zapisa",
|
||||
"TasksChannelsCategory": "Internet kanali",
|
||||
"TasksLibraryCategory": "Biblioteka"
|
||||
"TasksLibraryCategory": "Biblioteka",
|
||||
"TaskCleanActivityLogDescription": "Briše zapise dnevnika aktivnosti starije od navedenog vremena.",
|
||||
"TaskCleanActivityLog": "Očisti dnevnik aktivnosti"
|
||||
}
|
||||
|
||||
@@ -113,5 +113,10 @@
|
||||
"TaskDownloadMissingSubtitles": "Hiányzó feliratok letöltése",
|
||||
"TaskRefreshChannelsDescription": "Frissíti az internetes csatornák adatait.",
|
||||
"TaskRefreshChannels": "Csatornák frissítése",
|
||||
"TaskCleanTranscodeDescription": "Törli az egy napnál régebbi átkódolási fájlokat."
|
||||
"TaskCleanTranscodeDescription": "Törli az egy napnál régebbi átkódolási fájlokat.",
|
||||
"TaskCleanActivityLogDescription": "A beállítottnál korábbi bejegyzések törlése a tevékenységnaplóból.",
|
||||
"TaskCleanActivityLog": "Tevékenységnapló törlése",
|
||||
"Undefined": "Meghatározatlan",
|
||||
"Forced": "Kényszerített",
|
||||
"Default": "Alapértelmezett"
|
||||
}
|
||||
|
||||
@@ -112,5 +112,10 @@
|
||||
"TaskRefreshPeople": "Muat ulang Orang",
|
||||
"TaskCleanLogsDescription": "Menghapus file log yang lebih dari {0} hari.",
|
||||
"TaskCleanLogs": "Bersihkan Log Direktori",
|
||||
"TaskRefreshLibrary": "Pindai Pustaka Media"
|
||||
"TaskRefreshLibrary": "Pindai Pustaka Media",
|
||||
"TaskCleanActivityLogDescription": "Menghapus log aktivitas yang lebih tua dari umur yang dikonfigurasi.",
|
||||
"TaskCleanActivityLog": "Bersihkan Log Aktivitas",
|
||||
"Undefined": "Tidak terdefinisi",
|
||||
"Forced": "Dipaksa",
|
||||
"Default": "Bawaan"
|
||||
}
|
||||
|
||||
@@ -113,5 +113,10 @@
|
||||
"TasksChannelsCategory": "Canali su Internet",
|
||||
"TasksApplicationCategory": "Applicazione",
|
||||
"TasksLibraryCategory": "Libreria",
|
||||
"TasksMaintenanceCategory": "Manutenzione"
|
||||
"TasksMaintenanceCategory": "Manutenzione",
|
||||
"TaskCleanActivityLog": "Attività di Registro Completate",
|
||||
"TaskCleanActivityLogDescription": "Elimina gli inserimenti nel registro delle attività più vecchie dell’età configurata.",
|
||||
"Undefined": "Non Definito",
|
||||
"Forced": "Forzato",
|
||||
"Default": "Predefinito"
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
"TaskRefreshLibraryDescription": "メディアライブラリをスキャンして新しいファイルを探し、メタデータをリフレッシュします。",
|
||||
"TaskRefreshLibrary": "メディアライブラリのスキャン",
|
||||
"TaskCleanCacheDescription": "不要なキャッシュを消去します。",
|
||||
"TaskCleanCache": "キャッシュの掃除",
|
||||
"TaskCleanCache": "キャッシュを消去",
|
||||
"TasksChannelsCategory": "ネットチャンネル",
|
||||
"TasksApplicationCategory": "アプリケーション",
|
||||
"TasksLibraryCategory": "ライブラリ",
|
||||
@@ -112,5 +112,7 @@
|
||||
"TaskDownloadMissingSubtitlesDescription": "メタデータ構成に基づいて、欠落している字幕をインターネットで検索します。",
|
||||
"TaskRefreshChapterImagesDescription": "チャプターのあるビデオのサムネイルを作成します。",
|
||||
"TaskRefreshChapterImages": "チャプター画像を抽出する",
|
||||
"TaskDownloadMissingSubtitles": "不足している字幕をダウンロードする"
|
||||
"TaskDownloadMissingSubtitles": "不足している字幕をダウンロードする",
|
||||
"TaskCleanActivityLogDescription": "設定された期間よりも古いアクティビティの履歴を削除します。",
|
||||
"TaskCleanActivityLog": "アクティビティの履歴を消去"
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
"HeaderRecordingGroups": "녹화 그룹",
|
||||
"HomeVideos": "홈 비디오",
|
||||
"Inherit": "상속",
|
||||
"ItemAddedWithName": "{0}가 라이브러리에 추가됨",
|
||||
"ItemAddedWithName": "{0}가 라이브러리에 추가되었습니다",
|
||||
"ItemRemovedWithName": "{0}가 라이브러리에서 제거됨",
|
||||
"LabelIpAddressValue": "IP 주소: {0}",
|
||||
"LabelRunningTimeValue": "상영 시간: {0}",
|
||||
@@ -113,5 +113,7 @@
|
||||
"TaskCleanCacheDescription": "시스템에서 더 이상 필요하지 않은 캐시 파일을 삭제합니다.",
|
||||
"TaskCleanCache": "캐시 폴더 청소",
|
||||
"TasksChannelsCategory": "인터넷 채널",
|
||||
"TasksLibraryCategory": "라이브러리"
|
||||
"TasksLibraryCategory": "라이브러리",
|
||||
"TaskCleanActivityLogDescription": "구성된 기간보다 오래된 활동내역 삭제.",
|
||||
"TaskCleanActivityLog": "활동내역청소"
|
||||
}
|
||||
|
||||
@@ -113,5 +113,9 @@
|
||||
"TaskRefreshPeople": "Oppfrisk personer",
|
||||
"TaskCleanLogsDescription": "Sletter loggfiler som er eldre enn {0} dager gamle.",
|
||||
"TaskCleanLogs": "Tøm loggmappe",
|
||||
"TaskRefreshLibraryDescription": "Skanner mediebibliotekene dine for nye filer og oppdaterer metadata."
|
||||
"TaskRefreshLibraryDescription": "Skanner mediebibliotekene dine for nye filer og oppdaterer metadata.",
|
||||
"TaskCleanActivityLog": "Tøm aktivitetslogg",
|
||||
"Undefined": "Udefinert",
|
||||
"Forced": "Tvungen",
|
||||
"Default": "Standard"
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
"UserOnlineFromDevice": "{0} heeft verbinding met {1}",
|
||||
"UserPasswordChangedWithName": "Wachtwoord voor {0} is gewijzigd",
|
||||
"UserPolicyUpdatedWithName": "Gebruikersbeleid gewijzigd voor {0}",
|
||||
"UserStartedPlayingItemWithValues": "{0} heeft afspelen van {1} gestart op {2}",
|
||||
"UserStartedPlayingItemWithValues": "{0} speelt {1} af op {2}",
|
||||
"UserStoppedPlayingItemWithValues": "{0} heeft afspelen van {1} gestopt op {2}",
|
||||
"ValueHasBeenAddedToLibrary": "{0} is toegevoegd aan je mediabibliotheek",
|
||||
"ValueSpecialEpisodeName": "Speciaal - {0}",
|
||||
@@ -113,5 +113,10 @@
|
||||
"TasksChannelsCategory": "Internet Kanalen",
|
||||
"TasksApplicationCategory": "Applicatie",
|
||||
"TasksLibraryCategory": "Bibliotheek",
|
||||
"TasksMaintenanceCategory": "Onderhoud"
|
||||
"TasksMaintenanceCategory": "Onderhoud",
|
||||
"TaskCleanActivityLogDescription": "Verwijder activiteiten logs ouder dan de ingestelde tijd.",
|
||||
"TaskCleanActivityLog": "Leeg activiteiten logboek",
|
||||
"Undefined": "Niet gedefinieerd",
|
||||
"Forced": "Geforceerd",
|
||||
"Default": "Standaard"
|
||||
}
|
||||
|
||||
@@ -113,5 +113,10 @@
|
||||
"TasksChannelsCategory": "Kanały internetowe",
|
||||
"TasksApplicationCategory": "Aplikacja",
|
||||
"TasksLibraryCategory": "Biblioteka",
|
||||
"TasksMaintenanceCategory": "Konserwacja"
|
||||
"TasksMaintenanceCategory": "Konserwacja",
|
||||
"TaskCleanActivityLogDescription": "Usuwa wpisy dziennika aktywności starsze niż skonfigurowany wiek.",
|
||||
"TaskCleanActivityLog": "Czyść dziennik aktywności",
|
||||
"Undefined": "Nieustalony",
|
||||
"Forced": "Wymuszony",
|
||||
"Default": "Domyślne"
|
||||
}
|
||||
|
||||
@@ -113,5 +113,7 @@
|
||||
"TasksChannelsCategory": "Canais da Internet",
|
||||
"TasksApplicationCategory": "Aplicativo",
|
||||
"TasksLibraryCategory": "Biblioteca",
|
||||
"TasksMaintenanceCategory": "Manutenção"
|
||||
"TasksMaintenanceCategory": "Manutenção",
|
||||
"TaskCleanActivityLogDescription": "Apaga o registro de atividades mais antigo que a idade configurada.",
|
||||
"TaskCleanActivityLog": "Limpar Registro de Atividades"
|
||||
}
|
||||
|
||||
@@ -112,5 +112,7 @@
|
||||
"TasksChannelsCategory": "Canale de pe Internet",
|
||||
"TasksApplicationCategory": "Aplicație",
|
||||
"TasksLibraryCategory": "Librărie",
|
||||
"TasksMaintenanceCategory": "Mentenanță"
|
||||
"TasksMaintenanceCategory": "Mentenanță",
|
||||
"TaskCleanActivityLogDescription": "Șterge intrările din jurnalul de activitate mai vechi de data configurată.",
|
||||
"TaskCleanActivityLog": "Curăță Jurnalul de Activitate"
|
||||
}
|
||||
|
||||
@@ -113,5 +113,10 @@
|
||||
"TaskCleanLogsDescription": "Удаляются файлы журнала, возраст которых превышает {0} дн(я/ей).",
|
||||
"TaskRefreshLibraryDescription": "Сканируется медиатека на новые файлы и обновляются метаданные.",
|
||||
"TaskRefreshChapterImagesDescription": "Создаются эскизы для видео, которые содержат сцены.",
|
||||
"TaskCleanCacheDescription": "Удаляются файлы кэша, которые больше не нужны системе."
|
||||
"TaskCleanCacheDescription": "Удаляются файлы кэша, которые больше не нужны системе.",
|
||||
"TaskCleanActivityLogDescription": "Удаляет записи журнала активности старше установленного возраста.",
|
||||
"TaskCleanActivityLog": "Очистить журнал активности",
|
||||
"Undefined": "Не определено",
|
||||
"Forced": "Форсир-ые",
|
||||
"Default": "По умолчанию"
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"Albums": "Albumy",
|
||||
"AppDeviceValues": "Aplikácia: {0}, Zariadenie: {1}",
|
||||
"Application": "Aplikácia",
|
||||
"Artists": "Umelci",
|
||||
"Artists": "Interpreti",
|
||||
"AuthenticationSucceededWithUserName": "{0} úspešne overený",
|
||||
"Books": "Knihy",
|
||||
"CameraImageUploadedFrom": "Z {0} bola nahraná nová fotografia",
|
||||
@@ -15,13 +15,13 @@
|
||||
"Favorites": "Obľúbené",
|
||||
"Folders": "Priečinky",
|
||||
"Genres": "Žánre",
|
||||
"HeaderAlbumArtists": "Umelci albumu",
|
||||
"HeaderAlbumArtists": "Interpreti albumu",
|
||||
"HeaderContinueWatching": "Pokračovať v pozeraní",
|
||||
"HeaderFavoriteAlbums": "Obľúbené albumy",
|
||||
"HeaderFavoriteArtists": "Obľúbení umelci",
|
||||
"HeaderFavoriteArtists": "Obľúbení interpreti",
|
||||
"HeaderFavoriteEpisodes": "Obľúbené epizódy",
|
||||
"HeaderFavoriteShows": "Obľúbené seriály",
|
||||
"HeaderFavoriteSongs": "Obľúbené piesne",
|
||||
"HeaderFavoriteSongs": "Obľúbené skladby",
|
||||
"HeaderLiveTV": "Živá TV",
|
||||
"HeaderNextUp": "Nasleduje",
|
||||
"HeaderRecordingGroups": "Skupiny nahrávok",
|
||||
@@ -33,13 +33,13 @@
|
||||
"LabelRunningTimeValue": "Dĺžka: {0}",
|
||||
"Latest": "Najnovšie",
|
||||
"MessageApplicationUpdated": "Jellyfin Server bol aktualizovaný",
|
||||
"MessageApplicationUpdatedTo": "Jellyfin Server bol aktualizový na verziu {0}",
|
||||
"MessageApplicationUpdatedTo": "Jellyfin Server bol aktualizovaný na verziu {0}",
|
||||
"MessageNamedServerConfigurationUpdatedWithValue": "Sekcia {0} konfigurácie servera bola aktualizovaná",
|
||||
"MessageServerConfigurationUpdated": "Konfigurácia servera bola aktualizovaná",
|
||||
"MixedContent": "Zmiešaný obsah",
|
||||
"Movies": "Filmy",
|
||||
"Music": "Hudba",
|
||||
"MusicVideos": "Hudobné videá",
|
||||
"MusicVideos": "Hudobné videoklipy",
|
||||
"NameInstallFailed": "Inštalácia {0} zlyhala",
|
||||
"NameSeasonNumber": "Séria {0}",
|
||||
"NameSeasonUnknown": "Neznáma séria",
|
||||
@@ -71,7 +71,7 @@
|
||||
"ScheduledTaskStartedWithName": "{0} zahájených",
|
||||
"ServerNameNeedsToBeRestarted": "{0} vyžaduje reštart",
|
||||
"Shows": "Seriály",
|
||||
"Songs": "Piesne",
|
||||
"Songs": "Skladby",
|
||||
"StartupEmbyServerIsLoading": "Jellyfin Server sa spúšťa. Prosím, skúste to o chvíľu znova.",
|
||||
"SubtitleDownloadFailureForItem": "Sťahovanie titulkov pre {0} zlyhalo",
|
||||
"SubtitleDownloadFailureFromForItem": "Sťahovanie titulkov z {0} pre {1} zlyhalo",
|
||||
@@ -89,29 +89,34 @@
|
||||
"UserPolicyUpdatedWithName": "Používateľské zásady pre {0} boli aktualizované",
|
||||
"UserStartedPlayingItemWithValues": "{0} spustil prehrávanie {1} na {2}",
|
||||
"UserStoppedPlayingItemWithValues": "{0} ukončil prehrávanie {1} na {2}",
|
||||
"ValueHasBeenAddedToLibrary": "{0} bol pridané do vašej knižnice médií",
|
||||
"ValueHasBeenAddedToLibrary": "{0} bol pridaný do vašej knižnice médií",
|
||||
"ValueSpecialEpisodeName": "Špeciál - {0}",
|
||||
"VersionNumber": "Verzia {0}",
|
||||
"TaskDownloadMissingSubtitlesDescription": "Vyhľadá na internete chýbajúce titulky podľa toho, ako sú nakonfigurované metadáta.",
|
||||
"TaskDownloadMissingSubtitles": "Stiahnuť chýbajúce titulky",
|
||||
"TaskRefreshChannelsDescription": "Obnoví informácie o internetových kanáloch.",
|
||||
"TaskRefreshChannels": "Obnoviť kanály",
|
||||
"TaskCleanTranscodeDescription": "Vymaže súbory transkódovania, ktoré sú staršie ako jeden deň.",
|
||||
"TaskCleanTranscode": "Vyčistiť priečinok pre transkódovanie",
|
||||
"TaskCleanTranscodeDescription": "Vymaže prekódované súbory, ktoré sú staršie ako jeden deň.",
|
||||
"TaskCleanTranscode": "Vyčistiť priečinok pre prekódovanie",
|
||||
"TaskUpdatePluginsDescription": "Stiahne a nainštaluje aktualizácie pre zásuvné moduly, ktoré sú nastavené tak, aby sa aktualizovali automaticky.",
|
||||
"TaskUpdatePlugins": "Aktualizovať zásuvné moduly",
|
||||
"TaskRefreshPeopleDescription": "Aktualizuje metadáta pre hercov a režisérov vo vašej mediálnej knižnici.",
|
||||
"TaskRefreshPeople": "Obnoviť osoby",
|
||||
"TaskCleanLogsDescription": "Vymaže log súbory, ktoré su staršie ako {0} deň/dni/dní.",
|
||||
"TaskCleanLogsDescription": "Vymaže log súbory, ktoré sú staršie ako {0} deň/dni/dní.",
|
||||
"TaskCleanLogs": "Vyčistiť priečinok s logmi",
|
||||
"TaskRefreshLibraryDescription": "Hľadá vo vašej mediálnej knižnici nové súbory a obnovuje metadáta.",
|
||||
"TaskRefreshLibrary": "Prehľadávať knižnicu medií",
|
||||
"TaskRefreshChapterImagesDescription": "Vytvorí náhľady pre videá, ktoré majú kapitoly.",
|
||||
"TaskRefreshChapterImages": "Extrahovať obrázky kapitol",
|
||||
"TaskCleanCacheDescription": "Vymaže cache súbory, ktoré nie sú už potrebné pre systém.",
|
||||
"TaskCleanCache": "Vyčistiť Cache priečinok",
|
||||
"TaskCleanCacheDescription": "Vymaže súbory vyrovnávacej pamäte, ktoré už nie sú potrebné pre systém.",
|
||||
"TaskCleanCache": "Vyčistiť priečinok vyrovnávacej pamäte",
|
||||
"TasksChannelsCategory": "Internetové kanály",
|
||||
"TasksApplicationCategory": "Aplikácia",
|
||||
"TasksLibraryCategory": "Knižnica",
|
||||
"TasksMaintenanceCategory": "Údržba"
|
||||
"TasksMaintenanceCategory": "Údržba",
|
||||
"TaskCleanActivityLogDescription": "Vymaže záznamy aktivít v logu, ktoré sú staršie ako zadaná doba.",
|
||||
"TaskCleanActivityLog": "Vyčistiť log aktivít",
|
||||
"Undefined": "Nedefinované",
|
||||
"Forced": "Vynútené",
|
||||
"Default": "Predvolené"
|
||||
}
|
||||
|
||||
@@ -3,20 +3,20 @@
|
||||
"AppDeviceValues": "Aplikacija: {0}, Naprava: {1}",
|
||||
"Application": "Aplikacija",
|
||||
"Artists": "Izvajalci",
|
||||
"AuthenticationSucceededWithUserName": "{0} preverjanje pristnosti uspešno",
|
||||
"AuthenticationSucceededWithUserName": "{0} se je uspešno prijavil",
|
||||
"Books": "Knjige",
|
||||
"CameraImageUploadedFrom": "Nova fotografija je bila naložena z {0}",
|
||||
"CameraImageUploadedFrom": "Nova fotografija je bila naložena iz {0}",
|
||||
"Channels": "Kanali",
|
||||
"ChapterNameValue": "Poglavje {0}",
|
||||
"Collections": "Zbirke",
|
||||
"DeviceOfflineWithName": "{0} je prekinil povezavo",
|
||||
"DeviceOnlineWithName": "{0} je povezan",
|
||||
"FailedLoginAttemptWithUserName": "Neuspešen poskus prijave z {0}",
|
||||
"FailedLoginAttemptWithUserName": "Neuspešen poskus prijave iz {0}",
|
||||
"Favorites": "Priljubljeno",
|
||||
"Folders": "Mape",
|
||||
"Genres": "Zvrsti",
|
||||
"HeaderAlbumArtists": "Izvajalci albuma",
|
||||
"HeaderContinueWatching": "Nadaljuj gledanje",
|
||||
"HeaderContinueWatching": "Nadaljuj z ogledom",
|
||||
"HeaderFavoriteAlbums": "Priljubljeni albumi",
|
||||
"HeaderFavoriteArtists": "Priljubljeni izvajalci",
|
||||
"HeaderFavoriteEpisodes": "Priljubljene epizode",
|
||||
@@ -32,23 +32,23 @@
|
||||
"LabelIpAddressValue": "IP naslov: {0}",
|
||||
"LabelRunningTimeValue": "Čas trajanja: {0}",
|
||||
"Latest": "Najnovejše",
|
||||
"MessageApplicationUpdated": "Jellyfin Server je bil posodobljen",
|
||||
"MessageApplicationUpdatedTo": "Jellyfin Server je bil posodobljen na {0}",
|
||||
"MessageNamedServerConfigurationUpdatedWithValue": "Oddelek nastavitve strežnika {0} je bil posodobljen",
|
||||
"MessageApplicationUpdated": "Jellyfin strežnik je bil posodobljen",
|
||||
"MessageApplicationUpdatedTo": "Jellyfin strežnik je bil posodobljen na {0}",
|
||||
"MessageNamedServerConfigurationUpdatedWithValue": "Oddelek nastavitev {0} je bil posodobljen",
|
||||
"MessageServerConfigurationUpdated": "Nastavitve strežnika so bile posodobljene",
|
||||
"MixedContent": "Razne vsebine",
|
||||
"MixedContent": "Mešane vsebine",
|
||||
"Movies": "Filmi",
|
||||
"Music": "Glasba",
|
||||
"MusicVideos": "Glasbeni videi",
|
||||
"NameInstallFailed": "{0} namestitev neuspešna",
|
||||
"NameSeasonNumber": "Sezona {0}",
|
||||
"NameSeasonUnknown": "Season neznana",
|
||||
"NameSeasonUnknown": "Neznana sezona",
|
||||
"NewVersionIsAvailable": "Nova različica Jellyfin strežnika je na voljo za prenos.",
|
||||
"NotificationOptionApplicationUpdateAvailable": "Posodobitev aplikacije je na voljo",
|
||||
"NotificationOptionApplicationUpdateInstalled": "Posodobitev aplikacije je bila nameščena",
|
||||
"NotificationOptionAudioPlayback": "Predvajanje zvoka začeto",
|
||||
"NotificationOptionAudioPlaybackStopped": "Predvajanje zvoka zaustavljeno",
|
||||
"NotificationOptionCameraImageUploaded": "Posnetek kamere naložen",
|
||||
"NotificationOptionAudioPlayback": "Predvajanje zvoka se je začelo",
|
||||
"NotificationOptionAudioPlaybackStopped": "Predvajanje zvoka se je ustavilo",
|
||||
"NotificationOptionCameraImageUploaded": "Fotografija naložena",
|
||||
"NotificationOptionInstallationFailed": "Namestitev neuspešna",
|
||||
"NotificationOptionNewLibraryContent": "Nove vsebine dodane",
|
||||
"NotificationOptionPluginError": "Napaka dodatka",
|
||||
@@ -56,41 +56,41 @@
|
||||
"NotificationOptionPluginUninstalled": "Dodatek odstranjen",
|
||||
"NotificationOptionPluginUpdateInstalled": "Posodobitev dodatka nameščena",
|
||||
"NotificationOptionServerRestartRequired": "Potreben je ponovni zagon strežnika",
|
||||
"NotificationOptionTaskFailed": "Razporejena naloga neuspešna",
|
||||
"NotificationOptionTaskFailed": "Načrtovano opravilo neuspešno",
|
||||
"NotificationOptionUserLockedOut": "Uporabnik zaklenjen",
|
||||
"NotificationOptionVideoPlayback": "Predvajanje videa se je začelo",
|
||||
"NotificationOptionVideoPlaybackStopped": "Predvajanje videa se je ustavilo",
|
||||
"Photos": "Fotografije",
|
||||
"Playlists": "Seznami predvajanja",
|
||||
"Plugin": "Plugin",
|
||||
"Plugin": "Dodatek",
|
||||
"PluginInstalledWithName": "{0} je bil nameščen",
|
||||
"PluginUninstalledWithName": "{0} je bil odstranjen",
|
||||
"PluginUpdatedWithName": "{0} je bil posodobljen",
|
||||
"ProviderValue": "Provider: {0}",
|
||||
"ProviderValue": "Ponudnik: {0}",
|
||||
"ScheduledTaskFailedWithName": "{0} ni uspelo",
|
||||
"ScheduledTaskStartedWithName": "{0} začeto",
|
||||
"ServerNameNeedsToBeRestarted": "{0} mora biti ponovno zagnan",
|
||||
"Shows": "Serije",
|
||||
"Songs": "Pesmi",
|
||||
"StartupEmbyServerIsLoading": "Jellyfin Server se nalaga. Poskusi ponovno kasneje.",
|
||||
"StartupEmbyServerIsLoading": "Jellyfin strežnik se zaganja. Poskusite ponovno kasneje.",
|
||||
"SubtitleDownloadFailureForItem": "Subtitles failed to download for {0}",
|
||||
"SubtitleDownloadFailureFromForItem": "Neuspešen prenos podnapisov iz {0} za {1}",
|
||||
"Sync": "Sinhroniziraj",
|
||||
"System": "System",
|
||||
"System": "Sistem",
|
||||
"TvShows": "TV serije",
|
||||
"User": "User",
|
||||
"User": "Uporabnik",
|
||||
"UserCreatedWithName": "Uporabnik {0} je bil ustvarjen",
|
||||
"UserDeletedWithName": "Uporabnik {0} je bil izbrisan",
|
||||
"UserDownloadingItemWithValues": "{0} prenaša {1}",
|
||||
"UserLockedOutWithName": "Uporabnik {0} je bil zaklenjen",
|
||||
"UserOfflineFromDevice": "{0} je prekinil povezavo z {1}",
|
||||
"UserOnlineFromDevice": "{0} je aktiven iz {1}",
|
||||
"UserOnlineFromDevice": "{0} je aktiven na {1}",
|
||||
"UserPasswordChangedWithName": "Geslo za uporabnika {0} je bilo spremenjeno",
|
||||
"UserPolicyUpdatedWithName": "Pravilnik uporabe je bil posodobljen za uporabnika {0}",
|
||||
"UserStartedPlayingItemWithValues": "{0} predvaja {1} na {2}",
|
||||
"UserStoppedPlayingItemWithValues": "{0} je nehal predvajati {1} na {2}",
|
||||
"ValueHasBeenAddedToLibrary": "{0} je bil dodan vaši knjižnici",
|
||||
"ValueSpecialEpisodeName": "Poseben - {0}",
|
||||
"ValueSpecialEpisodeName": "Posebna - {0}",
|
||||
"VersionNumber": "Različica {0}",
|
||||
"TaskDownloadMissingSubtitles": "Prenesi manjkajoče podnapise",
|
||||
"TaskRefreshChannelsDescription": "Osveži podatke spletnih kanalov.",
|
||||
@@ -102,7 +102,7 @@
|
||||
"TaskRefreshPeopleDescription": "Osveži metapodatke za igralce in režiserje v vaši knjižnici.",
|
||||
"TaskRefreshPeople": "Osveži osebe",
|
||||
"TaskCleanLogsDescription": "Izbriše dnevniške datoteke starejše od {0} dni.",
|
||||
"TaskCleanLogs": "Počisti mapo dnevnika",
|
||||
"TaskCleanLogs": "Počisti mapo dnevnikov",
|
||||
"TaskRefreshLibraryDescription": "Preišče vašo knjižnico za nove datoteke in osveži metapodatke.",
|
||||
"TaskRefreshLibrary": "Preišči knjižnico predstavnosti",
|
||||
"TaskRefreshChapterImagesDescription": "Ustvari sličice za poglavja videoposnetkov.",
|
||||
|
||||
@@ -112,5 +112,5 @@
|
||||
"Artists": "Artistë",
|
||||
"Application": "Aplikacioni",
|
||||
"AppDeviceValues": "Aplikacioni: {0}, Pajisja: {1}",
|
||||
"Albums": "Albumet"
|
||||
"Albums": "Albume"
|
||||
}
|
||||
|
||||
@@ -112,5 +112,7 @@
|
||||
"TasksChannelsCategory": "Интернет канали",
|
||||
"TasksApplicationCategory": "Апликација",
|
||||
"TasksLibraryCategory": "Библиотека",
|
||||
"TasksMaintenanceCategory": "Одржавање"
|
||||
"TasksMaintenanceCategory": "Одржавање",
|
||||
"TaskCleanActivityLogDescription": "Брише историју активности старију од конфигурисаног броја година.",
|
||||
"TaskCleanActivityLog": "Очисти историју активности"
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"Channels": "Kanaler",
|
||||
"ChapterNameValue": "Kapitel {0}",
|
||||
"Collections": "Samlingar",
|
||||
"DeviceOfflineWithName": "{0} har kopplat från",
|
||||
"DeviceOfflineWithName": "{0} har kopplat ner",
|
||||
"DeviceOnlineWithName": "{0} är ansluten",
|
||||
"FailedLoginAttemptWithUserName": "Misslyckat inloggningsförsök från {0}",
|
||||
"Favorites": "Favoriter",
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"Inherit": "மரபுரிமையாகப் பெறு",
|
||||
"HeaderRecordingGroups": "பதிவு குழுக்கள்",
|
||||
"Folders": "கோப்புறைகள்",
|
||||
"FailedLoginAttemptWithUserName": "{0} இலிருந்து உள்நுழைவு முயற்சி தோல்வியடைந்தது",
|
||||
"FailedLoginAttemptWithUserName": "{0} இல் இருந்து உள்நுழைவு முயற்சி தோல்வியடைந்தது",
|
||||
"DeviceOnlineWithName": "{0} இணைக்கப்பட்டது",
|
||||
"DeviceOfflineWithName": "{0} துண்டிக்கப்பட்டது",
|
||||
"Collections": "தொகுப்புகள்",
|
||||
@@ -99,9 +99,9 @@
|
||||
"MessageNamedServerConfigurationUpdatedWithValue": "சேவையக உள்ளமைவு பிரிவு {0} புதுப்பிக்கப்பட்டது",
|
||||
"TaskCleanCacheDescription": "கணினிக்கு இனி தேவைப்படாத தற்காலிக கோப்புகளை நீக்கு.",
|
||||
"UserOfflineFromDevice": "{0} இலிருந்து {1} துண்டிக்கப்பட்டுள்ளது",
|
||||
"SubtitleDownloadFailureFromForItem": "வசன வரிகள் {0} இலிருந்து {1} க்கு பதிவிறக்கத் தவறிவிட்டன",
|
||||
"SubtitleDownloadFailureFromForItem": "வசன வரிகள் {0} இல் இருந்து {1} க்கு பதிவிறக்கத் தவறிவிட்டன",
|
||||
"TaskDownloadMissingSubtitlesDescription": "மீத்தரவு உள்ளமைவின் அடிப்படையில் வசன வரிகள் காணாமல் போனதற்கு இணையத்தைத் தேடுகிறது.",
|
||||
"TaskCleanTranscodeDescription": "டிரான்ஸ்கோட் கோப்புகளை ஒரு நாளுக்கு மேல் பழையதாக நீக்குகிறது.",
|
||||
"TaskCleanTranscodeDescription": "ஒரு நாளைக்கு மேற்பட்ட பழைய டிரான்ஸ்கோட் கோப்புகளை நீக்குகிறது.",
|
||||
"TaskUpdatePluginsDescription": "தானாகவே புதுப்பிக்க கட்டமைக்கப்பட்ட உட்செருகிகளுக்கான புதுப்பிப்புகளை பதிவிறக்குகிறது மற்றும் நிறுவுகிறது.",
|
||||
"TaskRefreshPeopleDescription": "உங்கள் ஊடக நூலகத்தில் உள்ள நடிகர்கள் மற்றும் இயக்குனர்களுக்கான மீத்தரவை புதுப்பிக்கும்.",
|
||||
"TaskCleanLogsDescription": "{0} நாட்களுக்கு மேல் இருக்கும் பதிவு கோப்புகளை நீக்கும்.",
|
||||
@@ -112,5 +112,10 @@
|
||||
"UserOnlineFromDevice": "{1} இருந்து {0} ஆன்லைன்",
|
||||
"HomeVideos": "முகப்பு வீடியோக்கள்",
|
||||
"UserStoppedPlayingItemWithValues": "{0} {2} இல் {1} முடித்துவிட்டது",
|
||||
"UserStartedPlayingItemWithValues": "{0} {2}இல் {1} ஐ இயக்குகிறது"
|
||||
"UserStartedPlayingItemWithValues": "{0} {2}இல் {1} ஐ இயக்குகிறது",
|
||||
"TaskCleanActivityLogDescription": "உள்ளமைக்கப்பட்ட வயதை விட பழைய செயல்பாட்டு பதிவு உள்ளீடுகளை நீக்குகிறது.",
|
||||
"TaskCleanActivityLog": "செயல்பாட்டு பதிவை அழி",
|
||||
"Undefined": "வரையறுக்கப்படாத",
|
||||
"Forced": "கட்டாயப்படுத்தப்பட்டது",
|
||||
"Default": "இயல்புநிலை"
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"CameraImageUploadedFrom": "{0} 'den yeni bir kamera resmi yüklendi",
|
||||
"Channels": "Kanallar",
|
||||
"ChapterNameValue": "Bölüm {0}",
|
||||
"Collections": "Koleksiyonlar",
|
||||
"Collections": "Koleksiyon",
|
||||
"DeviceOfflineWithName": "{0} bağlantısı kesildi",
|
||||
"DeviceOnlineWithName": "{0} bağlı",
|
||||
"FailedLoginAttemptWithUserName": "{0} adresinden giriş başarısız oldu",
|
||||
@@ -23,7 +23,7 @@
|
||||
"HeaderFavoriteShows": "Favori Diziler",
|
||||
"HeaderFavoriteSongs": "Favori Şarkılar",
|
||||
"HeaderLiveTV": "Canlı TV",
|
||||
"HeaderNextUp": "Sonraki hafta",
|
||||
"HeaderNextUp": "Gelecek Hafta",
|
||||
"HeaderRecordingGroups": "Kayıt Grupları",
|
||||
"HomeVideos": "Ev videoları",
|
||||
"Inherit": "Devral",
|
||||
@@ -113,5 +113,7 @@
|
||||
"TaskRefreshLibrary": "Medya Kütüphanesini Tara",
|
||||
"TaskRefreshChapterImagesDescription": "Sahnelere ayrılmış videolar için küçük resimler oluştur.",
|
||||
"TaskRefreshChapterImages": "Bölüm Resimlerini Çıkar",
|
||||
"TaskCleanCacheDescription": "Sistem tarafından artık ihtiyaç duyulmayan önbellek dosyalarını siler."
|
||||
"TaskCleanCacheDescription": "Sistem tarafından artık ihtiyaç duyulmayan önbellek dosyalarını siler.",
|
||||
"TaskCleanActivityLog": "İşlem Günlüğünü Temizle",
|
||||
"TaskCleanActivityLogDescription": "Belirtilen sureden daha eski etkinlik log kayıtları silindi."
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
"Channels": "Канали",
|
||||
"CameraImageUploadedFrom": "Нова фотографія завантажена з {0}",
|
||||
"Books": "Книги",
|
||||
"AuthenticationSucceededWithUserName": "{0} успішно авторизований",
|
||||
"AuthenticationSucceededWithUserName": "{0} успішно автентифіковано",
|
||||
"Artists": "Виконавці",
|
||||
"Application": "Додаток",
|
||||
"AppDeviceValues": "Додаток: {0}, Пристрій: {1}",
|
||||
@@ -112,5 +112,10 @@
|
||||
"MessageServerConfigurationUpdated": "Конфігурація сервера оновлена",
|
||||
"MessageNamedServerConfigurationUpdatedWithValue": "Розділ конфігурації сервера {0} оновлено",
|
||||
"Inherit": "Успадкувати",
|
||||
"HeaderRecordingGroups": "Групи запису"
|
||||
"HeaderRecordingGroups": "Групи запису",
|
||||
"Forced": "Примусово",
|
||||
"TaskCleanActivityLogDescription": "Видаляє старші за встановлений термін записи з журналу активності.",
|
||||
"TaskCleanActivityLog": "Очистити журнал активності",
|
||||
"Undefined": "Не визначено",
|
||||
"Default": "За замовчуванням"
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"Albums": "Albums",
|
||||
"Artists": "Các Nghệ Sĩ",
|
||||
"TaskDownloadMissingSubtitlesDescription": "Tìm kiếm phụ đề bị thiếu trên Internet dựa trên cấu hình dữ liệu mô tả.",
|
||||
"TaskDownloadMissingSubtitles": "Tải xuống phụ đề bị thiếu",
|
||||
"TaskDownloadMissingSubtitles": "Tải Xuống Phụ Đề Bị Thiếu",
|
||||
"TaskRefreshChannelsDescription": "Làm mới thông tin kênh internet.",
|
||||
"TaskRefreshChannels": "Làm Mới Kênh",
|
||||
"TaskCleanTranscodeDescription": "Xóa các tệp chuyển mã cũ hơn một ngày.",
|
||||
@@ -24,11 +24,11 @@
|
||||
"TaskUpdatePluginsDescription": "Tải xuống và cài đặt các bản cập nhật cho các plugin được định cấu hình để cập nhật tự động.",
|
||||
"TaskUpdatePlugins": "Cập Nhật Plugins",
|
||||
"TaskRefreshPeopleDescription": "Cập nhật thông tin chi tiết cho diễn viên và đạo diễn trong thư viện phương tiện của bạn.",
|
||||
"TaskRefreshPeople": "Làm mới Người dùng",
|
||||
"TaskRefreshPeople": "Làm Mới Người Dùng",
|
||||
"TaskCleanLogsDescription": "Xóa tập tin nhật ký cũ hơn {0} ngày.",
|
||||
"TaskCleanLogs": "Làm sạch nhật ký",
|
||||
"TaskRefreshLibraryDescription": "Quét thư viện phương tiện của bạn để tìm các tệp mới và làm mới thông tin chi tiết.",
|
||||
"TaskRefreshLibrary": "Quét Thư viện Phương tiện",
|
||||
"TaskCleanLogs": "Làm Sạch Thư Mục Nhật Ký",
|
||||
"TaskRefreshLibraryDescription": "Quét thư viện phương tiện của bạn để tìm tệp mới và làm mới dữ liệu mô tả.",
|
||||
"TaskRefreshLibrary": "Quét Thư Viện Phương Tiện",
|
||||
"TaskRefreshChapterImagesDescription": "Tạo hình thu nhỏ cho video có các phân cảnh.",
|
||||
"TaskRefreshChapterImages": "Trích Xuất Ảnh Phân Cảnh",
|
||||
"TaskCleanCacheDescription": "Xóa các tệp cache không còn cần thiết của hệ thống.",
|
||||
@@ -80,7 +80,7 @@
|
||||
"NotificationOptionApplicationUpdateAvailable": "Bản cập nhật ứng dụng hiện sẵn có",
|
||||
"NewVersionIsAvailable": "Một phiên bản mới của Jellyfin Server sẵn có để tải.",
|
||||
"NameSeasonUnknown": "Không Rõ Mùa",
|
||||
"NameSeasonNumber": "Mùa {0}",
|
||||
"NameSeasonNumber": "Phần {0}",
|
||||
"NameInstallFailed": "{0} cài đặt thất bại",
|
||||
"MusicVideos": "Video Nhạc",
|
||||
"Music": "Nhạc",
|
||||
@@ -112,5 +112,10 @@
|
||||
"Books": "Sách",
|
||||
"AuthenticationSucceededWithUserName": "{0} xác thực thành công",
|
||||
"Application": "Ứng Dụng",
|
||||
"AppDeviceValues": "Ứng Dụng: {0}, Thiết Bị: {1}"
|
||||
"AppDeviceValues": "Ứng Dụng: {0}, Thiết Bị: {1}",
|
||||
"TaskCleanActivityLogDescription": "Xóa các mục nhật ký hoạt động cũ hơn độ tuổi đã cài đặt.",
|
||||
"TaskCleanActivityLog": "Xóa Nhật Ký Hoạt Động",
|
||||
"Undefined": "Không Xác Định",
|
||||
"Forced": "Bắt Buộc",
|
||||
"Default": "Mặc Định"
|
||||
}
|
||||
|
||||
@@ -113,5 +113,10 @@
|
||||
"TaskCleanCacheDescription": "删除系统不再需要的缓存文件。",
|
||||
"TaskCleanCache": "清理缓存目录",
|
||||
"TasksApplicationCategory": "应用程序",
|
||||
"TasksMaintenanceCategory": "维护"
|
||||
"TasksMaintenanceCategory": "维护",
|
||||
"TaskCleanActivityLog": "清理程序日志",
|
||||
"TaskCleanActivityLogDescription": "删除早于设置时间的活动日志条目。",
|
||||
"Undefined": "未定义",
|
||||
"Forced": "强制的",
|
||||
"Default": "默认"
|
||||
}
|
||||
|
||||
@@ -112,5 +112,7 @@
|
||||
"TaskRefreshChapterImagesDescription": "為有章節的影片建立縮圖。",
|
||||
"TasksChannelsCategory": "網路頻道",
|
||||
"TasksApplicationCategory": "應用程式",
|
||||
"TasksMaintenanceCategory": "維修"
|
||||
"TasksMaintenanceCategory": "維護",
|
||||
"TaskCleanActivityLogDescription": "刪除超過所設時間的活動紀錄。",
|
||||
"TaskCleanActivityLog": "清除活動紀錄"
|
||||
}
|
||||
|
||||
@@ -1,556 +0,0 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Net;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Emby.Server.Implementations.Networking
|
||||
{
|
||||
/// <summary>
|
||||
/// Class to take care of network interface management.
|
||||
/// </summary>
|
||||
public class NetworkManager : INetworkManager
|
||||
{
|
||||
private readonly ILogger<NetworkManager> _logger;
|
||||
|
||||
private IPAddress[] _localIpAddresses;
|
||||
private readonly object _localIpAddressSyncLock = new object();
|
||||
|
||||
private readonly object _subnetLookupLock = new object();
|
||||
private readonly Dictionary<string, List<string>> _subnetLookup = new Dictionary<string, List<string>>(StringComparer.Ordinal);
|
||||
|
||||
private List<PhysicalAddress> _macAddresses;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NetworkManager"/> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">Logger to use for messages.</param>
|
||||
public NetworkManager(ILogger<NetworkManager> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
|
||||
NetworkChange.NetworkAddressChanged += OnNetworkAddressChanged;
|
||||
NetworkChange.NetworkAvailabilityChanged += OnNetworkAvailabilityChanged;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public event EventHandler NetworkChanged;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Func<string[]> LocalSubnetsFn { get; set; }
|
||||
|
||||
private void OnNetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
|
||||
{
|
||||
_logger.LogDebug("NetworkAvailabilityChanged");
|
||||
OnNetworkChanged();
|
||||
}
|
||||
|
||||
private void OnNetworkAddressChanged(object sender, EventArgs e)
|
||||
{
|
||||
_logger.LogDebug("NetworkAddressChanged");
|
||||
OnNetworkChanged();
|
||||
}
|
||||
|
||||
private void OnNetworkChanged()
|
||||
{
|
||||
lock (_localIpAddressSyncLock)
|
||||
{
|
||||
_localIpAddresses = null;
|
||||
_macAddresses = null;
|
||||
}
|
||||
|
||||
NetworkChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IPAddress[] GetLocalIpAddresses()
|
||||
{
|
||||
lock (_localIpAddressSyncLock)
|
||||
{
|
||||
if (_localIpAddresses == null)
|
||||
{
|
||||
var addresses = GetLocalIpAddressesInternal().ToArray();
|
||||
|
||||
_localIpAddresses = addresses;
|
||||
}
|
||||
|
||||
return _localIpAddresses;
|
||||
}
|
||||
}
|
||||
|
||||
private List<IPAddress> GetLocalIpAddressesInternal()
|
||||
{
|
||||
var list = GetIPsDefault().ToList();
|
||||
|
||||
if (list.Count == 0)
|
||||
{
|
||||
list = GetLocalIpAddressesFallback().GetAwaiter().GetResult().ToList();
|
||||
}
|
||||
|
||||
var listClone = new List<IPAddress>();
|
||||
|
||||
var subnets = LocalSubnetsFn();
|
||||
|
||||
foreach (var i in list)
|
||||
{
|
||||
if (i.IsIPv6LinkLocal || i.ToString().StartsWith("169.254.", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Array.IndexOf(subnets, $"[{i}]") == -1)
|
||||
{
|
||||
listClone.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
return listClone
|
||||
.OrderBy(i => i.AddressFamily == AddressFamily.InterNetwork ? 0 : 1)
|
||||
// .ThenBy(i => listClone.IndexOf(i))
|
||||
.GroupBy(i => i.ToString())
|
||||
.Select(x => x.First())
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsInPrivateAddressSpace(string endpoint)
|
||||
{
|
||||
return IsInPrivateAddressSpace(endpoint, true);
|
||||
}
|
||||
|
||||
// Checks if the address in endpoint is an RFC1918, RFC1122, or RFC3927 address
|
||||
private bool IsInPrivateAddressSpace(string endpoint, bool checkSubnets)
|
||||
{
|
||||
if (string.Equals(endpoint, "::1", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// IPV6
|
||||
if (endpoint.Split('.').Length > 4)
|
||||
{
|
||||
// Handle ipv4 mapped to ipv6
|
||||
var originalEndpoint = endpoint;
|
||||
endpoint = endpoint.Replace("::ffff:", string.Empty, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
if (string.Equals(endpoint, originalEndpoint, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Private address space:
|
||||
|
||||
if (string.Equals(endpoint, "localhost", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!IPAddress.TryParse(endpoint, out var ipAddress))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
byte[] octet = ipAddress.GetAddressBytes();
|
||||
|
||||
if ((octet[0] == 10) ||
|
||||
(octet[0] == 172 && (octet[1] >= 16 && octet[1] <= 31)) || // RFC1918
|
||||
(octet[0] == 192 && octet[1] == 168) || // RFC1918
|
||||
(octet[0] == 127) || // RFC1122
|
||||
(octet[0] == 169 && octet[1] == 254)) // RFC3927
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (checkSubnets && IsInPrivateAddressSpaceAndLocalSubnet(endpoint))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsInPrivateAddressSpaceAndLocalSubnet(string endpoint)
|
||||
{
|
||||
if (endpoint.StartsWith("10.", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var endpointFirstPart = endpoint.Split('.')[0];
|
||||
|
||||
var subnets = GetSubnets(endpointFirstPart);
|
||||
|
||||
foreach (var subnet_Match in subnets)
|
||||
{
|
||||
// logger.LogDebug("subnet_Match:" + subnet_Match);
|
||||
|
||||
if (endpoint.StartsWith(subnet_Match + ".", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Gives a list of possible subnets from the system whose interface ip starts with endpointFirstPart
|
||||
private List<string> GetSubnets(string endpointFirstPart)
|
||||
{
|
||||
lock (_subnetLookupLock)
|
||||
{
|
||||
if (_subnetLookup.TryGetValue(endpointFirstPart, out var subnets))
|
||||
{
|
||||
return subnets;
|
||||
}
|
||||
|
||||
subnets = new List<string>();
|
||||
|
||||
foreach (var adapter in NetworkInterface.GetAllNetworkInterfaces())
|
||||
{
|
||||
foreach (var unicastIPAddressInformation in adapter.GetIPProperties().UnicastAddresses)
|
||||
{
|
||||
if (unicastIPAddressInformation.Address.AddressFamily == AddressFamily.InterNetwork && endpointFirstPart == unicastIPAddressInformation.Address.ToString().Split('.')[0])
|
||||
{
|
||||
int subnet_Test = 0;
|
||||
foreach (string part in unicastIPAddressInformation.IPv4Mask.ToString().Split('.'))
|
||||
{
|
||||
if (part.Equals("0", StringComparison.Ordinal))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
subnet_Test++;
|
||||
}
|
||||
|
||||
var subnet_Match = string.Join(".", unicastIPAddressInformation.Address.ToString().Split('.').Take(subnet_Test).ToArray());
|
||||
|
||||
// TODO: Is this check necessary?
|
||||
if (adapter.OperationalStatus == OperationalStatus.Up)
|
||||
{
|
||||
subnets.Add(subnet_Match);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_subnetLookup[endpointFirstPart] = subnets;
|
||||
|
||||
return subnets;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsInLocalNetwork(string endpoint)
|
||||
{
|
||||
return IsInLocalNetworkInternal(endpoint, true);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsAddressInSubnets(string addressString, string[] subnets)
|
||||
{
|
||||
return IsAddressInSubnets(IPAddress.Parse(addressString), addressString, subnets);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsAddressInSubnets(IPAddress address, bool excludeInterfaces, bool excludeRFC)
|
||||
{
|
||||
byte[] octet = address.GetAddressBytes();
|
||||
|
||||
if ((octet[0] == 127) || // RFC1122
|
||||
(octet[0] == 169 && octet[1] == 254)) // RFC3927
|
||||
{
|
||||
// don't use on loopback or 169 interfaces
|
||||
return false;
|
||||
}
|
||||
|
||||
string addressString = address.ToString();
|
||||
string excludeAddress = "[" + addressString + "]";
|
||||
var subnets = LocalSubnetsFn();
|
||||
|
||||
// Include any address if LAN subnets aren't specified
|
||||
if (subnets.Length == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Exclude any addresses if they appear in the LAN list in [ ]
|
||||
if (Array.IndexOf(subnets, excludeAddress) != -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return IsAddressInSubnets(address, addressString, subnets);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the give address falls within the ranges given in [subnets]. The addresses in subnets can be hosts or subnets in the CIDR format.
|
||||
/// </summary>
|
||||
/// <param name="address">IPAddress version of the address.</param>
|
||||
/// <param name="addressString">The address to check.</param>
|
||||
/// <param name="subnets">If true, check against addresses in the LAN settings which have [] arroud and return true if it matches the address give in address.</param>
|
||||
/// <returns><c>false</c>if the address isn't in the subnets, <c>true</c> otherwise.</returns>
|
||||
private static bool IsAddressInSubnets(IPAddress address, string addressString, string[] subnets)
|
||||
{
|
||||
foreach (var subnet in subnets)
|
||||
{
|
||||
var normalizedSubnet = subnet.Trim();
|
||||
// Is the subnet a host address and does it match the address being passes?
|
||||
if (string.Equals(normalizedSubnet, addressString, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Parse CIDR subnets and see if address falls within it.
|
||||
if (normalizedSubnet.Contains('/', StringComparison.Ordinal))
|
||||
{
|
||||
try
|
||||
{
|
||||
var ipNetwork = IPNetwork.Parse(normalizedSubnet);
|
||||
if (ipNetwork.Contains(address))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignoring - invalid subnet passed encountered.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool IsInLocalNetworkInternal(string endpoint, bool resolveHost)
|
||||
{
|
||||
if (string.IsNullOrEmpty(endpoint))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(endpoint));
|
||||
}
|
||||
|
||||
if (IPAddress.TryParse(endpoint, out var address))
|
||||
{
|
||||
var addressString = address.ToString();
|
||||
|
||||
var localSubnetsFn = LocalSubnetsFn;
|
||||
if (localSubnetsFn != null)
|
||||
{
|
||||
var localSubnets = localSubnetsFn();
|
||||
foreach (var subnet in localSubnets)
|
||||
{
|
||||
// Only validate if there's at least one valid entry.
|
||||
if (!string.IsNullOrWhiteSpace(subnet))
|
||||
{
|
||||
return IsAddressInSubnets(address, addressString, localSubnets) || IsInPrivateAddressSpace(addressString, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int lengthMatch = 100;
|
||||
if (address.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
lengthMatch = 4;
|
||||
if (IsInPrivateAddressSpace(addressString, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (address.AddressFamily == AddressFamily.InterNetworkV6)
|
||||
{
|
||||
lengthMatch = 9;
|
||||
if (IsInPrivateAddressSpace(endpoint, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Should be even be doing this with ipv6?
|
||||
if (addressString.Length >= lengthMatch)
|
||||
{
|
||||
var prefix = addressString.Substring(0, lengthMatch);
|
||||
|
||||
if (GetLocalIpAddresses().Any(i => i.ToString().StartsWith(prefix, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (resolveHost)
|
||||
{
|
||||
if (Uri.TryCreate(endpoint, UriKind.RelativeOrAbsolute, out var uri))
|
||||
{
|
||||
try
|
||||
{
|
||||
var host = uri.DnsSafeHost;
|
||||
_logger.LogDebug("Resolving host {0}", host);
|
||||
|
||||
address = GetIpAddresses(host).GetAwaiter().GetResult().FirstOrDefault();
|
||||
|
||||
if (address != null)
|
||||
{
|
||||
_logger.LogDebug("{0} resolved to {1}", host, address);
|
||||
|
||||
return IsInLocalNetworkInternal(address.ToString(), false);
|
||||
}
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
// Can happen with reverse proxy or IIS url rewriting?
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error resolving hostname");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Task<IPAddress[]> GetIpAddresses(string hostName)
|
||||
{
|
||||
return Dns.GetHostAddressesAsync(hostName);
|
||||
}
|
||||
|
||||
private IEnumerable<IPAddress> GetIPsDefault()
|
||||
{
|
||||
IEnumerable<NetworkInterface> interfaces;
|
||||
|
||||
try
|
||||
{
|
||||
interfaces = NetworkInterface.GetAllNetworkInterfaces()
|
||||
.Where(x => x.OperationalStatus == OperationalStatus.Up
|
||||
|| x.OperationalStatus == OperationalStatus.Unknown);
|
||||
}
|
||||
catch (NetworkInformationException ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in GetAllNetworkInterfaces");
|
||||
return Enumerable.Empty<IPAddress>();
|
||||
}
|
||||
|
||||
return interfaces.SelectMany(network =>
|
||||
{
|
||||
var ipProperties = network.GetIPProperties();
|
||||
|
||||
// Exclude any addresses if they appear in the LAN list in [ ]
|
||||
|
||||
return ipProperties.UnicastAddresses
|
||||
.Select(i => i.Address)
|
||||
.Where(i => i.AddressFamily == AddressFamily.InterNetwork || i.AddressFamily == AddressFamily.InterNetworkV6);
|
||||
}).GroupBy(i => i.ToString())
|
||||
.Select(x => x.First());
|
||||
}
|
||||
|
||||
private static async Task<IEnumerable<IPAddress>> GetLocalIpAddressesFallback()
|
||||
{
|
||||
var host = await Dns.GetHostEntryAsync(Dns.GetHostName()).ConfigureAwait(false);
|
||||
|
||||
// Reverse them because the last one is usually the correct one
|
||||
// It's not fool-proof so ultimately the consumer will have to examine them and decide
|
||||
return host.AddressList
|
||||
.Where(i => i.AddressFamily == AddressFamily.InterNetwork || i.AddressFamily == AddressFamily.InterNetworkV6)
|
||||
.Reverse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a random port number that is currently available.
|
||||
/// </summary>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int GetRandomUnusedTcpPort()
|
||||
{
|
||||
var listener = new TcpListener(IPAddress.Any, 0);
|
||||
listener.Start();
|
||||
var port = ((IPEndPoint)listener.LocalEndpoint).Port;
|
||||
listener.Stop();
|
||||
return port;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int GetRandomUnusedUdpPort()
|
||||
{
|
||||
var localEndPoint = new IPEndPoint(IPAddress.Any, 0);
|
||||
using (var udpClient = new UdpClient(localEndPoint))
|
||||
{
|
||||
return ((IPEndPoint)udpClient.Client.LocalEndPoint).Port;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public List<PhysicalAddress> GetMacAddresses()
|
||||
{
|
||||
return _macAddresses ??= GetMacAddressesInternal().ToList();
|
||||
}
|
||||
|
||||
private static IEnumerable<PhysicalAddress> GetMacAddressesInternal()
|
||||
=> NetworkInterface.GetAllNetworkInterfaces()
|
||||
.Where(i => i.NetworkInterfaceType != NetworkInterfaceType.Loopback)
|
||||
.Select(x => x.GetPhysicalAddress())
|
||||
.Where(x => !x.Equals(PhysicalAddress.None));
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsInSameSubnet(IPAddress address1, IPAddress address2, IPAddress subnetMask)
|
||||
{
|
||||
IPAddress network1 = GetNetworkAddress(address1, subnetMask);
|
||||
IPAddress network2 = GetNetworkAddress(address2, subnetMask);
|
||||
return network1.Equals(network2);
|
||||
}
|
||||
|
||||
private IPAddress GetNetworkAddress(IPAddress address, IPAddress subnetMask)
|
||||
{
|
||||
byte[] ipAdressBytes = address.GetAddressBytes();
|
||||
byte[] subnetMaskBytes = subnetMask.GetAddressBytes();
|
||||
|
||||
if (ipAdressBytes.Length != subnetMaskBytes.Length)
|
||||
{
|
||||
throw new ArgumentException("Lengths of IP address and subnet mask do not match.");
|
||||
}
|
||||
|
||||
byte[] broadcastAddress = new byte[ipAdressBytes.Length];
|
||||
for (int i = 0; i < broadcastAddress.Length; i++)
|
||||
{
|
||||
broadcastAddress[i] = (byte)(ipAdressBytes[i] & subnetMaskBytes[i]);
|
||||
}
|
||||
|
||||
return new IPAddress(broadcastAddress);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IPAddress GetLocalIpSubnetMask(IPAddress address)
|
||||
{
|
||||
NetworkInterface[] interfaces;
|
||||
|
||||
try
|
||||
{
|
||||
var validStatuses = new[] { OperationalStatus.Up, OperationalStatus.Unknown };
|
||||
|
||||
interfaces = NetworkInterface.GetAllNetworkInterfaces()
|
||||
.Where(i => validStatuses.Contains(i.OperationalStatus))
|
||||
.ToArray();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error in GetAllNetworkInterfaces");
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach (NetworkInterface ni in interfaces)
|
||||
{
|
||||
foreach (UnicastIPAddressInformation ip in ni.GetIPProperties().UnicastAddresses)
|
||||
{
|
||||
if (ip.Address.Equals(address) && ip.IPv4Mask != null)
|
||||
{
|
||||
return ip.IPv4Mask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.Playlists
|
||||
await playlist.RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(_fileSystem)) { ForceSave = true }, CancellationToken.None)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (options.ItemIdList.Length > 0)
|
||||
if (options.ItemIdList.Count > 0)
|
||||
{
|
||||
await AddToPlaylistInternal(playlist.Id, options.ItemIdList, user, new DtoOptions(false)
|
||||
{
|
||||
@@ -184,7 +184,7 @@ namespace Emby.Server.Implementations.Playlists
|
||||
return Playlist.GetPlaylistItems(playlistMediaType, items, user, options);
|
||||
}
|
||||
|
||||
public Task AddToPlaylistAsync(Guid playlistId, ICollection<Guid> itemIds, Guid userId)
|
||||
public Task AddToPlaylistAsync(Guid playlistId, IReadOnlyCollection<Guid> itemIds, Guid userId)
|
||||
{
|
||||
var user = userId.Equals(Guid.Empty) ? null : _userManager.GetUserById(userId);
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace Emby.Server.Implementations.Playlists
|
||||
});
|
||||
}
|
||||
|
||||
private async Task AddToPlaylistInternal(Guid playlistId, ICollection<Guid> newItemIds, User user, DtoOptions options)
|
||||
private async Task AddToPlaylistInternal(Guid playlistId, IReadOnlyCollection<Guid> newItemIds, User user, DtoOptions options)
|
||||
{
|
||||
// Retrieve the existing playlist
|
||||
var playlist = _libraryManager.GetItemById(playlistId) as Playlist
|
||||
|
||||
@@ -243,7 +243,7 @@ namespace Emby.Server.Implementations.QuickConnect
|
||||
Span<byte> bytes = stackalloc byte[length];
|
||||
_rng.GetBytes(bytes);
|
||||
|
||||
return Hex.Encode(bytes);
|
||||
return Convert.ToHexString(bytes);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using MediaBrowser.Model.IO;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Emby.Server.Implementations
|
||||
{
|
||||
public class ResourceFileManager : IResourceFileManager
|
||||
{
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly ILogger<ResourceFileManager> _logger;
|
||||
|
||||
public ResourceFileManager(ILogger<ResourceFileManager> logger, IFileSystem fileSystem)
|
||||
{
|
||||
_logger = logger;
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
public string GetResourcePath(string basePath, string virtualPath)
|
||||
{
|
||||
var fullPath = Path.Combine(basePath, virtualPath.Replace('/', Path.DirectorySeparatorChar));
|
||||
|
||||
try
|
||||
{
|
||||
fullPath = Path.GetFullPath(fullPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error retrieving full path");
|
||||
}
|
||||
|
||||
// Don't allow file system access outside of the source folder
|
||||
if (!_fileSystem.ContainsSubPath(basePath, fullPath))
|
||||
{
|
||||
throw new SecurityException("Access denied");
|
||||
}
|
||||
|
||||
return fullPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -653,7 +653,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
try
|
||||
{
|
||||
_logger.LogInformation(Name + ": Waiting on Task");
|
||||
var exited = Task.WaitAll(new[] { task }, 2000);
|
||||
var exited = task.Wait(2000);
|
||||
|
||||
if (exited)
|
||||
{
|
||||
@@ -703,7 +703,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
MaxRuntimeTicks = info.MaxRuntimeTicks
|
||||
};
|
||||
|
||||
if (info.Type.Equals(typeof(DailyTrigger).Name, StringComparison.OrdinalIgnoreCase))
|
||||
if (info.Type.Equals(nameof(DailyTrigger), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (!info.TimeOfDayTicks.HasValue)
|
||||
{
|
||||
@@ -717,7 +717,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
};
|
||||
}
|
||||
|
||||
if (info.Type.Equals(typeof(WeeklyTrigger).Name, StringComparison.OrdinalIgnoreCase))
|
||||
if (info.Type.Equals(nameof(WeeklyTrigger), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (!info.TimeOfDayTicks.HasValue)
|
||||
{
|
||||
@@ -737,7 +737,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
};
|
||||
}
|
||||
|
||||
if (info.Type.Equals(typeof(IntervalTrigger).Name, StringComparison.OrdinalIgnoreCase))
|
||||
if (info.Type.Equals(nameof(IntervalTrigger), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (!info.IntervalTicks.HasValue)
|
||||
{
|
||||
@@ -751,7 +751,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
};
|
||||
}
|
||||
|
||||
if (info.Type.Equals(typeof(StartupTrigger).Name, StringComparison.OrdinalIgnoreCase))
|
||||
if (info.Type.Equals(nameof(StartupTrigger), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new StartupTrigger();
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
{
|
||||
var type = scheduledTask.ScheduledTask.GetType();
|
||||
|
||||
_logger.LogInformation("Queueing task {0}", type.Name);
|
||||
_logger.LogInformation("Queuing task {0}", type.Name);
|
||||
|
||||
lock (_taskQueue)
|
||||
{
|
||||
@@ -176,7 +176,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
{
|
||||
var type = task.ScheduledTask.GetType();
|
||||
|
||||
_logger.LogInformation("Queueing task {0}", type.Name);
|
||||
_logger.LogInformation("Queuing task {0}", type.Name);
|
||||
|
||||
lock (_taskQueue)
|
||||
{
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
try
|
||||
{
|
||||
previouslyFailedImages = File.ReadAllText(failHistoryPath)
|
||||
.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Split('|', StringSplitOptions.RemoveEmptyEntries)
|
||||
.ToList();
|
||||
}
|
||||
catch (IOException)
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Model.Activity;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
|
||||
namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Deletes old activity log entries.
|
||||
/// </summary>
|
||||
public class CleanActivityLogTask : IScheduledTask, IConfigurableScheduledTask
|
||||
{
|
||||
private readonly ILocalizationManager _localization;
|
||||
private readonly IActivityManager _activityManager;
|
||||
private readonly IServerConfigurationManager _serverConfigurationManager;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CleanActivityLogTask"/> class.
|
||||
/// </summary>
|
||||
/// <param name="localization">Instance of the <see cref="ILocalizationManager"/> interface.</param>
|
||||
/// <param name="activityManager">Instance of the <see cref="IActivityManager"/> interface.</param>
|
||||
/// <param name="serverConfigurationManager">Instance of the <see cref="IServerConfigurationManager"/> interface.</param>
|
||||
public CleanActivityLogTask(
|
||||
ILocalizationManager localization,
|
||||
IActivityManager activityManager,
|
||||
IServerConfigurationManager serverConfigurationManager)
|
||||
{
|
||||
_localization = localization;
|
||||
_activityManager = activityManager;
|
||||
_serverConfigurationManager = serverConfigurationManager;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => _localization.GetLocalizedString("TaskCleanActivityLog");
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Key => "CleanActivityLog";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Description => _localization.GetLocalizedString("TaskCleanActivityLogDescription");
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Category => _localization.GetLocalizedString("TasksMaintenanceCategory");
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsHidden => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsEnabled => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsLogged => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
|
||||
{
|
||||
var retentionDays = _serverConfigurationManager.Configuration.ActivityLogRetentionDays;
|
||||
if (!retentionDays.HasValue || retentionDays <= 0)
|
||||
{
|
||||
throw new Exception($"Activity Log Retention days must be at least 0. Currently: {retentionDays}");
|
||||
}
|
||||
|
||||
var startDate = DateTime.UtcNow.AddDays(retentionDays.Value * -1);
|
||||
return _activityManager.CleanAsync(startDate);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||
{
|
||||
return Enumerable.Empty<TaskTriggerInfo>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Updates;
|
||||
@@ -101,7 +102,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
throw;
|
||||
}
|
||||
}
|
||||
catch (HttpException ex)
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error downloading {0}", package.Name);
|
||||
}
|
||||
|
||||
@@ -104,6 +104,6 @@ namespace Emby.Server.Implementations
|
||||
public string InternalMetadataPath { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string VirtualInternalMetadataPath { get; } = "%MetadataPath%";
|
||||
public string VirtualInternalMetadataPath => "%MetadataPath%";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,8 +58,7 @@ namespace Emby.Server.Implementations.Session
|
||||
/// <summary>
|
||||
/// The active connections.
|
||||
/// </summary>
|
||||
private readonly ConcurrentDictionary<string, SessionInfo> _activeConnections =
|
||||
new ConcurrentDictionary<string, SessionInfo>(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly ConcurrentDictionary<string, SessionInfo> _activeConnections = new (StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
private Timer _idleTimer;
|
||||
|
||||
@@ -196,7 +195,7 @@ namespace Emby.Server.Implementations.Session
|
||||
{
|
||||
if (!string.IsNullOrEmpty(info.DeviceId))
|
||||
{
|
||||
var capabilities = GetSavedCapabilities(info.DeviceId);
|
||||
var capabilities = _deviceManager.GetCapabilities(info.DeviceId);
|
||||
|
||||
if (capabilities != null)
|
||||
{
|
||||
@@ -1675,27 +1674,10 @@ namespace Emby.Server.Implementations.Session
|
||||
SessionInfo = session
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
SaveCapabilities(session.DeviceId, capabilities);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Error saving device capabilities", ex);
|
||||
}
|
||||
_deviceManager.SaveCapabilities(session.DeviceId, capabilities);
|
||||
}
|
||||
}
|
||||
|
||||
private ClientCapabilities GetSavedCapabilities(string deviceId)
|
||||
{
|
||||
return _deviceManager.GetCapabilities(deviceId);
|
||||
}
|
||||
|
||||
private void SaveCapabilities(string deviceId, ClientCapabilities capabilities)
|
||||
{
|
||||
_deviceManager.SaveCapabilities(deviceId, capabilities);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a BaseItem to a BaseItemInfo.
|
||||
/// </summary>
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Linq;
|
||||
using System.Net.WebSockets;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Model.Net;
|
||||
@@ -55,9 +56,9 @@ namespace Emby.Server.Implementations.Session
|
||||
connection.Closed += OnConnectionClosed;
|
||||
}
|
||||
|
||||
private void OnConnectionClosed(object sender, EventArgs e)
|
||||
private void OnConnectionClosed(object? sender, EventArgs e)
|
||||
{
|
||||
var connection = (IWebSocketConnection)sender;
|
||||
var connection = sender as IWebSocketConnection ?? throw new ArgumentException($"{nameof(sender)} is not of type {nameof(IWebSocketConnection)}", nameof(sender));
|
||||
_logger.LogDebug("Removing websocket from session {Session}", _session.Id);
|
||||
_sockets.Remove(connection);
|
||||
connection.Closed -= OnConnectionClosed;
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Emby.Server.Implementations.SyncPlay
|
||||
new Dictionary<Guid, IGroupController>();
|
||||
|
||||
/// <summary>
|
||||
/// Lock used for accessing the list of groups.
|
||||
/// Lock used for accessing any group.
|
||||
/// </summary>
|
||||
private readonly object _groupsLock = new object();
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace Emby.Server.Implementations.TV
|
||||
.GetItemList(
|
||||
new InternalItemsQuery(user)
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(Episode).Name },
|
||||
IncludeItemTypes = new[] { nameof(Episode) },
|
||||
OrderBy = new[] { new ValueTuple<string, SortOrder>(ItemSortBy.DatePlayed, SortOrder.Descending) },
|
||||
SeriesPresentationUniqueKey = presentationUniqueKey,
|
||||
Limit = limit,
|
||||
@@ -214,7 +214,7 @@ namespace Emby.Server.Implementations.TV
|
||||
{
|
||||
AncestorWithPresentationUniqueKey = null,
|
||||
SeriesPresentationUniqueKey = seriesKey,
|
||||
IncludeItemTypes = new[] { typeof(Episode).Name },
|
||||
IncludeItemTypes = new[] { nameof(Episode) },
|
||||
OrderBy = new[] { new ValueTuple<string, SortOrder>(ItemSortBy.SortName, SortOrder.Ascending) },
|
||||
Limit = 1,
|
||||
IsPlayed = false,
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Emby.Server.Implementations.Udp
|
||||
{
|
||||
string localUrl = !string.IsNullOrEmpty(_config[AddressOverrideConfigKey])
|
||||
? _config[AddressOverrideConfigKey]
|
||||
: await _appHost.GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
|
||||
: _appHost.GetSmartApiUrl(((IPEndPoint)endpoint).Address);
|
||||
|
||||
if (!string.IsNullOrEmpty(localUrl))
|
||||
{
|
||||
|
||||
@@ -6,23 +6,25 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Net.Http.Json;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Events;
|
||||
using MediaBrowser.Common;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Json;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Common.Updates;
|
||||
using MediaBrowser.Common.System;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Events;
|
||||
using MediaBrowser.Controller.Events.Updates;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Net;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Updates;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MediaBrowser.Model.System;
|
||||
|
||||
namespace Emby.Server.Implementations.Updates
|
||||
{
|
||||
@@ -36,16 +38,17 @@ namespace Emby.Server.Implementations.Updates
|
||||
/// </summary>
|
||||
private readonly ILogger<InstallationManager> _logger;
|
||||
private readonly IApplicationPaths _appPaths;
|
||||
private readonly IEventManager _eventManager;
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly JsonSerializerOptions _jsonSerializerOptions;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the application host.
|
||||
/// </summary>
|
||||
/// <value>The application host.</value>
|
||||
private readonly IApplicationHost _applicationHost;
|
||||
private readonly IServerApplicationHost _applicationHost;
|
||||
|
||||
private readonly IZipClient _zipClient;
|
||||
|
||||
@@ -63,85 +66,65 @@ namespace Emby.Server.Implementations.Updates
|
||||
|
||||
public InstallationManager(
|
||||
ILogger<InstallationManager> logger,
|
||||
IApplicationHost appHost,
|
||||
IServerApplicationHost appHost,
|
||||
IApplicationPaths appPaths,
|
||||
IEventManager eventManager,
|
||||
IHttpClientFactory httpClientFactory,
|
||||
IJsonSerializer jsonSerializer,
|
||||
IServerConfigurationManager config,
|
||||
IFileSystem fileSystem,
|
||||
IZipClient zipClient)
|
||||
{
|
||||
if (logger == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
|
||||
_currentInstallations = new List<(InstallationInfo, CancellationTokenSource)>();
|
||||
_completedInstallationsInternal = new ConcurrentBag<InstallationInfo>();
|
||||
|
||||
_logger = logger;
|
||||
_applicationHost = appHost;
|
||||
_appPaths = appPaths;
|
||||
_eventManager = eventManager;
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_config = config;
|
||||
_fileSystem = fileSystem;
|
||||
_zipClient = zipClient;
|
||||
_jsonSerializerOptions = JsonDefaults.GetOptions();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<InstallationInfo> PackageInstalling;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<InstallationInfo> PackageInstallationCompleted;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<InstallationFailedEventArgs> PackageInstallationFailed;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<InstallationInfo> PackageInstallationCancelled;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<IPlugin> PluginUninstalled;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<InstallationInfo> PluginUpdated;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<InstallationInfo> PluginInstalled;
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<InstallationInfo> CompletedInstallations => _completedInstallationsInternal;
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<PackageInfo>> GetPackages(string manifest, CancellationToken cancellationToken = default)
|
||||
public async Task<IList<PackageInfo>> GetPackages(string manifestName, string manifest, CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var response = await _httpClientFactory.CreateClient(NamedClient.Default)
|
||||
.GetAsync(manifest, cancellationToken).ConfigureAwait(false);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
|
||||
try
|
||||
var packages = await _httpClientFactory.CreateClient(NamedClient.Default)
|
||||
.GetFromJsonAsync<List<PackageInfo>>(new Uri(manifest), _jsonSerializerOptions, cancellationToken).ConfigureAwait(false);
|
||||
if (packages == null)
|
||||
{
|
||||
return await _jsonSerializer.DeserializeFromStreamAsync<IReadOnlyList<PackageInfo>>(stream).ConfigureAwait(false);
|
||||
}
|
||||
catch (SerializationException ex)
|
||||
{
|
||||
_logger.LogError(ex, "Failed to deserialize the plugin manifest retrieved from {Manifest}", manifest);
|
||||
return Array.Empty<PackageInfo>();
|
||||
}
|
||||
|
||||
// Store the repository and repository url with each version, as they may be spread apart.
|
||||
foreach (var entry in packages)
|
||||
{
|
||||
foreach (var ver in entry.versions)
|
||||
{
|
||||
ver.repositoryName = manifestName;
|
||||
ver.repositoryUrl = manifest;
|
||||
}
|
||||
}
|
||||
|
||||
return packages;
|
||||
}
|
||||
catch (JsonException ex)
|
||||
{
|
||||
_logger.LogError(ex, "Failed to deserialize the plugin manifest retrieved from {Manifest}", manifest);
|
||||
return Array.Empty<PackageInfo>();
|
||||
}
|
||||
catch (UriFormatException ex)
|
||||
{
|
||||
_logger.LogError(ex, "The URL configured for the plugin repository manifest URL is not valid: {Manifest}", manifest);
|
||||
return Array.Empty<PackageInfo>();
|
||||
}
|
||||
catch (HttpException ex)
|
||||
{
|
||||
_logger.LogError(ex, "An error occurred while accessing the plugin manifest: {Manifest}", manifest);
|
||||
return Array.Empty<PackageInfo>();
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
_logger.LogError(ex, "An error occurred while accessing the plugin manifest: {Manifest}", manifest);
|
||||
@@ -149,17 +132,75 @@ namespace Emby.Server.Implementations.Updates
|
||||
}
|
||||
}
|
||||
|
||||
private static void MergeSort(IList<VersionInfo> source, IList<VersionInfo> dest)
|
||||
{
|
||||
int sLength = source.Count - 1;
|
||||
int dLength = dest.Count;
|
||||
int s = 0, d = 0;
|
||||
var sourceVersion = source[0].VersionNumber;
|
||||
var destVersion = dest[0].VersionNumber;
|
||||
|
||||
while (d < dLength)
|
||||
{
|
||||
if (sourceVersion.CompareTo(destVersion) >= 0)
|
||||
{
|
||||
if (s < sLength)
|
||||
{
|
||||
sourceVersion = source[++s].VersionNumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Append all of destination to the end of source.
|
||||
while (d < dLength)
|
||||
{
|
||||
source.Add(dest[d++]);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
source.Insert(s++, dest[d++]);
|
||||
if (d >= dLength)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
sLength++;
|
||||
destVersion = dest[d].VersionNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken = default)
|
||||
{
|
||||
var result = new List<PackageInfo>();
|
||||
foreach (RepositoryInfo repository in _config.Configuration.PluginRepositories)
|
||||
{
|
||||
foreach (var package in await GetPackages(repository.Url, cancellationToken).ConfigureAwait(true))
|
||||
if (repository.Enabled)
|
||||
{
|
||||
package.repositoryName = repository.Name;
|
||||
package.repositoryUrl = repository.Url;
|
||||
result.Add(package);
|
||||
// Where repositories have the same content, the details of the first is taken.
|
||||
foreach (var package in await GetPackages(repository.Name, repository.Url, cancellationToken).ConfigureAwait(true))
|
||||
{
|
||||
if (!Guid.TryParse(package.guid, out var packageGuid))
|
||||
{
|
||||
// Package doesn't have a valid GUID, skip.
|
||||
continue;
|
||||
}
|
||||
|
||||
var existing = FilterPackages(result, package.name, packageGuid).FirstOrDefault();
|
||||
if (existing != null)
|
||||
{
|
||||
// Assumption is both lists are ordered, so slot these into the correct place.
|
||||
MergeSort(existing.versions, package.versions);
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Add(package);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +211,8 @@ namespace Emby.Server.Implementations.Updates
|
||||
public IEnumerable<PackageInfo> FilterPackages(
|
||||
IEnumerable<PackageInfo> availablePackages,
|
||||
string name = null,
|
||||
Guid guid = default)
|
||||
Guid guid = default,
|
||||
Version specificVersion = null)
|
||||
{
|
||||
if (name != null)
|
||||
{
|
||||
@@ -182,6 +224,11 @@ namespace Emby.Server.Implementations.Updates
|
||||
availablePackages = availablePackages.Where(x => Guid.Parse(x.guid) == guid);
|
||||
}
|
||||
|
||||
if (specificVersion != null)
|
||||
{
|
||||
availablePackages = availablePackages.Where(x => x.versions.Where(y => y.VersionNumber.Equals(specificVersion)).Any());
|
||||
}
|
||||
|
||||
return availablePackages;
|
||||
}
|
||||
|
||||
@@ -193,7 +240,7 @@ namespace Emby.Server.Implementations.Updates
|
||||
Version minVersion = null,
|
||||
Version specificVersion = null)
|
||||
{
|
||||
var package = FilterPackages(availablePackages, name, guid).FirstOrDefault();
|
||||
var package = FilterPackages(availablePackages, name, guid, specificVersion).FirstOrDefault();
|
||||
|
||||
// Package not found in repository
|
||||
if (package == null)
|
||||
@@ -207,21 +254,21 @@ namespace Emby.Server.Implementations.Updates
|
||||
|
||||
if (specificVersion != null)
|
||||
{
|
||||
availableVersions = availableVersions.Where(x => new Version(x.version) == specificVersion);
|
||||
availableVersions = availableVersions.Where(x => x.VersionNumber.Equals(specificVersion));
|
||||
}
|
||||
else if (minVersion != null)
|
||||
{
|
||||
availableVersions = availableVersions.Where(x => new Version(x.version) >= minVersion);
|
||||
availableVersions = availableVersions.Where(x => x.VersionNumber >= minVersion);
|
||||
}
|
||||
|
||||
foreach (var v in availableVersions.OrderByDescending(x => x.version))
|
||||
foreach (var v in availableVersions.OrderByDescending(x => x.VersionNumber))
|
||||
{
|
||||
yield return new InstallationInfo
|
||||
{
|
||||
Changelog = v.changelog,
|
||||
Guid = new Guid(package.guid),
|
||||
Name = package.name,
|
||||
Version = new Version(v.version),
|
||||
Version = v.VersionNumber,
|
||||
SourceUrl = v.sourceUrl,
|
||||
Checksum = v.checksum
|
||||
};
|
||||
@@ -237,7 +284,8 @@ namespace Emby.Server.Implementations.Updates
|
||||
|
||||
private IEnumerable<InstallationInfo> GetAvailablePluginUpdates(IReadOnlyList<PackageInfo> pluginCatalog)
|
||||
{
|
||||
foreach (var plugin in _applicationHost.Plugins)
|
||||
var plugins = _applicationHost.GetLocalPlugins(_appPaths.PluginsPath);
|
||||
foreach (var plugin in plugins)
|
||||
{
|
||||
var compatibleVersions = GetCompatibleVersions(pluginCatalog, plugin.Name, plugin.Id, minVersion: plugin.Version);
|
||||
var version = compatibleVersions.FirstOrDefault(y => y.Version > plugin.Version);
|
||||
@@ -266,13 +314,14 @@ namespace Emby.Server.Implementations.Updates
|
||||
_currentInstallations.Add(tuple);
|
||||
}
|
||||
|
||||
var linkedToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, innerCancellationTokenSource.Token).Token;
|
||||
using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, innerCancellationTokenSource.Token);
|
||||
var linkedToken = linkedTokenSource.Token;
|
||||
|
||||
PackageInstalling?.Invoke(this, package);
|
||||
await _eventManager.PublishAsync(new PluginInstallingEventArgs(package)).ConfigureAwait(false);
|
||||
|
||||
try
|
||||
{
|
||||
await InstallPackageInternal(package, linkedToken).ConfigureAwait(false);
|
||||
var isUpdate = await InstallPackageInternal(package, linkedToken).ConfigureAwait(false);
|
||||
|
||||
lock (_currentInstallationsLock)
|
||||
{
|
||||
@@ -280,8 +329,11 @@ namespace Emby.Server.Implementations.Updates
|
||||
}
|
||||
|
||||
_completedInstallationsInternal.Add(package);
|
||||
await _eventManager.PublishAsync(isUpdate
|
||||
? (GenericEventArgs<InstallationInfo>)new PluginUpdatedEventArgs(package)
|
||||
: new PluginInstalledEventArgs(package)).ConfigureAwait(false);
|
||||
|
||||
PackageInstallationCompleted?.Invoke(this, package);
|
||||
_applicationHost.NotifyPendingRestart();
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
@@ -292,7 +344,7 @@ namespace Emby.Server.Implementations.Updates
|
||||
|
||||
_logger.LogInformation("Package installation cancelled: {0} {1}", package.Name, package.Version);
|
||||
|
||||
PackageInstallationCancelled?.Invoke(this, package);
|
||||
await _eventManager.PublishAsync(new PluginInstallationCancelledEventArgs(package)).ConfigureAwait(false);
|
||||
|
||||
throw;
|
||||
}
|
||||
@@ -305,11 +357,11 @@ namespace Emby.Server.Implementations.Updates
|
||||
_currentInstallations.Remove(tuple);
|
||||
}
|
||||
|
||||
PackageInstallationFailed?.Invoke(this, new InstallationFailedEventArgs
|
||||
await _eventManager.PublishAsync(new InstallationFailedEventArgs
|
||||
{
|
||||
InstallationInfo = package,
|
||||
Exception = ex
|
||||
});
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
throw;
|
||||
}
|
||||
@@ -326,7 +378,7 @@ namespace Emby.Server.Implementations.Updates
|
||||
/// <param name="package">The package.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns><see cref="Task" />.</returns>
|
||||
private async Task InstallPackageInternal(InstallationInfo package, CancellationToken cancellationToken)
|
||||
private async Task<bool> InstallPackageInternal(InstallationInfo package, CancellationToken cancellationToken)
|
||||
{
|
||||
// Set last update time if we were installed before
|
||||
IPlugin plugin = _applicationHost.Plugins.FirstOrDefault(p => p.Id == package.Guid)
|
||||
@@ -336,20 +388,9 @@ namespace Emby.Server.Implementations.Updates
|
||||
await PerformPackageInstallation(package, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// Do plugin-specific processing
|
||||
if (plugin == null)
|
||||
{
|
||||
_logger.LogInformation("New plugin installed: {0} {1}", package.Name, package.Version);
|
||||
_logger.LogInformation(plugin == null ? "New plugin installed: {0} {1}" : "Plugin updated: {0} {1}", package.Name, package.Version);
|
||||
|
||||
PluginInstalled?.Invoke(this, package);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation("Plugin updated: {0} {1}", package.Name, package.Version);
|
||||
|
||||
PluginUpdated?.Invoke(this, package);
|
||||
}
|
||||
|
||||
_applicationHost.NotifyPendingRestart();
|
||||
return plugin != null;
|
||||
}
|
||||
|
||||
private async Task PerformPackageInstallation(InstallationInfo package, CancellationToken cancellationToken)
|
||||
@@ -365,15 +406,15 @@ namespace Emby.Server.Implementations.Updates
|
||||
string targetDir = Path.Combine(_appPaths.PluginsPath, package.Name);
|
||||
|
||||
using var response = await _httpClientFactory.CreateClient(NamedClient.Default)
|
||||
.GetAsync(package.SourceUrl, cancellationToken).ConfigureAwait(false);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
.GetAsync(new Uri(package.SourceUrl), cancellationToken).ConfigureAwait(false);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// CA5351: Do Not Use Broken Cryptographic Algorithms
|
||||
#pragma warning disable CA5351
|
||||
using var md5 = MD5.Create();
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var hash = Hex.Encode(md5.ComputeHash(stream));
|
||||
var hash = Convert.ToHexString(md5.ComputeHash(stream));
|
||||
if (!string.Equals(package.Checksum, hash, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
_logger.LogError(
|
||||
@@ -467,7 +508,7 @@ namespace Emby.Server.Implementations.Updates
|
||||
_config.SaveConfiguration();
|
||||
}
|
||||
|
||||
PluginUninstalled?.Invoke(this, plugin);
|
||||
_eventManager.Publish(new PluginUninstalledEventArgs(plugin));
|
||||
|
||||
_applicationHost.NotifyPendingRestart();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user