Compare commits
18 Commits
v10.7.0-rc4
...
v10.7.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a320b26b5 | |||
| 63868eca40 | |||
| f6e8493d69 | |||
| 3c3b536e81 | |||
| a10eea41ac | |||
| 42d0c1ac5f | |||
| b01290013e | |||
| 132335a747 | |||
| 75d3d120d3 | |||
| e8890cc682 | |||
| e4bf57c739 | |||
| 046dd7fa60 | |||
| 5e18ab3604 | |||
| 7545b1286b | |||
| b99db64f8f | |||
| 20810eedbe | |||
| 2d88b8346d | |||
| eafaccae5d |
@@ -49,6 +49,7 @@
|
|||||||
- [h1nk](https://github.com/h1nk)
|
- [h1nk](https://github.com/h1nk)
|
||||||
- [hawken93](https://github.com/hawken93)
|
- [hawken93](https://github.com/hawken93)
|
||||||
- [HelloWorld017](https://github.com/HelloWorld017)
|
- [HelloWorld017](https://github.com/HelloWorld017)
|
||||||
|
- [ikomhoog](https://github.com/ikomhoog)
|
||||||
- [jftuga](https://github.com/jftuga)
|
- [jftuga](https://github.com/jftuga)
|
||||||
- [joern-h](https://github.com/joern-h)
|
- [joern-h](https://github.com/joern-h)
|
||||||
- [joshuaboniface](https://github.com/joshuaboniface)
|
- [joshuaboniface](https://github.com/joshuaboniface)
|
||||||
|
|||||||
@@ -395,7 +395,8 @@ namespace Emby.Dlna
|
|||||||
{
|
{
|
||||||
Directory.CreateDirectory(systemProfilesPath);
|
Directory.CreateDirectory(systemProfilesPath);
|
||||||
|
|
||||||
using (var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read))
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
|
using (var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None))
|
||||||
{
|
{
|
||||||
await stream.CopyToAsync(fileStream).ConfigureAwait(false);
|
await stream.CopyToAsync(fileStream).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ namespace Emby.Dlna.Main
|
|||||||
_logger.LogInformation("Registering publisher for {0} on {1}", fullService, address);
|
_logger.LogInformation("Registering publisher for {0} on {1}", fullService, address);
|
||||||
|
|
||||||
var uri = new UriBuilder(_appHost.GetSmartApiUrl(address.Address) + descriptorUri);
|
var uri = new UriBuilder(_appHost.GetSmartApiUrl(address.Address) + descriptorUri);
|
||||||
if (_appHost.PublishedServerUrl == null)
|
if (!string.IsNullOrEmpty(_appHost.PublishedServerUrl))
|
||||||
{
|
{
|
||||||
// DLNA will only work over http, so we must reset to http:// : {port}.
|
// DLNA will only work over http, so we must reset to http:// : {port}.
|
||||||
uri.Scheme = "http";
|
uri.Scheme = "http";
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ namespace Emby.Dlna.PlayTo
|
|||||||
|
|
||||||
private async void OnDeviceMediaChanged(object sender, MediaChangedEventArgs e)
|
private async void OnDeviceMediaChanged(object sender, MediaChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_disposed)
|
if (_disposed || string.IsNullOrEmpty(e.OldMediaInfo.Url))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,12 @@ namespace Emby.Naming.Video
|
|||||||
|
|
||||||
private static bool TryClean(string name, Regex expression, out ReadOnlySpan<char> newName)
|
private static bool TryClean(string name, Regex expression, out ReadOnlySpan<char> newName)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
newName = ReadOnlySpan<char>.Empty;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var match = expression.Match(name);
|
var match = expression.Match(name);
|
||||||
int index = match.Index;
|
int index = match.Index;
|
||||||
if (match.Success && index != 0)
|
if (match.Success && index != 0)
|
||||||
@@ -41,7 +47,7 @@ namespace Emby.Naming.Video
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
newName = string.Empty;
|
newName = ReadOnlySpan<char>.Empty;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,10 +75,6 @@ namespace Emby.Notifications
|
|||||||
Type = NotificationType.VideoPlaybackStopped.ToString()
|
Type = NotificationType.VideoPlaybackStopped.ToString()
|
||||||
},
|
},
|
||||||
new NotificationTypeInfo
|
new NotificationTypeInfo
|
||||||
{
|
|
||||||
Type = NotificationType.CameraImageUploaded.ToString()
|
|
||||||
},
|
|
||||||
new NotificationTypeInfo
|
|
||||||
{
|
{
|
||||||
Type = NotificationType.UserLockedOut.ToString()
|
Type = NotificationType.UserLockedOut.ToString()
|
||||||
},
|
},
|
||||||
@@ -114,10 +110,6 @@ namespace Emby.Notifications
|
|||||||
{
|
{
|
||||||
note.Category = _localization.GetLocalizedString("Plugin");
|
note.Category = _localization.GetLocalizedString("Plugin");
|
||||||
}
|
}
|
||||||
else if (note.Type.IndexOf("CameraImageUploaded", StringComparison.OrdinalIgnoreCase) != -1)
|
|
||||||
{
|
|
||||||
note.Category = _localization.GetLocalizedString("Sync");
|
|
||||||
}
|
|
||||||
else if (note.Type.IndexOf("UserLockedOut", StringComparison.OrdinalIgnoreCase) != -1)
|
else if (note.Type.IndexOf("UserLockedOut", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
{
|
{
|
||||||
note.Category = _localization.GetLocalizedString("User");
|
note.Category = _localization.GetLocalizedString("User");
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ namespace Emby.Server.Implementations.AppBase
|
|||||||
|
|
||||||
Directory.CreateDirectory(directory);
|
Directory.CreateDirectory(directory);
|
||||||
// Save it after load in case we got new items
|
// Save it after load in case we got new items
|
||||||
using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read))
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
|
using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None))
|
||||||
{
|
{
|
||||||
fs.Write(newBytes, 0, newBytesLen);
|
fs.Write(newBytes, 0, newBytesLen);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ using Emby.Server.Implementations.Serialization;
|
|||||||
using Emby.Server.Implementations.Session;
|
using Emby.Server.Implementations.Session;
|
||||||
using Emby.Server.Implementations.SyncPlay;
|
using Emby.Server.Implementations.SyncPlay;
|
||||||
using Emby.Server.Implementations.TV;
|
using Emby.Server.Implementations.TV;
|
||||||
|
using Emby.Server.Implementations.Udp;
|
||||||
using Emby.Server.Implementations.Updates;
|
using Emby.Server.Implementations.Updates;
|
||||||
using Jellyfin.Api.Helpers;
|
using Jellyfin.Api.Helpers;
|
||||||
using Jellyfin.Networking.Configuration;
|
using Jellyfin.Networking.Configuration;
|
||||||
@@ -98,6 +99,7 @@ using MediaBrowser.Providers.Subtitles;
|
|||||||
using MediaBrowser.XbmcMetadata.Providers;
|
using MediaBrowser.XbmcMetadata.Providers;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Prometheus.DotNetRuntime;
|
using Prometheus.DotNetRuntime;
|
||||||
@@ -117,6 +119,7 @@ namespace Emby.Server.Implementations
|
|||||||
private static readonly string[] _relevantEnvVarPrefixes = { "JELLYFIN_", "DOTNET_", "ASPNETCORE_" };
|
private static readonly string[] _relevantEnvVarPrefixes = { "JELLYFIN_", "DOTNET_", "ASPNETCORE_" };
|
||||||
|
|
||||||
private readonly IFileSystem _fileSystemManager;
|
private readonly IFileSystem _fileSystemManager;
|
||||||
|
private readonly IConfiguration _startupConfig;
|
||||||
private readonly IXmlSerializer _xmlSerializer;
|
private readonly IXmlSerializer _xmlSerializer;
|
||||||
private readonly IJsonSerializer _jsonSerializer;
|
private readonly IJsonSerializer _jsonSerializer;
|
||||||
private readonly IStartupOptions _startupOptions;
|
private readonly IStartupOptions _startupOptions;
|
||||||
@@ -134,9 +137,6 @@ namespace Emby.Server.Implementations
|
|||||||
|
|
||||||
public bool CoreStartupHasCompleted { get; private set; }
|
public bool CoreStartupHasCompleted { get; private set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public Uri PublishedServerUrl => _startupOptions.PublishedServerUrl;
|
|
||||||
|
|
||||||
public virtual bool CanLaunchWebBrowser
|
public virtual bool CanLaunchWebBrowser
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -230,6 +230,11 @@ namespace Emby.Server.Implementations
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int HttpsPort { get; private set; }
|
public int HttpsPort { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the value of the PublishedServerUrl setting.
|
||||||
|
/// </summary>
|
||||||
|
public string PublishedServerUrl => _startupOptions.PublishedServerUrl ?? _startupConfig[UdpServer.AddressOverrideConfigKey];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the server configuration manager.
|
/// Gets the server configuration manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -242,12 +247,14 @@ namespace Emby.Server.Implementations
|
|||||||
/// <param name="applicationPaths">Instance of the <see cref="IServerApplicationPaths"/> interface.</param>
|
/// <param name="applicationPaths">Instance of the <see cref="IServerApplicationPaths"/> interface.</param>
|
||||||
/// <param name="loggerFactory">Instance of the <see cref="ILoggerFactory"/> interface.</param>
|
/// <param name="loggerFactory">Instance of the <see cref="ILoggerFactory"/> interface.</param>
|
||||||
/// <param name="options">Instance of the <see cref="IStartupOptions"/> interface.</param>
|
/// <param name="options">Instance of the <see cref="IStartupOptions"/> interface.</param>
|
||||||
|
/// <param name="startupConfig">The <see cref="IConfiguration" /> interface.</param>
|
||||||
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
|
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
|
||||||
/// <param name="serviceCollection">Instance of the <see cref="IServiceCollection"/> interface.</param>
|
/// <param name="serviceCollection">Instance of the <see cref="IServiceCollection"/> interface.</param>
|
||||||
public ApplicationHost(
|
public ApplicationHost(
|
||||||
IServerApplicationPaths applicationPaths,
|
IServerApplicationPaths applicationPaths,
|
||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory,
|
||||||
IStartupOptions options,
|
IStartupOptions options,
|
||||||
|
IConfiguration startupConfig,
|
||||||
IFileSystem fileSystem,
|
IFileSystem fileSystem,
|
||||||
IServiceCollection serviceCollection)
|
IServiceCollection serviceCollection)
|
||||||
{
|
{
|
||||||
@@ -271,6 +278,7 @@ namespace Emby.Server.Implementations
|
|||||||
Logger = LoggerFactory.CreateLogger<ApplicationHost>();
|
Logger = LoggerFactory.CreateLogger<ApplicationHost>();
|
||||||
|
|
||||||
_startupOptions = options;
|
_startupOptions = options;
|
||||||
|
_startupConfig = startupConfig;
|
||||||
|
|
||||||
// Initialize runtime stat collection
|
// Initialize runtime stat collection
|
||||||
if (ServerConfigurationManager.Configuration.EnableMetrics)
|
if (ServerConfigurationManager.Configuration.EnableMetrics)
|
||||||
@@ -1151,10 +1159,10 @@ namespace Emby.Server.Implementations
|
|||||||
public string GetSmartApiUrl(IPAddress ipAddress, int? port = null)
|
public string GetSmartApiUrl(IPAddress ipAddress, int? port = null)
|
||||||
{
|
{
|
||||||
// Published server ends with a /
|
// Published server ends with a /
|
||||||
if (_startupOptions.PublishedServerUrl != null)
|
if (!string.IsNullOrEmpty(PublishedServerUrl))
|
||||||
{
|
{
|
||||||
// Published server ends with a '/', so we need to remove it.
|
// Published server ends with a '/', so we need to remove it.
|
||||||
return _startupOptions.PublishedServerUrl.ToString().Trim('/');
|
return PublishedServerUrl.Trim('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
string smart = NetManager.GetBindInterface(ipAddress, out port);
|
string smart = NetManager.GetBindInterface(ipAddress, out port);
|
||||||
@@ -1171,10 +1179,10 @@ namespace Emby.Server.Implementations
|
|||||||
public string GetSmartApiUrl(HttpRequest request, int? port = null)
|
public string GetSmartApiUrl(HttpRequest request, int? port = null)
|
||||||
{
|
{
|
||||||
// Published server ends with a /
|
// Published server ends with a /
|
||||||
if (_startupOptions.PublishedServerUrl != null)
|
if (!string.IsNullOrEmpty(PublishedServerUrl))
|
||||||
{
|
{
|
||||||
// Published server ends with a '/', so we need to remove it.
|
// Published server ends with a '/', so we need to remove it.
|
||||||
return _startupOptions.PublishedServerUrl.ToString().Trim('/');
|
return PublishedServerUrl.Trim('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
string smart = NetManager.GetBindInterface(request, out port);
|
string smart = NetManager.GetBindInterface(request, out port);
|
||||||
@@ -1191,10 +1199,10 @@ namespace Emby.Server.Implementations
|
|||||||
public string GetSmartApiUrl(string hostname, int? port = null)
|
public string GetSmartApiUrl(string hostname, int? port = null)
|
||||||
{
|
{
|
||||||
// Published server ends with a /
|
// Published server ends with a /
|
||||||
if (_startupOptions.PublishedServerUrl != null)
|
if (!string.IsNullOrEmpty(PublishedServerUrl))
|
||||||
{
|
{
|
||||||
// Published server ends with a '/', so we need to remove it.
|
// Published server ends with a '/', so we need to remove it.
|
||||||
return _startupOptions.PublishedServerUrl.ToString().Trim('/');
|
return PublishedServerUrl.Trim('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
string smart = NetManager.GetBindInterface(hostname, out port);
|
string smart = NetManager.GetBindInterface(hostname, out port);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations
|
namespace Emby.Server.Implementations
|
||||||
@@ -9,7 +9,7 @@ namespace Emby.Server.Implementations
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the value of the --ffmpeg command line option.
|
/// Gets the value of the --ffmpeg command line option.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string FFmpegPath { get; }
|
string? FFmpegPath { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the value of the --service command line option.
|
/// Gets the value of the --service command line option.
|
||||||
@@ -19,21 +19,21 @@ namespace Emby.Server.Implementations
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the value of the --package-name command line option.
|
/// Gets the value of the --package-name command line option.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string PackageName { get; }
|
string? PackageName { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the value of the --restartpath command line option.
|
/// Gets the value of the --restartpath command line option.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string RestartPath { get; }
|
string? RestartPath { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the value of the --restartargs command line option.
|
/// Gets the value of the --restartargs command line option.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string RestartArgs { get; }
|
string? RestartArgs { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the value of the --published-server-url command line option.
|
/// Gets the value of the --published-server-url command line option.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Uri PublishedServerUrl { get; }
|
string? PublishedServerUrl { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1247,7 +1247,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
{
|
{
|
||||||
// TODO: @bond use a ReadOnlySpan<char> here when Enum.TryParse supports it
|
// TODO: @bond use a ReadOnlySpan<char> here when Enum.TryParse supports it
|
||||||
// https://github.com/dotnet/runtime/issues/20008
|
// https://github.com/dotnet/runtime/issues/20008
|
||||||
if (Enum.TryParse<CollectionTypeOptions>(Path.GetExtension(file), true, out var res))
|
if (Enum.TryParse<CollectionTypeOptions>(Path.GetFileNameWithoutExtension(file), true, out var res))
|
||||||
{
|
{
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -2776,6 +2776,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
|
|
||||||
public string GetPathAfterNetworkSubstitution(string path, BaseItem ownerItem)
|
public string GetPathAfterNetworkSubstitution(string path, BaseItem ownerItem)
|
||||||
{
|
{
|
||||||
|
string newPath;
|
||||||
if (ownerItem != null)
|
if (ownerItem != null)
|
||||||
{
|
{
|
||||||
var libraryOptions = GetLibraryOptions(ownerItem);
|
var libraryOptions = GetLibraryOptions(ownerItem);
|
||||||
@@ -2783,15 +2784,9 @@ namespace Emby.Server.Implementations.Library
|
|||||||
{
|
{
|
||||||
foreach (var pathInfo in libraryOptions.PathInfos)
|
foreach (var pathInfo in libraryOptions.PathInfos)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(pathInfo.Path) || string.IsNullOrWhiteSpace(pathInfo.NetworkPath))
|
if (path.TryReplaceSubPath(pathInfo.Path, pathInfo.NetworkPath, out newPath))
|
||||||
{
|
{
|
||||||
continue;
|
return newPath;
|
||||||
}
|
|
||||||
|
|
||||||
var substitutionResult = SubstitutePathInternal(path, pathInfo.Path, pathInfo.NetworkPath);
|
|
||||||
if (substitutionResult.Item2)
|
|
||||||
{
|
|
||||||
return substitutionResult.Item1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2800,24 +2795,16 @@ namespace Emby.Server.Implementations.Library
|
|||||||
var metadataPath = _configurationManager.Configuration.MetadataPath;
|
var metadataPath = _configurationManager.Configuration.MetadataPath;
|
||||||
var metadataNetworkPath = _configurationManager.Configuration.MetadataNetworkPath;
|
var metadataNetworkPath = _configurationManager.Configuration.MetadataNetworkPath;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(metadataPath) && !string.IsNullOrWhiteSpace(metadataNetworkPath))
|
if (path.TryReplaceSubPath(metadataPath, metadataNetworkPath, out newPath))
|
||||||
{
|
{
|
||||||
var metadataSubstitutionResult = SubstitutePathInternal(path, metadataPath, metadataNetworkPath);
|
return newPath;
|
||||||
if (metadataSubstitutionResult.Item2)
|
|
||||||
{
|
|
||||||
return metadataSubstitutionResult.Item1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var map in _configurationManager.Configuration.PathSubstitutions)
|
foreach (var map in _configurationManager.Configuration.PathSubstitutions)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(map.From))
|
if (path.TryReplaceSubPath(map.From, map.To, out newPath))
|
||||||
{
|
{
|
||||||
var substitutionResult = SubstitutePathInternal(path, map.From, map.To);
|
return newPath;
|
||||||
if (substitutionResult.Item2)
|
|
||||||
{
|
|
||||||
return substitutionResult.Item1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2826,47 +2813,12 @@ namespace Emby.Server.Implementations.Library
|
|||||||
|
|
||||||
public string SubstitutePath(string path, string from, string to)
|
public string SubstitutePath(string path, string from, string to)
|
||||||
{
|
{
|
||||||
return SubstitutePathInternal(path, from, to).Item1;
|
if (path.TryReplaceSubPath(from, to, out var newPath))
|
||||||
}
|
|
||||||
|
|
||||||
private Tuple<string, bool> SubstitutePathInternal(string path, string from, string to)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(path))
|
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(path));
|
return newPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(from))
|
return path;
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(from));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(to))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(to));
|
|
||||||
}
|
|
||||||
|
|
||||||
from = from.Trim();
|
|
||||||
to = to.Trim();
|
|
||||||
|
|
||||||
var newPath = path.Replace(from, to, StringComparison.OrdinalIgnoreCase);
|
|
||||||
var changed = false;
|
|
||||||
|
|
||||||
if (!string.Equals(newPath, path, StringComparison.Ordinal))
|
|
||||||
{
|
|
||||||
if (to.IndexOf('/', StringComparison.Ordinal) != -1)
|
|
||||||
{
|
|
||||||
newPath = newPath.Replace('\\', '/');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
newPath = newPath.Replace('/', '\\');
|
|
||||||
}
|
|
||||||
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Tuple<string, bool>(newPath, changed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetExtraTypeFromFilename(Video item)
|
private void SetExtraTypeFromFilename(Video item)
|
||||||
@@ -3001,7 +2953,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
|
|
||||||
if (collectionType != null)
|
if (collectionType != null)
|
||||||
{
|
{
|
||||||
var path = Path.Combine(virtualFolderPath, collectionType.ToString() + ".collection");
|
var path = Path.Combine(virtualFolderPath, collectionType.ToString().ToLowerInvariant() + ".collection");
|
||||||
|
|
||||||
File.WriteAllBytes(path, Array.Empty<byte>());
|
File.WriteAllBytes(path, Array.Empty<byte>());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library
|
namespace Emby.Server.Implementations.Library
|
||||||
@@ -47,5 +49,59 @@ namespace Emby.Server.Implementations.Library
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Replaces a sub path with another sub path and normalizes the final path.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">The original path.</param>
|
||||||
|
/// <param name="subPath">The original sub path.</param>
|
||||||
|
/// <param name="newSubPath">The new sub path.</param>
|
||||||
|
/// <param name="newPath">The result of the sub path replacement</param>
|
||||||
|
/// <returns>The path after replacing the sub path.</returns>
|
||||||
|
/// <exception cref="ArgumentNullException"><paramref name="path" />, <paramref name="newSubPath" /> or <paramref name="newSubPath" /> is empty.</exception>
|
||||||
|
public static bool TryReplaceSubPath(this string path, string subPath, string newSubPath, [NotNullWhen(true)] out string? newPath)
|
||||||
|
{
|
||||||
|
newPath = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(path) || string.IsNullOrEmpty(subPath) || string.IsNullOrEmpty(newSubPath) || subPath.Length > path.Length)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
char oldDirectorySeparatorChar;
|
||||||
|
char newDirectorySeparatorChar;
|
||||||
|
// True normalization is still not possible https://github.com/dotnet/runtime/issues/2162
|
||||||
|
// The reasoning behind this is that a forward slash likely means it's a Linux path and
|
||||||
|
// so the whole path should be normalized to use / and vice versa for Windows (although Windows doesn't care much).
|
||||||
|
if (newSubPath.Contains('/', StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
oldDirectorySeparatorChar = '\\';
|
||||||
|
newDirectorySeparatorChar = '/';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
oldDirectorySeparatorChar = '/';
|
||||||
|
newDirectorySeparatorChar = '\\';
|
||||||
|
}
|
||||||
|
|
||||||
|
path = path.Replace(oldDirectorySeparatorChar, newDirectorySeparatorChar);
|
||||||
|
subPath = subPath.Replace(oldDirectorySeparatorChar, newDirectorySeparatorChar);
|
||||||
|
|
||||||
|
// We have to ensure that the sub path ends with a directory separator otherwise we'll get weird results
|
||||||
|
// when the sub path matches a similar but in-complete subpath
|
||||||
|
var oldSubPathEndsWithSeparator = subPath[^1] == newDirectorySeparatorChar;
|
||||||
|
if (!path.StartsWith(subPath, StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| (!oldSubPathEndsWithSeparator && path[subPath.Length] != newDirectorySeparatorChar))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newSubPathTrimmed = newSubPath.AsSpan().TrimEnd(newDirectorySeparatorChar);
|
||||||
|
// Ensure that the path with the old subpath removed starts with a leading dir separator
|
||||||
|
int idx = oldSubPathEndsWithSeparator ? subPath.Length - 1 : subPath.Length;
|
||||||
|
newPath = string.Concat(newSubPathTrimmed, path.AsSpan(idx));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
{
|
{
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(targetFile));
|
Directory.CreateDirectory(Path.GetDirectoryName(targetFile));
|
||||||
|
|
||||||
using (var output = new FileStream(targetFile, FileMode.Create, FileAccess.Write, FileShare.Read))
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
|
using (var output = new FileStream(targetFile, FileMode.Create, FileAccess.Write, FileShare.None))
|
||||||
{
|
{
|
||||||
onStarted();
|
onStarted();
|
||||||
|
|
||||||
@@ -70,7 +71,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
|
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(targetFile));
|
Directory.CreateDirectory(Path.GetDirectoryName(targetFile));
|
||||||
|
|
||||||
await using var output = new FileStream(targetFile, FileMode.Create, FileAccess.Write, FileShare.Read);
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
|
await using var output = new FileStream(targetFile, FileMode.Create, FileAccess.Write, FileShare.None);
|
||||||
|
|
||||||
onStarted();
|
onStarted();
|
||||||
|
|
||||||
|
|||||||
@@ -1860,7 +1860,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var stream = new FileStream(nfoPath, FileMode.Create, FileAccess.Write, FileShare.Read))
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
|
using (var stream = new FileStream(nfoPath, FileMode.Create, FileAccess.Write, FileShare.None))
|
||||||
{
|
{
|
||||||
var settings = new XmlWriterSettings
|
var settings = new XmlWriterSettings
|
||||||
{
|
{
|
||||||
@@ -1924,7 +1925,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var stream = new FileStream(nfoPath, FileMode.Create, FileAccess.Write, FileShare.Read))
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
|
using (var stream = new FileStream(nfoPath, FileMode.Create, FileAccess.Write, FileShare.None))
|
||||||
{
|
{
|
||||||
var settings = new XmlWriterSettings
|
var settings = new XmlWriterSettings
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -93,7 +93,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
Directory.CreateDirectory(Path.GetDirectoryName(logFilePath));
|
Directory.CreateDirectory(Path.GetDirectoryName(logFilePath));
|
||||||
|
|
||||||
// FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory.
|
// FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory.
|
||||||
_logFileStream = new FileStream(logFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true);
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
|
_logFileStream = new FileStream(logFilePath, FileMode.Create, FileAccess.Write, FileShare.None, IODefaults.FileStreamBufferSize, true);
|
||||||
|
|
||||||
var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(_json.SerializeToString(mediaSource) + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine);
|
var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(_json.SerializeToString(mediaSource) + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine);
|
||||||
_logFileStream.Write(commandLineLogMessageBytes, 0, commandLineLogMessageBytes.Length);
|
_logFileStream.Write(commandLineLogMessageBytes, 0, commandLineLogMessageBytes.Length);
|
||||||
|
|||||||
@@ -193,7 +193,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||||||
{
|
{
|
||||||
var resolved = false;
|
var resolved = false;
|
||||||
|
|
||||||
using (var fileStream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.Read))
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
|
using (var fileStream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -136,7 +136,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
|||||||
Logger.LogInformation("Beginning {0} stream to {1}", GetType().Name, TempFilePath);
|
Logger.LogInformation("Beginning {0} stream to {1}", GetType().Name, TempFilePath);
|
||||||
using var message = response;
|
using var message = response;
|
||||||
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).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);
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
|
await using var fileStream = new FileStream(TempFilePath, FileMode.Create, FileAccess.Write, FileShare.None);
|
||||||
await StreamHelper.CopyToAsync(
|
await StreamHelper.CopyToAsync(
|
||||||
stream,
|
stream,
|
||||||
fileStream,
|
fileStream,
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] int? height,
|
[FromQuery] int? height,
|
||||||
[FromQuery] int? videoBitRate,
|
[FromQuery] int? videoBitRate,
|
||||||
[FromQuery] int? subtitleStreamIndex,
|
[FromQuery] int? subtitleStreamIndex,
|
||||||
[FromQuery] SubtitleDeliveryMethod subtitleMethod,
|
[FromQuery] SubtitleDeliveryMethod? subtitleMethod,
|
||||||
[FromQuery] int? maxRefFrames,
|
[FromQuery] int? maxRefFrames,
|
||||||
[FromQuery] int? maxVideoBitDepth,
|
[FromQuery] int? maxVideoBitDepth,
|
||||||
[FromQuery] bool? requireAvc,
|
[FromQuery] bool? requireAvc,
|
||||||
@@ -174,7 +174,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
Height = height,
|
Height = height,
|
||||||
VideoBitRate = videoBitRate,
|
VideoBitRate = videoBitRate,
|
||||||
SubtitleStreamIndex = subtitleStreamIndex,
|
SubtitleStreamIndex = subtitleStreamIndex,
|
||||||
SubtitleMethod = subtitleMethod,
|
SubtitleMethod = subtitleMethod ?? SubtitleDeliveryMethod.Encode,
|
||||||
MaxRefFrames = maxRefFrames,
|
MaxRefFrames = maxRefFrames,
|
||||||
MaxVideoBitDepth = maxVideoBitDepth,
|
MaxVideoBitDepth = maxVideoBitDepth,
|
||||||
RequireAvc = requireAvc ?? true,
|
RequireAvc = requireAvc ?? true,
|
||||||
@@ -287,7 +287,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] int? height,
|
[FromQuery] int? height,
|
||||||
[FromQuery] int? videoBitRate,
|
[FromQuery] int? videoBitRate,
|
||||||
[FromQuery] int? subtitleStreamIndex,
|
[FromQuery] int? subtitleStreamIndex,
|
||||||
[FromQuery] SubtitleDeliveryMethod subtitleMethod,
|
[FromQuery] SubtitleDeliveryMethod? subtitleMethod,
|
||||||
[FromQuery] int? maxRefFrames,
|
[FromQuery] int? maxRefFrames,
|
||||||
[FromQuery] int? maxVideoBitDepth,
|
[FromQuery] int? maxVideoBitDepth,
|
||||||
[FromQuery] bool? requireAvc,
|
[FromQuery] bool? requireAvc,
|
||||||
@@ -339,7 +339,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
Height = height,
|
Height = height,
|
||||||
VideoBitRate = videoBitRate,
|
VideoBitRate = videoBitRate,
|
||||||
SubtitleStreamIndex = subtitleStreamIndex,
|
SubtitleStreamIndex = subtitleStreamIndex,
|
||||||
SubtitleMethod = subtitleMethod,
|
SubtitleMethod = subtitleMethod ?? SubtitleDeliveryMethod.Encode,
|
||||||
MaxRefFrames = maxRefFrames,
|
MaxRefFrames = maxRefFrames,
|
||||||
MaxVideoBitDepth = maxVideoBitDepth,
|
MaxVideoBitDepth = maxVideoBitDepth,
|
||||||
RequireAvc = requireAvc ?? true,
|
RequireAvc = requireAvc ?? true,
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] int? height,
|
[FromQuery] int? height,
|
||||||
[FromQuery] int? videoBitRate,
|
[FromQuery] int? videoBitRate,
|
||||||
[FromQuery] int? subtitleStreamIndex,
|
[FromQuery] int? subtitleStreamIndex,
|
||||||
[FromQuery] SubtitleDeliveryMethod subtitleMethod,
|
[FromQuery] SubtitleDeliveryMethod? subtitleMethod,
|
||||||
[FromQuery] int? maxRefFrames,
|
[FromQuery] int? maxRefFrames,
|
||||||
[FromQuery] int? maxVideoBitDepth,
|
[FromQuery] int? maxVideoBitDepth,
|
||||||
[FromQuery] bool? requireAvc,
|
[FromQuery] bool? requireAvc,
|
||||||
@@ -219,7 +219,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] string? transcodeReasons,
|
[FromQuery] string? transcodeReasons,
|
||||||
[FromQuery] int? audioStreamIndex,
|
[FromQuery] int? audioStreamIndex,
|
||||||
[FromQuery] int? videoStreamIndex,
|
[FromQuery] int? videoStreamIndex,
|
||||||
[FromQuery] EncodingContext context,
|
[FromQuery] EncodingContext? context,
|
||||||
[FromQuery] Dictionary<string, string> streamOptions,
|
[FromQuery] Dictionary<string, string> streamOptions,
|
||||||
[FromQuery] bool enableAdaptiveBitrateStreaming = true)
|
[FromQuery] bool enableAdaptiveBitrateStreaming = true)
|
||||||
{
|
{
|
||||||
@@ -256,7 +256,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
Height = height,
|
Height = height,
|
||||||
VideoBitRate = videoBitRate,
|
VideoBitRate = videoBitRate,
|
||||||
SubtitleStreamIndex = subtitleStreamIndex,
|
SubtitleStreamIndex = subtitleStreamIndex,
|
||||||
SubtitleMethod = subtitleMethod,
|
SubtitleMethod = subtitleMethod ?? SubtitleDeliveryMethod.Encode,
|
||||||
MaxRefFrames = maxRefFrames,
|
MaxRefFrames = maxRefFrames,
|
||||||
MaxVideoBitDepth = maxVideoBitDepth,
|
MaxVideoBitDepth = maxVideoBitDepth,
|
||||||
RequireAvc = requireAvc ?? true,
|
RequireAvc = requireAvc ?? true,
|
||||||
@@ -271,7 +271,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
TranscodeReasons = transcodeReasons,
|
TranscodeReasons = transcodeReasons,
|
||||||
AudioStreamIndex = audioStreamIndex,
|
AudioStreamIndex = audioStreamIndex,
|
||||||
VideoStreamIndex = videoStreamIndex,
|
VideoStreamIndex = videoStreamIndex,
|
||||||
Context = context,
|
Context = context ?? EncodingContext.Streaming,
|
||||||
StreamOptions = streamOptions,
|
StreamOptions = streamOptions,
|
||||||
EnableAdaptiveBitrateStreaming = enableAdaptiveBitrateStreaming
|
EnableAdaptiveBitrateStreaming = enableAdaptiveBitrateStreaming
|
||||||
};
|
};
|
||||||
@@ -371,7 +371,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] int? height,
|
[FromQuery] int? height,
|
||||||
[FromQuery] int? videoBitRate,
|
[FromQuery] int? videoBitRate,
|
||||||
[FromQuery] int? subtitleStreamIndex,
|
[FromQuery] int? subtitleStreamIndex,
|
||||||
[FromQuery] SubtitleDeliveryMethod subtitleMethod,
|
[FromQuery] SubtitleDeliveryMethod? subtitleMethod,
|
||||||
[FromQuery] int? maxRefFrames,
|
[FromQuery] int? maxRefFrames,
|
||||||
[FromQuery] int? maxVideoBitDepth,
|
[FromQuery] int? maxVideoBitDepth,
|
||||||
[FromQuery] bool? requireAvc,
|
[FromQuery] bool? requireAvc,
|
||||||
@@ -386,7 +386,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] string? transcodeReasons,
|
[FromQuery] string? transcodeReasons,
|
||||||
[FromQuery] int? audioStreamIndex,
|
[FromQuery] int? audioStreamIndex,
|
||||||
[FromQuery] int? videoStreamIndex,
|
[FromQuery] int? videoStreamIndex,
|
||||||
[FromQuery] EncodingContext context,
|
[FromQuery] EncodingContext? context,
|
||||||
[FromQuery] Dictionary<string, string> streamOptions,
|
[FromQuery] Dictionary<string, string> streamOptions,
|
||||||
[FromQuery] bool enableAdaptiveBitrateStreaming = true)
|
[FromQuery] bool enableAdaptiveBitrateStreaming = true)
|
||||||
{
|
{
|
||||||
@@ -423,7 +423,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
Height = height,
|
Height = height,
|
||||||
VideoBitRate = videoBitRate,
|
VideoBitRate = videoBitRate,
|
||||||
SubtitleStreamIndex = subtitleStreamIndex,
|
SubtitleStreamIndex = subtitleStreamIndex,
|
||||||
SubtitleMethod = subtitleMethod,
|
SubtitleMethod = subtitleMethod ?? SubtitleDeliveryMethod.Encode,
|
||||||
MaxRefFrames = maxRefFrames,
|
MaxRefFrames = maxRefFrames,
|
||||||
MaxVideoBitDepth = maxVideoBitDepth,
|
MaxVideoBitDepth = maxVideoBitDepth,
|
||||||
RequireAvc = requireAvc ?? true,
|
RequireAvc = requireAvc ?? true,
|
||||||
@@ -438,7 +438,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
TranscodeReasons = transcodeReasons,
|
TranscodeReasons = transcodeReasons,
|
||||||
AudioStreamIndex = audioStreamIndex,
|
AudioStreamIndex = audioStreamIndex,
|
||||||
VideoStreamIndex = videoStreamIndex,
|
VideoStreamIndex = videoStreamIndex,
|
||||||
Context = context,
|
Context = context ?? EncodingContext.Streaming,
|
||||||
StreamOptions = streamOptions,
|
StreamOptions = streamOptions,
|
||||||
EnableAdaptiveBitrateStreaming = enableAdaptiveBitrateStreaming
|
EnableAdaptiveBitrateStreaming = enableAdaptiveBitrateStreaming
|
||||||
};
|
};
|
||||||
@@ -534,7 +534,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] int? height,
|
[FromQuery] int? height,
|
||||||
[FromQuery] int? videoBitRate,
|
[FromQuery] int? videoBitRate,
|
||||||
[FromQuery] int? subtitleStreamIndex,
|
[FromQuery] int? subtitleStreamIndex,
|
||||||
[FromQuery] SubtitleDeliveryMethod subtitleMethod,
|
[FromQuery] SubtitleDeliveryMethod? subtitleMethod,
|
||||||
[FromQuery] int? maxRefFrames,
|
[FromQuery] int? maxRefFrames,
|
||||||
[FromQuery] int? maxVideoBitDepth,
|
[FromQuery] int? maxVideoBitDepth,
|
||||||
[FromQuery] bool? requireAvc,
|
[FromQuery] bool? requireAvc,
|
||||||
@@ -549,7 +549,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] string? transcodeReasons,
|
[FromQuery] string? transcodeReasons,
|
||||||
[FromQuery] int? audioStreamIndex,
|
[FromQuery] int? audioStreamIndex,
|
||||||
[FromQuery] int? videoStreamIndex,
|
[FromQuery] int? videoStreamIndex,
|
||||||
[FromQuery] EncodingContext context,
|
[FromQuery] EncodingContext? context,
|
||||||
[FromQuery] Dictionary<string, string> streamOptions)
|
[FromQuery] Dictionary<string, string> streamOptions)
|
||||||
{
|
{
|
||||||
var cancellationTokenSource = new CancellationTokenSource();
|
var cancellationTokenSource = new CancellationTokenSource();
|
||||||
@@ -586,7 +586,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
Height = height,
|
Height = height,
|
||||||
VideoBitRate = videoBitRate,
|
VideoBitRate = videoBitRate,
|
||||||
SubtitleStreamIndex = subtitleStreamIndex,
|
SubtitleStreamIndex = subtitleStreamIndex,
|
||||||
SubtitleMethod = subtitleMethod,
|
SubtitleMethod = subtitleMethod ?? SubtitleDeliveryMethod.Encode,
|
||||||
MaxRefFrames = maxRefFrames,
|
MaxRefFrames = maxRefFrames,
|
||||||
MaxVideoBitDepth = maxVideoBitDepth,
|
MaxVideoBitDepth = maxVideoBitDepth,
|
||||||
RequireAvc = requireAvc ?? true,
|
RequireAvc = requireAvc ?? true,
|
||||||
@@ -601,7 +601,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
TranscodeReasons = transcodeReasons,
|
TranscodeReasons = transcodeReasons,
|
||||||
AudioStreamIndex = audioStreamIndex,
|
AudioStreamIndex = audioStreamIndex,
|
||||||
VideoStreamIndex = videoStreamIndex,
|
VideoStreamIndex = videoStreamIndex,
|
||||||
Context = context,
|
Context = context ?? EncodingContext.Streaming,
|
||||||
StreamOptions = streamOptions
|
StreamOptions = streamOptions
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -699,7 +699,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] int? height,
|
[FromQuery] int? height,
|
||||||
[FromQuery] int? videoBitRate,
|
[FromQuery] int? videoBitRate,
|
||||||
[FromQuery] int? subtitleStreamIndex,
|
[FromQuery] int? subtitleStreamIndex,
|
||||||
[FromQuery] SubtitleDeliveryMethod subtitleMethod,
|
[FromQuery] SubtitleDeliveryMethod? subtitleMethod,
|
||||||
[FromQuery] int? maxRefFrames,
|
[FromQuery] int? maxRefFrames,
|
||||||
[FromQuery] int? maxVideoBitDepth,
|
[FromQuery] int? maxVideoBitDepth,
|
||||||
[FromQuery] bool? requireAvc,
|
[FromQuery] bool? requireAvc,
|
||||||
@@ -714,7 +714,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] string? transcodeReasons,
|
[FromQuery] string? transcodeReasons,
|
||||||
[FromQuery] int? audioStreamIndex,
|
[FromQuery] int? audioStreamIndex,
|
||||||
[FromQuery] int? videoStreamIndex,
|
[FromQuery] int? videoStreamIndex,
|
||||||
[FromQuery] EncodingContext context,
|
[FromQuery] EncodingContext? context,
|
||||||
[FromQuery] Dictionary<string, string> streamOptions)
|
[FromQuery] Dictionary<string, string> streamOptions)
|
||||||
{
|
{
|
||||||
var cancellationTokenSource = new CancellationTokenSource();
|
var cancellationTokenSource = new CancellationTokenSource();
|
||||||
@@ -751,7 +751,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
Height = height,
|
Height = height,
|
||||||
VideoBitRate = videoBitRate,
|
VideoBitRate = videoBitRate,
|
||||||
SubtitleStreamIndex = subtitleStreamIndex,
|
SubtitleStreamIndex = subtitleStreamIndex,
|
||||||
SubtitleMethod = subtitleMethod,
|
SubtitleMethod = subtitleMethod ?? SubtitleDeliveryMethod.Encode,
|
||||||
MaxRefFrames = maxRefFrames,
|
MaxRefFrames = maxRefFrames,
|
||||||
MaxVideoBitDepth = maxVideoBitDepth,
|
MaxVideoBitDepth = maxVideoBitDepth,
|
||||||
RequireAvc = requireAvc ?? true,
|
RequireAvc = requireAvc ?? true,
|
||||||
@@ -766,7 +766,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
TranscodeReasons = transcodeReasons,
|
TranscodeReasons = transcodeReasons,
|
||||||
AudioStreamIndex = audioStreamIndex,
|
AudioStreamIndex = audioStreamIndex,
|
||||||
VideoStreamIndex = videoStreamIndex,
|
VideoStreamIndex = videoStreamIndex,
|
||||||
Context = context,
|
Context = context ?? EncodingContext.Streaming,
|
||||||
StreamOptions = streamOptions
|
StreamOptions = streamOptions
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -869,7 +869,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] int? height,
|
[FromQuery] int? height,
|
||||||
[FromQuery] int? videoBitRate,
|
[FromQuery] int? videoBitRate,
|
||||||
[FromQuery] int? subtitleStreamIndex,
|
[FromQuery] int? subtitleStreamIndex,
|
||||||
[FromQuery] SubtitleDeliveryMethod subtitleMethod,
|
[FromQuery] SubtitleDeliveryMethod? subtitleMethod,
|
||||||
[FromQuery] int? maxRefFrames,
|
[FromQuery] int? maxRefFrames,
|
||||||
[FromQuery] int? maxVideoBitDepth,
|
[FromQuery] int? maxVideoBitDepth,
|
||||||
[FromQuery] bool? requireAvc,
|
[FromQuery] bool? requireAvc,
|
||||||
@@ -884,7 +884,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] string? transcodeReasons,
|
[FromQuery] string? transcodeReasons,
|
||||||
[FromQuery] int? audioStreamIndex,
|
[FromQuery] int? audioStreamIndex,
|
||||||
[FromQuery] int? videoStreamIndex,
|
[FromQuery] int? videoStreamIndex,
|
||||||
[FromQuery] EncodingContext context,
|
[FromQuery] EncodingContext? context,
|
||||||
[FromQuery] Dictionary<string, string> streamOptions)
|
[FromQuery] Dictionary<string, string> streamOptions)
|
||||||
{
|
{
|
||||||
var streamingRequest = new VideoRequestDto
|
var streamingRequest = new VideoRequestDto
|
||||||
@@ -921,7 +921,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
Height = height,
|
Height = height,
|
||||||
VideoBitRate = videoBitRate,
|
VideoBitRate = videoBitRate,
|
||||||
SubtitleStreamIndex = subtitleStreamIndex,
|
SubtitleStreamIndex = subtitleStreamIndex,
|
||||||
SubtitleMethod = subtitleMethod,
|
SubtitleMethod = subtitleMethod ?? SubtitleDeliveryMethod.Encode,
|
||||||
MaxRefFrames = maxRefFrames,
|
MaxRefFrames = maxRefFrames,
|
||||||
MaxVideoBitDepth = maxVideoBitDepth,
|
MaxVideoBitDepth = maxVideoBitDepth,
|
||||||
RequireAvc = requireAvc ?? true,
|
RequireAvc = requireAvc ?? true,
|
||||||
@@ -936,7 +936,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
TranscodeReasons = transcodeReasons,
|
TranscodeReasons = transcodeReasons,
|
||||||
AudioStreamIndex = audioStreamIndex,
|
AudioStreamIndex = audioStreamIndex,
|
||||||
VideoStreamIndex = videoStreamIndex,
|
VideoStreamIndex = videoStreamIndex,
|
||||||
Context = context,
|
Context = context ?? EncodingContext.Streaming,
|
||||||
StreamOptions = streamOptions
|
StreamOptions = streamOptions
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1041,7 +1041,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] int? height,
|
[FromQuery] int? height,
|
||||||
[FromQuery] int? videoBitRate,
|
[FromQuery] int? videoBitRate,
|
||||||
[FromQuery] int? subtitleStreamIndex,
|
[FromQuery] int? subtitleStreamIndex,
|
||||||
[FromQuery] SubtitleDeliveryMethod subtitleMethod,
|
[FromQuery] SubtitleDeliveryMethod? subtitleMethod,
|
||||||
[FromQuery] int? maxRefFrames,
|
[FromQuery] int? maxRefFrames,
|
||||||
[FromQuery] int? maxVideoBitDepth,
|
[FromQuery] int? maxVideoBitDepth,
|
||||||
[FromQuery] bool? requireAvc,
|
[FromQuery] bool? requireAvc,
|
||||||
@@ -1056,7 +1056,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] string? transcodeReasons,
|
[FromQuery] string? transcodeReasons,
|
||||||
[FromQuery] int? audioStreamIndex,
|
[FromQuery] int? audioStreamIndex,
|
||||||
[FromQuery] int? videoStreamIndex,
|
[FromQuery] int? videoStreamIndex,
|
||||||
[FromQuery] EncodingContext context,
|
[FromQuery] EncodingContext? context,
|
||||||
[FromQuery] Dictionary<string, string> streamOptions)
|
[FromQuery] Dictionary<string, string> streamOptions)
|
||||||
{
|
{
|
||||||
var streamingRequest = new StreamingRequestDto
|
var streamingRequest = new StreamingRequestDto
|
||||||
@@ -1093,7 +1093,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
Height = height,
|
Height = height,
|
||||||
VideoBitRate = videoBitRate,
|
VideoBitRate = videoBitRate,
|
||||||
SubtitleStreamIndex = subtitleStreamIndex,
|
SubtitleStreamIndex = subtitleStreamIndex,
|
||||||
SubtitleMethod = subtitleMethod,
|
SubtitleMethod = subtitleMethod ?? SubtitleDeliveryMethod.Encode,
|
||||||
MaxRefFrames = maxRefFrames,
|
MaxRefFrames = maxRefFrames,
|
||||||
MaxVideoBitDepth = maxVideoBitDepth,
|
MaxVideoBitDepth = maxVideoBitDepth,
|
||||||
RequireAvc = requireAvc ?? true,
|
RequireAvc = requireAvc ?? true,
|
||||||
@@ -1108,7 +1108,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
TranscodeReasons = transcodeReasons,
|
TranscodeReasons = transcodeReasons,
|
||||||
AudioStreamIndex = audioStreamIndex,
|
AudioStreamIndex = audioStreamIndex,
|
||||||
VideoStreamIndex = videoStreamIndex,
|
VideoStreamIndex = videoStreamIndex,
|
||||||
Context = context,
|
Context = context ?? EncodingContext.Streaming,
|
||||||
StreamOptions = streamOptions
|
StreamOptions = streamOptions
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,9 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[HttpDelete("Videos/ActiveEncodings")]
|
[HttpDelete("Videos/ActiveEncodings")]
|
||||||
[Authorize(Policy = Policies.DefaultAuthorization)]
|
[Authorize(Policy = Policies.DefaultAuthorization)]
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
public ActionResult StopEncodingProcess([FromQuery] string deviceId, [FromQuery] string playSessionId)
|
public ActionResult StopEncodingProcess(
|
||||||
|
[FromQuery, Required] string deviceId,
|
||||||
|
[FromQuery, Required] string playSessionId)
|
||||||
{
|
{
|
||||||
_transcodingJobHelper.KillTranscodingJobs(deviceId, playSessionId, path => true);
|
_transcodingJobHelper.KillTranscodingJobs(deviceId, playSessionId, path => true);
|
||||||
return NoContent();
|
return NoContent();
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromRoute, Required] Guid itemId,
|
[FromRoute, Required] Guid itemId,
|
||||||
[FromRoute, Required] ImageType imageType,
|
[FromRoute, Required] ImageType imageType,
|
||||||
[FromRoute, Required] int imageIndex,
|
[FromRoute, Required] int imageIndex,
|
||||||
[FromQuery] int newIndex)
|
[FromQuery, Required] int newIndex)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item == null)
|
||||||
@@ -741,7 +741,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
public async Task<ActionResult> GetArtistImage(
|
public async Task<ActionResult> GetArtistImage(
|
||||||
[FromRoute, Required] string name,
|
[FromRoute, Required] string name,
|
||||||
[FromRoute, Required] ImageType imageType,
|
[FromRoute, Required] ImageType imageType,
|
||||||
[FromQuery] string tag,
|
[FromQuery] string? tag,
|
||||||
[FromQuery] ImageFormat? format,
|
[FromQuery] ImageFormat? format,
|
||||||
[FromQuery] int? maxWidth,
|
[FromQuery] int? maxWidth,
|
||||||
[FromQuery] int? maxHeight,
|
[FromQuery] int? maxHeight,
|
||||||
@@ -820,7 +820,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
public async Task<ActionResult> GetGenreImage(
|
public async Task<ActionResult> GetGenreImage(
|
||||||
[FromRoute, Required] string name,
|
[FromRoute, Required] string name,
|
||||||
[FromRoute, Required] ImageType imageType,
|
[FromRoute, Required] ImageType imageType,
|
||||||
[FromQuery] string tag,
|
[FromQuery] string? tag,
|
||||||
[FromQuery] ImageFormat? format,
|
[FromQuery] ImageFormat? format,
|
||||||
[FromQuery] int? maxWidth,
|
[FromQuery] int? maxWidth,
|
||||||
[FromQuery] int? maxHeight,
|
[FromQuery] int? maxHeight,
|
||||||
@@ -900,7 +900,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromRoute, Required] string name,
|
[FromRoute, Required] string name,
|
||||||
[FromRoute, Required] ImageType imageType,
|
[FromRoute, Required] ImageType imageType,
|
||||||
[FromRoute, Required] int imageIndex,
|
[FromRoute, Required] int imageIndex,
|
||||||
[FromQuery] string tag,
|
[FromQuery] string? tag,
|
||||||
[FromQuery] ImageFormat? format,
|
[FromQuery] ImageFormat? format,
|
||||||
[FromQuery] int? maxWidth,
|
[FromQuery] int? maxWidth,
|
||||||
[FromQuery] int? maxHeight,
|
[FromQuery] int? maxHeight,
|
||||||
@@ -978,7 +978,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
public async Task<ActionResult> GetMusicGenreImage(
|
public async Task<ActionResult> GetMusicGenreImage(
|
||||||
[FromRoute, Required] string name,
|
[FromRoute, Required] string name,
|
||||||
[FromRoute, Required] ImageType imageType,
|
[FromRoute, Required] ImageType imageType,
|
||||||
[FromQuery] string tag,
|
[FromQuery] string? tag,
|
||||||
[FromQuery] ImageFormat? format,
|
[FromQuery] ImageFormat? format,
|
||||||
[FromQuery] int? maxWidth,
|
[FromQuery] int? maxWidth,
|
||||||
[FromQuery] int? maxHeight,
|
[FromQuery] int? maxHeight,
|
||||||
@@ -1058,7 +1058,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromRoute, Required] string name,
|
[FromRoute, Required] string name,
|
||||||
[FromRoute, Required] ImageType imageType,
|
[FromRoute, Required] ImageType imageType,
|
||||||
[FromRoute, Required] int imageIndex,
|
[FromRoute, Required] int imageIndex,
|
||||||
[FromQuery] string tag,
|
[FromQuery] string? tag,
|
||||||
[FromQuery] ImageFormat? format,
|
[FromQuery] ImageFormat? format,
|
||||||
[FromQuery] int? maxWidth,
|
[FromQuery] int? maxWidth,
|
||||||
[FromQuery] int? maxHeight,
|
[FromQuery] int? maxHeight,
|
||||||
@@ -1136,7 +1136,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
public async Task<ActionResult> GetPersonImage(
|
public async Task<ActionResult> GetPersonImage(
|
||||||
[FromRoute, Required] string name,
|
[FromRoute, Required] string name,
|
||||||
[FromRoute, Required] ImageType imageType,
|
[FromRoute, Required] ImageType imageType,
|
||||||
[FromQuery] string tag,
|
[FromQuery] string? tag,
|
||||||
[FromQuery] ImageFormat? format,
|
[FromQuery] ImageFormat? format,
|
||||||
[FromQuery] int? maxWidth,
|
[FromQuery] int? maxWidth,
|
||||||
[FromQuery] int? maxHeight,
|
[FromQuery] int? maxHeight,
|
||||||
@@ -1216,7 +1216,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromRoute, Required] string name,
|
[FromRoute, Required] string name,
|
||||||
[FromRoute, Required] ImageType imageType,
|
[FromRoute, Required] ImageType imageType,
|
||||||
[FromRoute, Required] int imageIndex,
|
[FromRoute, Required] int imageIndex,
|
||||||
[FromQuery] string tag,
|
[FromQuery] string? tag,
|
||||||
[FromQuery] ImageFormat? format,
|
[FromQuery] ImageFormat? format,
|
||||||
[FromQuery] int? maxWidth,
|
[FromQuery] int? maxWidth,
|
||||||
[FromQuery] int? maxHeight,
|
[FromQuery] int? maxHeight,
|
||||||
|
|||||||
@@ -346,11 +346,12 @@ namespace Jellyfin.Api.Controllers
|
|||||||
Directory.CreateDirectory(directory);
|
Directory.CreateDirectory(directory);
|
||||||
using (var stream = result.Content)
|
using (var stream = result.Content)
|
||||||
{
|
{
|
||||||
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
await using var fileStream = new FileStream(
|
await using var fileStream = new FileStream(
|
||||||
fullCachePath,
|
fullCachePath,
|
||||||
FileMode.Create,
|
FileMode.Create,
|
||||||
FileAccess.Write,
|
FileAccess.Write,
|
||||||
FileShare.Read,
|
FileShare.None,
|
||||||
IODefaults.FileStreamBufferSize,
|
IODefaults.FileStreamBufferSize,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[HttpPost("Items/{itemId}/ContentType")]
|
[HttpPost("Items/{itemId}/ContentType")]
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
public ActionResult UpdateItemContentType([FromRoute, Required] Guid itemId, [FromQuery] string contentType)
|
public ActionResult UpdateItemContentType([FromRoute, Required] Guid itemId, [FromQuery] string? contentType)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item == null)
|
||||||
|
|||||||
@@ -778,7 +778,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
public ActionResult<LibraryOptionsResultDto> GetLibraryOptionsInfo(
|
public ActionResult<LibraryOptionsResultDto> GetLibraryOptionsInfo(
|
||||||
[FromQuery] string? libraryContentType,
|
[FromQuery] string? libraryContentType,
|
||||||
[FromQuery] bool isNewLibrary)
|
[FromQuery] bool isNewLibrary = false)
|
||||||
{
|
{
|
||||||
var result = new LibraryOptionsResultDto();
|
var result = new LibraryOptionsResultDto();
|
||||||
|
|
||||||
|
|||||||
@@ -241,23 +241,20 @@ namespace Jellyfin.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates a media path.
|
/// Updates a media path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">The name of the library.</param>
|
/// <param name="mediaPathRequestDto">The name of the library and path infos.</param>
|
||||||
/// <param name="pathInfo">The path info.</param>
|
|
||||||
/// <returns>A <see cref="NoContentResult"/>.</returns>
|
/// <returns>A <see cref="NoContentResult"/>.</returns>
|
||||||
/// <response code="204">Media path updated.</response>
|
/// <response code="204">Media path updated.</response>
|
||||||
/// <exception cref="ArgumentNullException">The name of the library may not be empty.</exception>
|
/// <exception cref="ArgumentNullException">The name of the library may not be empty.</exception>
|
||||||
[HttpPost("Paths/Update")]
|
[HttpPost("Paths/Update")]
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
public ActionResult UpdateMediaPath(
|
public ActionResult UpdateMediaPath([FromBody, Required] UpdateMediaPathRequestDto mediaPathRequestDto)
|
||||||
[FromQuery] string? name,
|
|
||||||
[FromBody] MediaPathInfo? pathInfo)
|
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(name))
|
if (string.IsNullOrWhiteSpace(mediaPathRequestDto.Name))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(name));
|
throw new ArgumentNullException(nameof(mediaPathRequestDto), "Name must not be null or empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
_libraryManager.UpdateMediaPath(name, pathInfo);
|
_libraryManager.UpdateMediaPath(mediaPathRequestDto.Name, mediaPathRequestDto.PathInfo);
|
||||||
return NoContent();
|
return NoContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
/// <returns>A <see cref="NoContentResult"/>.</returns>
|
/// <returns>A <see cref="NoContentResult"/>.</returns>
|
||||||
[HttpPost("Sessions/Playing/Ping")]
|
[HttpPost("Sessions/Playing/Ping")]
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
public ActionResult PingPlaybackSession([FromQuery] string playSessionId)
|
public ActionResult PingPlaybackSession([FromQuery, Required] string playSessionId)
|
||||||
{
|
{
|
||||||
_transcodingJobHelper.PingTranscodingJob(playSessionId, null);
|
_transcodingJobHelper.PingTranscodingJob(playSessionId, null);
|
||||||
return NoContent();
|
return NoContent();
|
||||||
@@ -202,9 +202,9 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] string? mediaSourceId,
|
[FromQuery] string? mediaSourceId,
|
||||||
[FromQuery] int? audioStreamIndex,
|
[FromQuery] int? audioStreamIndex,
|
||||||
[FromQuery] int? subtitleStreamIndex,
|
[FromQuery] int? subtitleStreamIndex,
|
||||||
[FromQuery] PlayMethod playMethod,
|
[FromQuery] PlayMethod? playMethod,
|
||||||
[FromQuery] string? liveStreamId,
|
[FromQuery] string? liveStreamId,
|
||||||
[FromQuery] string playSessionId,
|
[FromQuery] string? playSessionId,
|
||||||
[FromQuery] bool canSeek = false)
|
[FromQuery] bool canSeek = false)
|
||||||
{
|
{
|
||||||
var playbackStartInfo = new PlaybackStartInfo
|
var playbackStartInfo = new PlaybackStartInfo
|
||||||
@@ -214,7 +214,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
MediaSourceId = mediaSourceId,
|
MediaSourceId = mediaSourceId,
|
||||||
AudioStreamIndex = audioStreamIndex,
|
AudioStreamIndex = audioStreamIndex,
|
||||||
SubtitleStreamIndex = subtitleStreamIndex,
|
SubtitleStreamIndex = subtitleStreamIndex,
|
||||||
PlayMethod = playMethod,
|
PlayMethod = playMethod ?? PlayMethod.Transcode,
|
||||||
PlaySessionId = playSessionId,
|
PlaySessionId = playSessionId,
|
||||||
LiveStreamId = liveStreamId
|
LiveStreamId = liveStreamId
|
||||||
};
|
};
|
||||||
@@ -254,10 +254,10 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] int? audioStreamIndex,
|
[FromQuery] int? audioStreamIndex,
|
||||||
[FromQuery] int? subtitleStreamIndex,
|
[FromQuery] int? subtitleStreamIndex,
|
||||||
[FromQuery] int? volumeLevel,
|
[FromQuery] int? volumeLevel,
|
||||||
[FromQuery] PlayMethod playMethod,
|
[FromQuery] PlayMethod? playMethod,
|
||||||
[FromQuery] string? liveStreamId,
|
[FromQuery] string? liveStreamId,
|
||||||
[FromQuery] string playSessionId,
|
[FromQuery] string? playSessionId,
|
||||||
[FromQuery] RepeatMode repeatMode,
|
[FromQuery] RepeatMode? repeatMode,
|
||||||
[FromQuery] bool isPaused = false,
|
[FromQuery] bool isPaused = false,
|
||||||
[FromQuery] bool isMuted = false)
|
[FromQuery] bool isMuted = false)
|
||||||
{
|
{
|
||||||
@@ -271,10 +271,10 @@ namespace Jellyfin.Api.Controllers
|
|||||||
AudioStreamIndex = audioStreamIndex,
|
AudioStreamIndex = audioStreamIndex,
|
||||||
SubtitleStreamIndex = subtitleStreamIndex,
|
SubtitleStreamIndex = subtitleStreamIndex,
|
||||||
VolumeLevel = volumeLevel,
|
VolumeLevel = volumeLevel,
|
||||||
PlayMethod = playMethod,
|
PlayMethod = playMethod ?? PlayMethod.Transcode,
|
||||||
PlaySessionId = playSessionId,
|
PlaySessionId = playSessionId,
|
||||||
LiveStreamId = liveStreamId,
|
LiveStreamId = liveStreamId,
|
||||||
RepeatMode = repeatMode
|
RepeatMode = repeatMode ?? RepeatMode.RepeatNone
|
||||||
};
|
};
|
||||||
|
|
||||||
playbackProgressInfo.PlayMethod = ValidatePlayMethod(playbackProgressInfo.PlayMethod, playbackProgressInfo.PlaySessionId);
|
playbackProgressInfo.PlayMethod = ValidatePlayMethod(playbackProgressInfo.PlayMethod, playbackProgressInfo.PlaySessionId);
|
||||||
@@ -352,7 +352,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
return _userDataRepository.GetUserDataDto(item, user);
|
return _userDataRepository.GetUserDataDto(item, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayMethod ValidatePlayMethod(PlayMethod method, string playSessionId)
|
private PlayMethod ValidatePlayMethod(PlayMethod method, string? playSessionId)
|
||||||
{
|
{
|
||||||
if (method == PlayMethod.Transcode)
|
if (method == PlayMethod.Transcode)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -259,7 +259,8 @@ namespace Jellyfin.Api.Controllers
|
|||||||
|
|
||||||
var fullCacheDirectory = Path.GetDirectoryName(fullCachePath) ?? throw new ResourceNotFoundException($"Provided path ({fullCachePath}) is not valid.");
|
var fullCacheDirectory = Path.GetDirectoryName(fullCachePath) ?? throw new ResourceNotFoundException($"Provided path ({fullCachePath}) is not valid.");
|
||||||
Directory.CreateDirectory(fullCacheDirectory);
|
Directory.CreateDirectory(fullCacheDirectory);
|
||||||
await using var fileStream = new FileStream(fullCachePath, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true);
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
|
await using var fileStream = new FileStream(fullCachePath, FileMode.Create, FileAccess.Write, FileShare.None, IODefaults.FileStreamBufferSize, true);
|
||||||
await response.Content.CopyToAsync(fileStream).ConfigureAwait(false);
|
await response.Content.CopyToAsync(fileStream).ConfigureAwait(false);
|
||||||
|
|
||||||
var pointerCacheDirectory = Path.GetDirectoryName(pointerCachePath) ?? throw new ArgumentException($"Provided path ({pointerCachePath}) is not valid.", nameof(pointerCachePath));
|
var pointerCacheDirectory = Path.GetDirectoryName(pointerCachePath) ?? throw new ArgumentException($"Provided path ({pointerCachePath}) is not valid.", nameof(pointerCachePath));
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] int? maxAudioSampleRate,
|
[FromQuery] int? maxAudioSampleRate,
|
||||||
[FromQuery] int? maxAudioBitDepth,
|
[FromQuery] int? maxAudioBitDepth,
|
||||||
[FromQuery] bool? enableRemoteMedia,
|
[FromQuery] bool? enableRemoteMedia,
|
||||||
[FromQuery] bool breakOnNonKeyFrames,
|
[FromQuery] bool breakOnNonKeyFrames = false,
|
||||||
[FromQuery] bool enableRedirection = true)
|
[FromQuery] bool enableRedirection = true)
|
||||||
{
|
{
|
||||||
var deviceProfile = GetDeviceProfile(container, transcodingContainer, audioCodec, transcodingProtocol, breakOnNonKeyFrames, transcodingAudioChannels, maxAudioSampleRate, maxAudioBitDepth, maxAudioChannels);
|
var deviceProfile = GetDeviceProfile(container, transcodingContainer, audioCodec, transcodingProtocol, breakOnNonKeyFrames, transcodingAudioChannels, maxAudioSampleRate, maxAudioBitDepth, maxAudioChannels);
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] int? height,
|
[FromQuery] int? height,
|
||||||
[FromQuery] int? videoBitRate,
|
[FromQuery] int? videoBitRate,
|
||||||
[FromQuery] int? subtitleStreamIndex,
|
[FromQuery] int? subtitleStreamIndex,
|
||||||
[FromQuery] SubtitleDeliveryMethod subtitleMethod,
|
[FromQuery] SubtitleDeliveryMethod? subtitleMethod,
|
||||||
[FromQuery] int? maxRefFrames,
|
[FromQuery] int? maxRefFrames,
|
||||||
[FromQuery] int? maxVideoBitDepth,
|
[FromQuery] int? maxVideoBitDepth,
|
||||||
[FromQuery] bool? requireAvc,
|
[FromQuery] bool? requireAvc,
|
||||||
@@ -214,7 +214,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] string? transcodeReasons,
|
[FromQuery] string? transcodeReasons,
|
||||||
[FromQuery] int? audioStreamIndex,
|
[FromQuery] int? audioStreamIndex,
|
||||||
[FromQuery] int? videoStreamIndex,
|
[FromQuery] int? videoStreamIndex,
|
||||||
[FromQuery] EncodingContext context,
|
[FromQuery] EncodingContext? context,
|
||||||
[FromQuery] Dictionary<string, string> streamOptions,
|
[FromQuery] Dictionary<string, string> streamOptions,
|
||||||
[FromQuery] int? maxWidth,
|
[FromQuery] int? maxWidth,
|
||||||
[FromQuery] int? maxHeight,
|
[FromQuery] int? maxHeight,
|
||||||
@@ -254,7 +254,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
Height = height,
|
Height = height,
|
||||||
VideoBitRate = videoBitRate,
|
VideoBitRate = videoBitRate,
|
||||||
SubtitleStreamIndex = subtitleStreamIndex,
|
SubtitleStreamIndex = subtitleStreamIndex,
|
||||||
SubtitleMethod = subtitleMethod,
|
SubtitleMethod = subtitleMethod ?? SubtitleDeliveryMethod.Encode,
|
||||||
MaxRefFrames = maxRefFrames,
|
MaxRefFrames = maxRefFrames,
|
||||||
MaxVideoBitDepth = maxVideoBitDepth,
|
MaxVideoBitDepth = maxVideoBitDepth,
|
||||||
RequireAvc = requireAvc ?? true,
|
RequireAvc = requireAvc ?? true,
|
||||||
@@ -269,7 +269,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
TranscodeReasons = transcodeReasons,
|
TranscodeReasons = transcodeReasons,
|
||||||
AudioStreamIndex = audioStreamIndex,
|
AudioStreamIndex = audioStreamIndex,
|
||||||
VideoStreamIndex = videoStreamIndex,
|
VideoStreamIndex = videoStreamIndex,
|
||||||
Context = context,
|
Context = context ?? EncodingContext.Streaming,
|
||||||
StreamOptions = streamOptions,
|
StreamOptions = streamOptions,
|
||||||
MaxHeight = maxHeight,
|
MaxHeight = maxHeight,
|
||||||
MaxWidth = maxWidth,
|
MaxWidth = maxWidth,
|
||||||
|
|||||||
@@ -217,9 +217,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
return BadRequest("Please supply at least two videos to merge.");
|
return BadRequest("Please supply at least two videos to merge.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var videosWithVersions = items.Where(i => i.MediaSourceCount > 1).ToList();
|
var primaryVersion = items.FirstOrDefault(i => i.MediaSourceCount > 1 && string.IsNullOrEmpty(i.PrimaryVersionId));
|
||||||
|
|
||||||
var primaryVersion = videosWithVersions.FirstOrDefault();
|
|
||||||
if (primaryVersion == null)
|
if (primaryVersion == null)
|
||||||
{
|
{
|
||||||
primaryVersion = items
|
primaryVersion = items
|
||||||
@@ -364,7 +362,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] int? height,
|
[FromQuery] int? height,
|
||||||
[FromQuery] int? videoBitRate,
|
[FromQuery] int? videoBitRate,
|
||||||
[FromQuery] int? subtitleStreamIndex,
|
[FromQuery] int? subtitleStreamIndex,
|
||||||
[FromQuery] SubtitleDeliveryMethod subtitleMethod,
|
[FromQuery] SubtitleDeliveryMethod? subtitleMethod,
|
||||||
[FromQuery] int? maxRefFrames,
|
[FromQuery] int? maxRefFrames,
|
||||||
[FromQuery] int? maxVideoBitDepth,
|
[FromQuery] int? maxVideoBitDepth,
|
||||||
[FromQuery] bool? requireAvc,
|
[FromQuery] bool? requireAvc,
|
||||||
@@ -379,7 +377,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] string? transcodeReasons,
|
[FromQuery] string? transcodeReasons,
|
||||||
[FromQuery] int? audioStreamIndex,
|
[FromQuery] int? audioStreamIndex,
|
||||||
[FromQuery] int? videoStreamIndex,
|
[FromQuery] int? videoStreamIndex,
|
||||||
[FromQuery] EncodingContext context,
|
[FromQuery] EncodingContext? context,
|
||||||
[FromQuery] Dictionary<string, string> streamOptions)
|
[FromQuery] Dictionary<string, string> streamOptions)
|
||||||
{
|
{
|
||||||
var isHeadRequest = Request.Method == System.Net.WebRequestMethods.Http.Head;
|
var isHeadRequest = Request.Method == System.Net.WebRequestMethods.Http.Head;
|
||||||
@@ -418,7 +416,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
Height = height,
|
Height = height,
|
||||||
VideoBitRate = videoBitRate,
|
VideoBitRate = videoBitRate,
|
||||||
SubtitleStreamIndex = subtitleStreamIndex,
|
SubtitleStreamIndex = subtitleStreamIndex,
|
||||||
SubtitleMethod = subtitleMethod,
|
SubtitleMethod = subtitleMethod ?? SubtitleDeliveryMethod.Encode,
|
||||||
MaxRefFrames = maxRefFrames,
|
MaxRefFrames = maxRefFrames,
|
||||||
MaxVideoBitDepth = maxVideoBitDepth,
|
MaxVideoBitDepth = maxVideoBitDepth,
|
||||||
RequireAvc = requireAvc ?? true,
|
RequireAvc = requireAvc ?? true,
|
||||||
@@ -433,7 +431,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
TranscodeReasons = transcodeReasons,
|
TranscodeReasons = transcodeReasons,
|
||||||
AudioStreamIndex = audioStreamIndex,
|
AudioStreamIndex = audioStreamIndex,
|
||||||
VideoStreamIndex = videoStreamIndex,
|
VideoStreamIndex = videoStreamIndex,
|
||||||
Context = context,
|
Context = context ?? EncodingContext.Streaming,
|
||||||
StreamOptions = streamOptions
|
StreamOptions = streamOptions
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -620,7 +618,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] int? height,
|
[FromQuery] int? height,
|
||||||
[FromQuery] int? videoBitRate,
|
[FromQuery] int? videoBitRate,
|
||||||
[FromQuery] int? subtitleStreamIndex,
|
[FromQuery] int? subtitleStreamIndex,
|
||||||
[FromQuery] SubtitleDeliveryMethod subtitleMethod,
|
[FromQuery] SubtitleDeliveryMethod? subtitleMethod,
|
||||||
[FromQuery] int? maxRefFrames,
|
[FromQuery] int? maxRefFrames,
|
||||||
[FromQuery] int? maxVideoBitDepth,
|
[FromQuery] int? maxVideoBitDepth,
|
||||||
[FromQuery] bool? requireAvc,
|
[FromQuery] bool? requireAvc,
|
||||||
@@ -635,7 +633,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromQuery] string? transcodeReasons,
|
[FromQuery] string? transcodeReasons,
|
||||||
[FromQuery] int? audioStreamIndex,
|
[FromQuery] int? audioStreamIndex,
|
||||||
[FromQuery] int? videoStreamIndex,
|
[FromQuery] int? videoStreamIndex,
|
||||||
[FromQuery] EncodingContext context,
|
[FromQuery] EncodingContext? context,
|
||||||
[FromQuery] Dictionary<string, string> streamOptions)
|
[FromQuery] Dictionary<string, string> streamOptions)
|
||||||
{
|
{
|
||||||
return GetVideoStream(
|
return GetVideoStream(
|
||||||
|
|||||||
@@ -107,7 +107,8 @@ namespace Jellyfin.Api.Helpers
|
|||||||
// Headers only
|
// Headers only
|
||||||
if (isHeadRequest)
|
if (isHeadRequest)
|
||||||
{
|
{
|
||||||
return new FileContentResult(Array.Empty<byte>(), contentType);
|
httpContext.Response.Headers[HeaderNames.ContentType] = contentType;
|
||||||
|
return new OkResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
var transcodingLock = transcodingJobHelper.GetTranscodingLock(outputPath);
|
var transcodingLock = transcodingJobHelper.GetTranscodingLock(outputPath);
|
||||||
|
|||||||
@@ -553,7 +553,8 @@ namespace Jellyfin.Api.Helpers
|
|||||||
$"{logFilePrefix}{DateTime.Now:yyyy-MM-dd_HH-mm-ss}_{state.Request.MediaSourceId}_{Guid.NewGuid().ToString()[..8]}.log");
|
$"{logFilePrefix}{DateTime.Now:yyyy-MM-dd_HH-mm-ss}_{state.Request.MediaSourceId}_{Guid.NewGuid().ToString()[..8]}.log");
|
||||||
|
|
||||||
// FFmpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory.
|
// FFmpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory.
|
||||||
Stream logStream = new FileStream(logFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true);
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
|
Stream logStream = new FileStream(logFilePath, FileMode.Create, FileAccess.Write, FileShare.None, IODefaults.FileStreamBufferSize, true);
|
||||||
|
|
||||||
var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(request.Path + Environment.NewLine + Environment.NewLine + JsonSerializer.Serialize(state.MediaSource) + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine);
|
var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(request.Path + Environment.NewLine + Environment.NewLine + JsonSerializer.Serialize(state.MediaSource) + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine);
|
||||||
await logStream.WriteAsync(commandLineLogMessageBytes, 0, commandLineLogMessageBytes.Length, cancellationTokenSource.Token).ConfigureAwait(false);
|
await logStream.WriteAsync(commandLineLogMessageBytes, 0, commandLineLogMessageBytes.Length, cancellationTokenSource.Token).ConfigureAwait(false);
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using MediaBrowser.Model.Configuration;
|
||||||
|
|
||||||
|
namespace Jellyfin.Api.Models.LibraryStructureDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Update library options dto.
|
||||||
|
/// </summary>
|
||||||
|
public class UpdateMediaPathRequestDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the library name.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public string Name { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets library folder path information.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public MediaPathInfo PathInfo { get; set; } = null!;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -285,14 +285,25 @@ namespace Jellyfin.Networking.Manager
|
|||||||
// No bind address and no exclusions, so listen on all interfaces.
|
// No bind address and no exclusions, so listen on all interfaces.
|
||||||
Collection<IPObject> result = new Collection<IPObject>();
|
Collection<IPObject> result = new Collection<IPObject>();
|
||||||
|
|
||||||
if (IsIP4Enabled)
|
if (IsIP6Enabled && IsIP4Enabled)
|
||||||
|
{
|
||||||
|
// Kestrel source code shows it uses Sockets.DualMode - so this also covers IPAddress.Any
|
||||||
|
result.AddItem(IPAddress.IPv6Any);
|
||||||
|
}
|
||||||
|
else if (IsIP4Enabled)
|
||||||
{
|
{
|
||||||
result.AddItem(IPAddress.Any);
|
result.AddItem(IPAddress.Any);
|
||||||
}
|
}
|
||||||
|
else if (IsIP6Enabled)
|
||||||
if (IsIP6Enabled)
|
|
||||||
{
|
{
|
||||||
result.AddItem(IPAddress.IPv6Any);
|
// Cannot use IPv6Any as Kestrel will bind to IPv4 addresses.
|
||||||
|
foreach (var iface in _interfaceAddresses)
|
||||||
|
{
|
||||||
|
if (iface.AddressFamily == AddressFamily.InterNetworkV6)
|
||||||
|
{
|
||||||
|
result.AddItem(iface.Address);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -414,7 +425,7 @@ namespace Jellyfin.Networking.Manager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// There isn't any others, so we'll use the loopback.
|
// There isn't any others, so we'll use the loopback.
|
||||||
result = IsIP6Enabled ? "::" : "127.0.0.1";
|
result = IsIP6Enabled ? "::1" : "127.0.0.1";
|
||||||
_logger.LogWarning("{Source}: GetBindInterface: Loopback {Result} returned.", source, result);
|
_logger.LogWarning("{Source}: GetBindInterface: Loopback {Result} returned.", source, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ using MediaBrowser.Controller.Net;
|
|||||||
using MediaBrowser.Model.Activity;
|
using MediaBrowser.Model.Activity;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
@@ -37,18 +38,21 @@ namespace Jellyfin.Server
|
|||||||
/// <param name="applicationPaths">The <see cref="ServerApplicationPaths" /> to be used by the <see cref="CoreAppHost" />.</param>
|
/// <param name="applicationPaths">The <see cref="ServerApplicationPaths" /> to be used by the <see cref="CoreAppHost" />.</param>
|
||||||
/// <param name="loggerFactory">The <see cref="ILoggerFactory" /> to be used by the <see cref="CoreAppHost" />.</param>
|
/// <param name="loggerFactory">The <see cref="ILoggerFactory" /> to be used by the <see cref="CoreAppHost" />.</param>
|
||||||
/// <param name="options">The <see cref="StartupOptions" /> to be used by the <see cref="CoreAppHost" />.</param>
|
/// <param name="options">The <see cref="StartupOptions" /> to be used by the <see cref="CoreAppHost" />.</param>
|
||||||
|
/// <param name="startupConfig">The <see cref="IConfiguration" /> to be used by the <see cref="CoreAppHost" />.</param>
|
||||||
/// <param name="fileSystem">The <see cref="IFileSystem" /> to be used by the <see cref="CoreAppHost" />.</param>
|
/// <param name="fileSystem">The <see cref="IFileSystem" /> to be used by the <see cref="CoreAppHost" />.</param>
|
||||||
/// <param name="collection">The <see cref="IServiceCollection"/> to be used by the <see cref="CoreAppHost"/>.</param>
|
/// <param name="collection">The <see cref="IServiceCollection"/> to be used by the <see cref="CoreAppHost"/>.</param>
|
||||||
public CoreAppHost(
|
public CoreAppHost(
|
||||||
IServerApplicationPaths applicationPaths,
|
IServerApplicationPaths applicationPaths,
|
||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory,
|
||||||
IStartupOptions options,
|
IStartupOptions options,
|
||||||
|
IConfiguration startupConfig,
|
||||||
IFileSystem fileSystem,
|
IFileSystem fileSystem,
|
||||||
IServiceCollection collection)
|
IServiceCollection collection)
|
||||||
: base(
|
: base(
|
||||||
applicationPaths,
|
applicationPaths,
|
||||||
loggerFactory,
|
loggerFactory,
|
||||||
options,
|
options,
|
||||||
|
startupConfig,
|
||||||
fileSystem,
|
fileSystem,
|
||||||
collection)
|
collection)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ namespace Jellyfin.Server
|
|||||||
appPaths,
|
appPaths,
|
||||||
_loggerFactory,
|
_loggerFactory,
|
||||||
options,
|
options,
|
||||||
|
startupConfig,
|
||||||
new ManagedFileSystem(_loggerFactory.CreateLogger<ManagedFileSystem>(), appPaths),
|
new ManagedFileSystem(_loggerFactory.CreateLogger<ManagedFileSystem>(), appPaths),
|
||||||
serviceCollection);
|
serviceCollection);
|
||||||
|
|
||||||
@@ -198,7 +199,7 @@ namespace Jellyfin.Server
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
_logger.LogError("Kestrel failed to start! This is most likely due to an invalid address or port bind - correct your bind configuration in system.xml and try again.");
|
_logger.LogError("Kestrel failed to start! This is most likely due to an invalid address or port bind - correct your bind configuration in network.xml and try again.");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +281,7 @@ namespace Jellyfin.Server
|
|||||||
bool flagged = false;
|
bool flagged = false;
|
||||||
foreach (IPObject netAdd in addresses)
|
foreach (IPObject netAdd in addresses)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Kestrel listening on {0}", netAdd);
|
_logger.LogInformation("Kestrel listening on {Address}", netAdd.Address == IPAddress.IPv6Any ? "All Addresses" : netAdd);
|
||||||
options.Listen(netAdd.Address, appHost.HttpPort);
|
options.Listen(netAdd.Address, appHost.HttpPort);
|
||||||
if (appHost.ListenWithHttps)
|
if (appHost.ListenWithHttps)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace Jellyfin.Server
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[Option("published-server-url", Required = false, HelpText = "Jellyfin Server URL to publish via auto discover process")]
|
[Option("published-server-url", Required = false, HelpText = "Jellyfin Server URL to publish via auto discover process")]
|
||||||
public Uri? PublishedServerUrl { get; set; }
|
public string? PublishedServerUrl { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the command line options as a dictionary that can be used in the .NET configuration system.
|
/// Gets the command line options as a dictionary that can be used in the .NET configuration system.
|
||||||
@@ -94,7 +94,7 @@ namespace Jellyfin.Server
|
|||||||
|
|
||||||
if (PublishedServerUrl != null)
|
if (PublishedServerUrl != null)
|
||||||
{
|
{
|
||||||
config.Add(UdpServer.AddressOverrideConfigKey, PublishedServerUrl.ToString());
|
config.Add(UdpServer.AddressOverrideConfigKey, PublishedServerUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FFmpegPath != null)
|
if (FFmpegPath != null)
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace MediaBrowser.Controller
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the configured published server url.
|
/// Gets the configured published server url.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Uri PublishedServerUrl { get; }
|
string PublishedServerUrl { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the system info.
|
/// Gets the system info.
|
||||||
|
|||||||
@@ -133,7 +133,8 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||||||
// On Windows, savint the file will fail if the file is hidden or readonly
|
// On Windows, savint the file will fail if the file is hidden or readonly
|
||||||
FileSystem.SetAttributes(path, false, false);
|
FileSystem.SetAttributes(path, false, false);
|
||||||
|
|
||||||
using (var filestream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read))
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
|
using (var filestream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None))
|
||||||
{
|
{
|
||||||
stream.CopyTo(filestream);
|
stream.CopyTo(filestream);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -680,7 +680,8 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||||||
|
|
||||||
if (!string.Equals(text, newText, StringComparison.Ordinal))
|
if (!string.Equals(text, newText, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
using (var fileStream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.Read))
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
|
using (var fileStream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))
|
||||||
using (var writer = new StreamWriter(fileStream, encoding))
|
using (var writer = new StreamWriter(fileStream, encoding))
|
||||||
{
|
{
|
||||||
await writer.WriteAsync(newText.AsMemory(), cancellationToken).ConfigureAwait(false);
|
await writer.WriteAsync(newText.AsMemory(), cancellationToken).ConfigureAwait(false);
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#nullable disable
|
||||||
|
// THIS IS A HACK
|
||||||
|
// TODO: @bond Move to separate project
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Model.Entities
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Converts an object to a lowercase string.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The object type.</typeparam>
|
||||||
|
public class JsonLowerCaseConverter<T> : JsonConverter<T>
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override T Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
return JsonSerializer.Deserialize<T>(ref reader, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
writer.WriteStringValue(value?.ToString().ToLowerInvariant());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,33 @@ namespace MediaBrowser.Model.Entities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class ProviderIdsExtensions
|
public static class ProviderIdsExtensions
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if this instance has an id for the given provider.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance">The instance.</param>
|
||||||
|
/// <param name="name">The of the provider name.</param>
|
||||||
|
/// <returns><c>true</c> if a provider id with the given name was found; otherwise <c>false</c>.</returns>
|
||||||
|
public static bool HasProviderId(this IHasProviderIds instance, string name)
|
||||||
|
{
|
||||||
|
if (instance == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(instance));
|
||||||
|
}
|
||||||
|
|
||||||
|
return instance.TryGetProviderId(name, out _);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if this instance has an id for the given provider.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance">The instance.</param>
|
||||||
|
/// <param name="provider">The provider.</param>
|
||||||
|
/// <returns><c>true</c> if a provider id with the given name was found; otherwise <c>false</c>.</returns>
|
||||||
|
public static bool HasProviderId(this IHasProviderIds instance, MetadataProvider provider)
|
||||||
|
{
|
||||||
|
return instance.HasProviderId(provider.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a provider id.
|
/// Gets a provider id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -29,7 +56,15 @@ namespace MediaBrowser.Model.Entities
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance.ProviderIds.TryGetValue(name, out id);
|
var foundProviderId = instance.ProviderIds.TryGetValue(name, out id);
|
||||||
|
// This occurs when searching with Identify (and possibly in other places)
|
||||||
|
if (string.IsNullOrEmpty(id))
|
||||||
|
{
|
||||||
|
id = null;
|
||||||
|
foundProviderId = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return foundProviderId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
|
|
||||||
namespace MediaBrowser.Model.Entities
|
namespace MediaBrowser.Model.Entities
|
||||||
@@ -27,6 +28,7 @@ namespace MediaBrowser.Model.Entities
|
|||||||
/// Gets or sets the type of the collection.
|
/// Gets or sets the type of the collection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The type of the collection.</value>
|
/// <value>The type of the collection.</value>
|
||||||
|
[JsonConverter(typeof(JsonLowerCaseConverter<CollectionTypeOptions?>))]
|
||||||
public CollectionTypeOptions? CollectionType { get; set; }
|
public CollectionTypeOptions? CollectionType { get; set; }
|
||||||
|
|
||||||
public LibraryOptions LibraryOptions { get; set; }
|
public LibraryOptions LibraryOptions { get; set; }
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ namespace MediaBrowser.Model.Notifications
|
|||||||
NewLibraryContent,
|
NewLibraryContent,
|
||||||
ServerRestartRequired,
|
ServerRestartRequired,
|
||||||
TaskFailed,
|
TaskFailed,
|
||||||
CameraImageUploaded,
|
|
||||||
UserLockedOut
|
UserLockedOut
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -263,7 +263,8 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
|
|
||||||
_fileSystem.SetAttributes(path, false, false);
|
_fileSystem.SetAttributes(path, false, false);
|
||||||
|
|
||||||
await using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, FileOptions.Asynchronous))
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
|
await using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, IODefaults.FileStreamBufferSize, FileOptions.Asynchronous))
|
||||||
{
|
{
|
||||||
await source.CopyToAsync(fs, cancellationToken).ConfigureAwait(false);
|
await source.CopyToAsync(fs, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -242,6 +242,7 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
languages.Add(preferredLanguage);
|
languages.Add(preferredLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO include [query.IncludeAllLanguages] as an argument to the providers
|
||||||
var tasks = providers.Select(i => GetImages(item, i, languages, cancellationToken, query.ImageType));
|
var tasks = providers.Select(i => GetImages(item, i, languages, cancellationToken, query.ImageType));
|
||||||
|
|
||||||
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
|
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||||
@@ -869,14 +870,14 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
#pragma warning disable CA1031 // do not catch general exception types
|
||||||
|
catch (Exception ex)
|
||||||
|
#pragma warning restore CA1031 // do not catch general exception types
|
||||||
{
|
{
|
||||||
// Logged at lower levels
|
_logger.LogError(ex, "Provider {ProviderName} failed to retrieve search results", provider.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// _logger.LogDebug("Returning search results {0}", _json.SerializeToString(resultList));
|
|
||||||
|
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -169,7 +169,8 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
|
|||||||
|
|
||||||
using var response = await _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken).ConfigureAwait(false);
|
using var response = await _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken).ConfigureAwait(false);
|
||||||
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||||
await using var xmlFileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true);
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
|
await using var xmlFileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, IODefaults.FileStreamBufferSize, true);
|
||||||
await stream.CopyToAsync(xmlFileStream, cancellationToken).ConfigureAwait(false);
|
await stream.CopyToAsync(xmlFileStream, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,8 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
|
|||||||
|
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||||
|
|
||||||
await using var xmlFileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true);
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
|
await using var xmlFileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, IODefaults.FileStreamBufferSize, true);
|
||||||
await stream.CopyToAsync(xmlFileStream, cancellationToken).ConfigureAwait(false);
|
await stream.CopyToAsync(xmlFileStream, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,8 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
|
|||||||
|
|
||||||
var language = item.GetPreferredMetadataLanguage();
|
var language = item.GetPreferredMetadataLanguage();
|
||||||
|
|
||||||
var collection = await _tmdbClientManager.GetCollectionAsync(tmdbId, language, TmdbUtils.GetImageLanguagesParam(language), cancellationToken).ConfigureAwait(false);
|
// TODO use image languages if All Languages isn't toggled, but there's currently no way to get that value in here
|
||||||
|
var collection = await _tmdbClientManager.GetCollectionAsync(tmdbId, null, null, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (collection?.Images == null)
|
if (collection?.Images == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,8 +73,9 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
|||||||
return Enumerable.Empty<RemoteImageInfo>();
|
return Enumerable.Empty<RemoteImageInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO use image languages if All Languages isn't toggled, but there's currently no way to get that value in here
|
||||||
var movie = await _tmdbClientManager
|
var movie = await _tmdbClientManager
|
||||||
.GetMovieAsync(movieTmdbId, language, TmdbUtils.GetImageLanguagesParam(language), cancellationToken)
|
.GetMovieAsync(movieTmdbId, null, null, cancellationToken)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
if (movie?.Images == null)
|
if (movie?.Images == null)
|
||||||
|
|||||||
@@ -63,8 +63,9 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
|||||||
|
|
||||||
var language = item.GetPreferredMetadataLanguage();
|
var language = item.GetPreferredMetadataLanguage();
|
||||||
|
|
||||||
|
// TODO use image languages if All Languages isn't toggled, but there's currently no way to get that value in here
|
||||||
var episodeResult = await _tmdbClientManager
|
var episodeResult = await _tmdbClientManager
|
||||||
.GetEpisodeAsync(seriesTmdbId, seasonNumber.Value, episodeNumber.Value, language, TmdbUtils.GetImageLanguagesParam(language), cancellationToken)
|
.GetEpisodeAsync(seriesTmdbId, seasonNumber.Value, episodeNumber.Value, null, null, cancellationToken)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
var stills = episodeResult?.Images?.Stills;
|
var stills = episodeResult?.Images?.Stills;
|
||||||
|
|||||||
@@ -111,10 +111,14 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
|||||||
|
|
||||||
var item = new Episode
|
var item = new Episode
|
||||||
{
|
{
|
||||||
Name = info.Name,
|
|
||||||
IndexNumber = info.IndexNumber,
|
IndexNumber = info.IndexNumber,
|
||||||
ParentIndexNumber = info.ParentIndexNumber,
|
ParentIndexNumber = info.ParentIndexNumber,
|
||||||
IndexNumberEnd = info.IndexNumberEnd
|
IndexNumberEnd = info.IndexNumberEnd,
|
||||||
|
Name = episodeResult.Name,
|
||||||
|
PremiereDate = episodeResult.AirDate,
|
||||||
|
ProductionYear = episodeResult.AirDate?.Year,
|
||||||
|
Overview = episodeResult.Overview,
|
||||||
|
CommunityRating = Convert.ToSingle(episodeResult.VoteAverage)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(episodeResult.ExternalIds?.TvdbId))
|
if (!string.IsNullOrEmpty(episodeResult.ExternalIds?.TvdbId))
|
||||||
@@ -122,14 +126,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
|||||||
item.SetProviderId(MetadataProvider.Tvdb, episodeResult.ExternalIds.TvdbId);
|
item.SetProviderId(MetadataProvider.Tvdb, episodeResult.ExternalIds.TvdbId);
|
||||||
}
|
}
|
||||||
|
|
||||||
item.PremiereDate = episodeResult.AirDate;
|
|
||||||
item.ProductionYear = episodeResult.AirDate?.Year;
|
|
||||||
|
|
||||||
item.Name = episodeResult.Name;
|
|
||||||
item.Overview = episodeResult.Overview;
|
|
||||||
|
|
||||||
item.CommunityRating = Convert.ToSingle(episodeResult.VoteAverage);
|
|
||||||
|
|
||||||
if (episodeResult.Videos?.Results != null)
|
if (episodeResult.Videos?.Results != null)
|
||||||
{
|
{
|
||||||
foreach (var video in episodeResult.Videos.Results)
|
foreach (var video in episodeResult.Videos.Results)
|
||||||
|
|||||||
@@ -52,8 +52,9 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
|||||||
|
|
||||||
var language = item.GetPreferredMetadataLanguage();
|
var language = item.GetPreferredMetadataLanguage();
|
||||||
|
|
||||||
|
// TODO use image languages if All Languages isn't toggled, but there's currently no way to get that value in here
|
||||||
var seasonResult = await _tmdbClientManager
|
var seasonResult = await _tmdbClientManager
|
||||||
.GetSeasonAsync(seriesTmdbId, season.IndexNumber.Value, language, TmdbUtils.GetImageLanguagesParam(language), cancellationToken)
|
.GetSeasonAsync(seriesTmdbId, season.IndexNumber.Value, null, null, cancellationToken)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
var posters = seasonResult?.Images?.Posters;
|
var posters = seasonResult?.Images?.Posters;
|
||||||
|
|||||||
@@ -59,8 +59,9 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
|||||||
|
|
||||||
var language = item.GetPreferredMetadataLanguage();
|
var language = item.GetPreferredMetadataLanguage();
|
||||||
|
|
||||||
|
// TODO use image languages if All Languages isn't toggled, but there's currently no way to get that value in here
|
||||||
var series = await _tmdbClientManager
|
var series = await _tmdbClientManager
|
||||||
.GetSeriesAsync(Convert.ToInt32(tmdbId, CultureInfo.InvariantCulture), language, TmdbUtils.GetImageLanguagesParam(language), cancellationToken)
|
.GetSeriesAsync(Convert.ToInt32(tmdbId, CultureInfo.InvariantCulture), null, null, cancellationToken)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
if (series?.Images == null)
|
if (series?.Images == null)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using System.Threading.Tasks;
|
|||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Providers;
|
using MediaBrowser.Model.Providers;
|
||||||
@@ -22,15 +23,17 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
|||||||
public class TmdbSeriesProvider : IRemoteMetadataProvider<Series, SeriesInfo>, IHasOrder
|
public class TmdbSeriesProvider : IRemoteMetadataProvider<Series, SeriesInfo>, IHasOrder
|
||||||
{
|
{
|
||||||
private readonly IHttpClientFactory _httpClientFactory;
|
private readonly IHttpClientFactory _httpClientFactory;
|
||||||
|
private readonly ILibraryManager _libraryManager;
|
||||||
private readonly TmdbClientManager _tmdbClientManager;
|
private readonly TmdbClientManager _tmdbClientManager;
|
||||||
|
|
||||||
public TmdbSeriesProvider(
|
public TmdbSeriesProvider(
|
||||||
|
ILibraryManager libraryManager,
|
||||||
IHttpClientFactory httpClientFactory,
|
IHttpClientFactory httpClientFactory,
|
||||||
TmdbClientManager tmdbClientManager)
|
TmdbClientManager tmdbClientManager)
|
||||||
{
|
{
|
||||||
|
_libraryManager = libraryManager;
|
||||||
_httpClientFactory = httpClientFactory;
|
_httpClientFactory = httpClientFactory;
|
||||||
_tmdbClientManager = tmdbClientManager;
|
_tmdbClientManager = tmdbClientManager;
|
||||||
Current = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name => TmdbUtils.ProviderName;
|
public string Name => TmdbUtils.ProviderName;
|
||||||
@@ -38,8 +41,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
|||||||
// After TheTVDB
|
// After TheTVDB
|
||||||
public int Order => 1;
|
public int Order => 1;
|
||||||
|
|
||||||
internal static TmdbSeriesProvider Current { get; private set; }
|
|
||||||
|
|
||||||
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken)
|
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var tmdbId = searchInfo.GetProviderId(MetadataProvider.Tmdb);
|
var tmdbId = searchInfo.GetProviderId(MetadataProvider.Tmdb);
|
||||||
@@ -104,7 +105,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var tvSearchResults = await _tmdbClientManager.SearchSeriesAsync(searchInfo.Name, searchInfo.MetadataLanguage, cancellationToken)
|
var tvSearchResults = await _tmdbClientManager.SearchSeriesAsync(searchInfo.Name, searchInfo.MetadataLanguage, cancellationToken: cancellationToken)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
var remoteResults = new RemoteSearchResult[tvSearchResults.Count];
|
var remoteResults = new RemoteSearchResult[tvSearchResults.Count];
|
||||||
@@ -203,7 +204,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
|||||||
if (string.IsNullOrEmpty(tmdbId))
|
if (string.IsNullOrEmpty(tmdbId))
|
||||||
{
|
{
|
||||||
result.QueriedById = false;
|
result.QueriedById = false;
|
||||||
var searchResults = await _tmdbClientManager.SearchSeriesAsync(info.Name, info.MetadataLanguage, cancellationToken).ConfigureAwait(false);
|
// ParseName is required here.
|
||||||
|
// Caller provides the filename with extension stripped and NOT the parsed filename
|
||||||
|
var parsedName = _libraryManager.ParseName(info.Name);
|
||||||
|
var searchResults = await _tmdbClientManager.SearchSeriesAsync(parsedName.Name, info.MetadataLanguage, info.Year ?? 0, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (searchResults.Count > 0)
|
if (searchResults.Count > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -278,9 +278,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">The name of the tv show.</param>
|
/// <param name="name">The name of the tv show.</param>
|
||||||
/// <param name="language">The tv show's language.</param>
|
/// <param name="language">The tv show's language.</param>
|
||||||
|
/// <param name="year">The year the tv show first aired.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>The TMDb tv show information.</returns>
|
/// <returns>The TMDb tv show information.</returns>
|
||||||
public async Task<IReadOnlyList<SearchTv>> SearchSeriesAsync(string name, string language, CancellationToken cancellationToken)
|
public async Task<IReadOnlyList<SearchTv>> SearchSeriesAsync(string name, string language, int year = 0, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var key = $"searchseries-{name}-{language}";
|
var key = $"searchseries-{name}-{language}";
|
||||||
if (_memoryCache.TryGetValue(key, out SearchContainer<SearchTv> series))
|
if (_memoryCache.TryGetValue(key, out SearchContainer<SearchTv> series))
|
||||||
@@ -291,7 +292,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|||||||
await EnsureClientConfigAsync().ConfigureAwait(false);
|
await EnsureClientConfigAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
var searchResults = await _tmDbClient
|
var searchResults = await _tmDbClient
|
||||||
.SearchTvShowAsync(name, TmdbUtils.NormalizeLanguage(language), cancellationToken: cancellationToken)
|
.SearchTvShowAsync(name, TmdbUtils.NormalizeLanguage(language), firstAirDateYear: year, cancellationToken: cancellationToken)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
if (searchResults.Results.Count > 0)
|
if (searchResults.Results.Count > 0)
|
||||||
|
|||||||
@@ -228,7 +228,8 @@ namespace MediaBrowser.Providers.Subtitles
|
|||||||
{
|
{
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(savePath));
|
Directory.CreateDirectory(Path.GetDirectoryName(savePath));
|
||||||
|
|
||||||
using (var fs = new FileStream(savePath, FileMode.Create, FileAccess.Write, FileShare.Read, FileStreamBufferSize, true))
|
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
||||||
|
using (var fs = new FileStream(savePath, FileMode.Create, FileAccess.Write, FileShare.None, FileStreamBufferSize, true))
|
||||||
{
|
{
|
||||||
await stream.CopyToAsync(fs).ConfigureAwait(false);
|
await stream.CopyToAsync(fs).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
# We just wrap `build` so this is really it
|
# We just wrap `build` so this is really it
|
||||||
name: "jellyfin"
|
name: "jellyfin"
|
||||||
version: "10.7.0~rc4"
|
version: "10.7.0"
|
||||||
packages:
|
packages:
|
||||||
- debian.amd64
|
- debian.amd64
|
||||||
- debian.arm64
|
- debian.arm64
|
||||||
|
|||||||
Vendored
+3
-93
@@ -1,95 +1,5 @@
|
|||||||
jellyfin-server (10.7.0~rc4) unstable; urgency=medium
|
jellyfin-server (10.7.0-1) unstable; urgency=medium
|
||||||
|
|
||||||
* New upstream version 10.7.0-rc4; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.7.0-rc4
|
* New upstream version 10.7.0; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.7.0
|
||||||
|
|
||||||
-- Jellyfin Packaging Team <packaging@jellyfin.org> Sun, 21 Feb 2021 13:40:42 -0500
|
-- Jellyfin Packaging Team <packaging@jellyfin.org> Mon, 08 Mar 2021 18:09:41 -0500
|
||||||
|
|
||||||
jellyfin-server (10.7.0~rc3) unstable; urgency=medium
|
|
||||||
|
|
||||||
* New upstream version 10.7.0-rc3; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.7.0-rc3
|
|
||||||
|
|
||||||
-- Jellyfin Packaging Team <packaging@jellyfin.org> Sat, 23 Jan 2021 15:49:02 -0500
|
|
||||||
|
|
||||||
jellyfin-server (10.7.0~rc2) unstable; urgency=medium
|
|
||||||
|
|
||||||
* New upstream version 10.7.0-rc2; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.7.0-rc2
|
|
||||||
|
|
||||||
-- Jellyfin Packaging Team <packaging@jellyfin.org> Thu, 31 Dec 2020 19:21:59 -0500
|
|
||||||
|
|
||||||
jellyfin-server (10.7.0~rc1) unstable; urgency=medium
|
|
||||||
|
|
||||||
* New upstream version 10.7.0-rc1; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.7.0-rc1
|
|
||||||
|
|
||||||
-- Jellyfin Packaging Team <packaging@jellyfin.org> Fri, 04 Dec 2020 21:01:58 -0500
|
|
||||||
|
|
||||||
jellyfin-server (10.6.0-2) unstable; urgency=medium
|
|
||||||
|
|
||||||
* Fix upgrade bug
|
|
||||||
|
|
||||||
-- Joshua Boniface <joshua@boniface.me> Sun, 19 Jul 22:47:27 -0400
|
|
||||||
|
|
||||||
jellyfin-server (10.6.0-1) unstable; urgency=medium
|
|
||||||
|
|
||||||
* Forthcoming stable release
|
|
||||||
|
|
||||||
-- Jellyfin Packaging Team <packaging@jellyfin.org> Mon, 23 Mar 2020 14:46:05 -0400
|
|
||||||
|
|
||||||
jellyfin (10.5.0-1) unstable; urgency=medium
|
|
||||||
|
|
||||||
* New upstream version 10.5.0; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.5.0
|
|
||||||
|
|
||||||
-- Jellyfin Packaging Team <packaging@jellyfin.org> Fri, 11 Oct 2019 20:12:38 -0400
|
|
||||||
|
|
||||||
jellyfin (10.4.0-1) unstable; urgency=medium
|
|
||||||
|
|
||||||
* New upstream version 10.4.0; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.4.0
|
|
||||||
|
|
||||||
-- Jellyfin Packaging Team <packaging@jellyfin.org> Sat, 31 Aug 2019 21:38:56 -0400
|
|
||||||
|
|
||||||
jellyfin (10.3.7-1) unstable; urgency=medium
|
|
||||||
|
|
||||||
* New upstream version 10.3.7; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.7
|
|
||||||
|
|
||||||
-- Jellyfin Packaging Team <packaging@jellyfin.org> Wed, 24 Jul 2019 10:48:28 -0400
|
|
||||||
|
|
||||||
jellyfin (10.3.6-1) unstable; urgency=medium
|
|
||||||
|
|
||||||
* New upstream version 10.3.6; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.6
|
|
||||||
|
|
||||||
-- Jellyfin Packaging Team <packaging@jellyfin.org> Sat, 06 Jul 2019 13:34:19 -0400
|
|
||||||
|
|
||||||
jellyfin (10.3.5-1) unstable; urgency=medium
|
|
||||||
|
|
||||||
* New upstream version 10.3.5; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.5
|
|
||||||
|
|
||||||
-- Jellyfin Packaging Team <packaging@jellyfin.org> Sun, 09 Jun 2019 21:47:35 -0400
|
|
||||||
|
|
||||||
jellyfin (10.3.4-1) unstable; urgency=medium
|
|
||||||
|
|
||||||
* New upstream version 10.3.4; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.4
|
|
||||||
|
|
||||||
-- Jellyfin Packaging Team <packaging@jellyfin.org> Thu, 06 Jun 2019 22:45:31 -0400
|
|
||||||
|
|
||||||
jellyfin (10.3.3-1) unstable; urgency=medium
|
|
||||||
|
|
||||||
* New upstream version 10.3.3; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.3
|
|
||||||
|
|
||||||
-- Jellyfin Packaging Team <packaging@jellyfin.org> Fri, 17 May 2019 23:12:08 -0400
|
|
||||||
|
|
||||||
jellyfin (10.3.2-1) unstable; urgency=medium
|
|
||||||
|
|
||||||
* New upstream version 10.3.2; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.2
|
|
||||||
|
|
||||||
-- Jellyfin Packaging Team <packaging@jellyfin.org> Tue, 30 Apr 2019 20:18:44 -0400
|
|
||||||
|
|
||||||
jellyfin (10.3.1-1) unstable; urgency=medium
|
|
||||||
|
|
||||||
* New upstream version 10.3.1; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.1
|
|
||||||
|
|
||||||
-- Jellyfin Packaging Team <packaging@jellyfin.org> Sat, 20 Apr 2019 14:24:07 -0400
|
|
||||||
|
|
||||||
jellyfin (10.3.0-1) unstable; urgency=medium
|
|
||||||
|
|
||||||
* New upstream version 10.3.0; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.0
|
|
||||||
|
|
||||||
-- Jellyfin Packaging Team <packaging@jellyfin.org> Fri, 19 Apr 2019 14:24:29 -0400
|
|
||||||
|
|||||||
+3
-33
@@ -7,7 +7,7 @@
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
Name: jellyfin
|
Name: jellyfin
|
||||||
Version: 10.7.0~rc4
|
Version: 10.7.0
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: The Free Software Media System
|
Summary: The Free Software Media System
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
@@ -137,35 +137,5 @@ fi
|
|||||||
%systemd_postun_with_restart jellyfin.service
|
%systemd_postun_with_restart jellyfin.service
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Sun Feb 21 2021 Jellyfin Packaging Team <packaging@jellyfin.org>
|
* Mon Mar 08 2021 Jellyfin Packaging Team <packaging@jellyfin.org>
|
||||||
- New upstream version 10.7.0-rc4; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.7.0-rc4
|
- New upstream version 10.7.0; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.7.0
|
||||||
* Sat Jan 23 2021 Jellyfin Packaging Team <packaging@jellyfin.org>
|
|
||||||
- New upstream version 10.7.0-rc3; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.7.0-rc3
|
|
||||||
* Thu Dec 31 2020 Jellyfin Packaging Team <packaging@jellyfin.org>
|
|
||||||
- New upstream version 10.7.0-rc2; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.7.0-rc2
|
|
||||||
* Fri Dec 04 2020 Jellyfin Packaging Team <packaging@jellyfin.org>
|
|
||||||
- New upstream version 10.7.0-rc1; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.7.0-rc1
|
|
||||||
* Mon Jul 27 2020 Jellyfin Packaging Team <packaging@jellyfin.org>
|
|
||||||
- Forthcoming stable release
|
|
||||||
* Mon Mar 23 2020 Jellyfin Packaging Team <packaging@jellyfin.org>
|
|
||||||
- Forthcoming stable release
|
|
||||||
* Fri Oct 11 2019 Jellyfin Packaging Team <packaging@jellyfin.org>
|
|
||||||
- New upstream version 10.5.0; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.5.0
|
|
||||||
* Sat Aug 31 2019 Jellyfin Packaging Team <packaging@jellyfin.org>
|
|
||||||
- New upstream version 10.4.0; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.4.0
|
|
||||||
* Wed Jul 24 2019 Jellyfin Packaging Team <packaging@jellyfin.org>
|
|
||||||
- New upstream version 10.3.7; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.7
|
|
||||||
* Sat Jul 06 2019 Jellyfin Packaging Team <packaging@jellyfin.org>
|
|
||||||
- New upstream version 10.3.6; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.6
|
|
||||||
* Sun Jun 09 2019 Jellyfin Packaging Team <packaging@jellyfin.org>
|
|
||||||
- New upstream version 10.3.5; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.5
|
|
||||||
* Thu Jun 06 2019 Jellyfin Packaging Team <packaging@jellyfin.org>
|
|
||||||
- New upstream version 10.3.4; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.4
|
|
||||||
* Fri May 17 2019 Jellyfin Packaging Team <packaging@jellyfin.org>
|
|
||||||
- New upstream version 10.3.3; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.3
|
|
||||||
* Tue Apr 30 2019 Jellyfin Packaging Team <packaging@jellyfin.org>
|
|
||||||
- New upstream version 10.3.2; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.2
|
|
||||||
* Sat Apr 20 2019 Jellyfin Packaging Team <packaging@jellyfin.org>
|
|
||||||
- New upstream version 10.3.1; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.1
|
|
||||||
* Fri Apr 19 2019 Jellyfin Packaging Team <packaging@jellyfin.org>
|
|
||||||
- New upstream version 10.3.0; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.0
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using MediaBrowser.Common;
|
|||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
using Microsoft.AspNetCore.TestHost;
|
using Microsoft.AspNetCore.TestHost;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
@@ -77,6 +78,7 @@ namespace Jellyfin.Api.Tests
|
|||||||
appPaths,
|
appPaths,
|
||||||
loggerFactory,
|
loggerFactory,
|
||||||
commandLineOpts,
|
commandLineOpts,
|
||||||
|
new ConfigurationBuilder().Build(),
|
||||||
new ManagedFileSystem(loggerFactory.CreateLogger<ManagedFileSystem>(), appPaths),
|
new ManagedFileSystem(loggerFactory.CreateLogger<ManagedFileSystem>(), appPaths),
|
||||||
serviceCollection);
|
serviceCollection);
|
||||||
_disposableComponents.Add(appHost);
|
_disposableComponents.Add(appHost);
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
using Emby.Server.Implementations;
|
||||||
|
using Jellyfin.Server;
|
||||||
|
using MediaBrowser.Controller;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Jellyfin.Api.Tests
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Implementation of the abstract <see cref="ApplicationHost" /> class.
|
||||||
|
/// </summary>
|
||||||
|
public class TestAppHost : CoreAppHost
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TestAppHost" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="applicationPaths">The <see cref="ServerApplicationPaths" /> to be used by the <see cref="CoreAppHost" />.</param>
|
||||||
|
/// <param name="loggerFactory">The <see cref="ILoggerFactory" /> to be used by the <see cref="CoreAppHost" />.</param>
|
||||||
|
/// <param name="options">The <see cref="StartupOptions" /> to be used by the <see cref="CoreAppHost" />.</param>
|
||||||
|
/// <param name="startup">The <see cref="IConfiguration" /> to be used by the <see cref="CoreAppHost" />.</param>
|
||||||
|
/// <param name="fileSystem">The <see cref="IFileSystem" /> to be used by the <see cref="CoreAppHost" />.</param>
|
||||||
|
/// <param name="collection">The <see cref="IServiceCollection"/> to be used by the <see cref="CoreAppHost"/>.</param>
|
||||||
|
public TestAppHost(
|
||||||
|
IServerApplicationPaths applicationPaths,
|
||||||
|
ILoggerFactory loggerFactory,
|
||||||
|
IStartupOptions options,
|
||||||
|
IConfiguration startup,
|
||||||
|
IFileSystem fileSystem,
|
||||||
|
IServiceCollection collection)
|
||||||
|
: base(
|
||||||
|
applicationPaths,
|
||||||
|
loggerFactory,
|
||||||
|
options,
|
||||||
|
startup,
|
||||||
|
fileSystem,
|
||||||
|
collection)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override IEnumerable<Assembly> GetAssembliesWithPartsInternal()
|
||||||
|
{
|
||||||
|
foreach (var a in base.GetAssembliesWithPartsInternal())
|
||||||
|
{
|
||||||
|
yield return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return typeof(TestPlugin).Assembly;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Jellyfin.Model.Tests.Entities
|
||||||
|
{
|
||||||
|
public class JsonLowerCaseConverterTests
|
||||||
|
{
|
||||||
|
private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions()
|
||||||
|
{
|
||||||
|
Converters =
|
||||||
|
{
|
||||||
|
new JsonStringEnumConverter()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(null, "{\"CollectionType\":null}")]
|
||||||
|
[InlineData(CollectionTypeOptions.Movies, "{\"CollectionType\":\"movies\"}")]
|
||||||
|
[InlineData(CollectionTypeOptions.MusicVideos, "{\"CollectionType\":\"musicvideos\"}")]
|
||||||
|
public void Serialize_CollectionTypeOptions_Correct(CollectionTypeOptions? collectionType, string expected)
|
||||||
|
{
|
||||||
|
Assert.Equal(expected, JsonSerializer.Serialize(new TestContainer(collectionType), _jsonOptions));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("{\"CollectionType\":null}", null)]
|
||||||
|
[InlineData("{\"CollectionType\":\"movies\"}", CollectionTypeOptions.Movies)]
|
||||||
|
[InlineData("{\"CollectionType\":\"musicvideos\"}", CollectionTypeOptions.MusicVideos)]
|
||||||
|
public void Deserialize_CollectionTypeOptions_Correct(string json, CollectionTypeOptions? result)
|
||||||
|
{
|
||||||
|
var res = JsonSerializer.Deserialize<TestContainer>(json, _jsonOptions);
|
||||||
|
Assert.NotNull(res);
|
||||||
|
Assert.Equal(result, res!.CollectionType);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(null)]
|
||||||
|
[InlineData(CollectionTypeOptions.Movies)]
|
||||||
|
[InlineData(CollectionTypeOptions.MusicVideos)]
|
||||||
|
public void RoundTrip_CollectionTypeOptions_Correct(CollectionTypeOptions? value)
|
||||||
|
{
|
||||||
|
var res = JsonSerializer.Deserialize<TestContainer>(JsonSerializer.Serialize(new TestContainer(value), _jsonOptions), _jsonOptions);
|
||||||
|
Assert.NotNull(res);
|
||||||
|
Assert.Equal(value, res!.CollectionType);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("{\"CollectionType\":null}")]
|
||||||
|
[InlineData("{\"CollectionType\":\"movies\"}")]
|
||||||
|
[InlineData("{\"CollectionType\":\"musicvideos\"}")]
|
||||||
|
public void RoundTrip_String_Correct(string json)
|
||||||
|
{
|
||||||
|
var res = JsonSerializer.Serialize(JsonSerializer.Deserialize<TestContainer>(json, _jsonOptions), _jsonOptions);
|
||||||
|
Assert.Equal(json, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestContainer
|
||||||
|
{
|
||||||
|
public TestContainer(CollectionTypeOptions? collectionType)
|
||||||
|
{
|
||||||
|
CollectionType = collectionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonConverter(typeof(JsonLowerCaseConverter<CollectionTypeOptions?>))]
|
||||||
|
public CollectionTypeOptions? CollectionType { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,53 @@ namespace Jellyfin.Model.Tests.Entities
|
|||||||
{
|
{
|
||||||
private const string ExampleImdbId = "tt0113375";
|
private const string ExampleImdbId = "tt0113375";
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void HasProviderId_NullInstance_ThrowsArgumentNullException()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(() => ProviderIdsExtensions.HasProviderId(null!, MetadataProvider.Imdb));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void HasProviderId_NullProvider_False()
|
||||||
|
{
|
||||||
|
var nullProvider = new ProviderIdsExtensionsTestsObject
|
||||||
|
{
|
||||||
|
ProviderIds = null!
|
||||||
|
};
|
||||||
|
|
||||||
|
Assert.False(nullProvider.HasProviderId(MetadataProvider.Imdb));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void HasProviderId_NullName_ThrowsArgumentNullException()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(() => ProviderIdsExtensionsTestsObject.Empty.HasProviderId(null!));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void HasProviderId_NotFoundName_False()
|
||||||
|
{
|
||||||
|
Assert.False(ProviderIdsExtensionsTestsObject.Empty.HasProviderId(MetadataProvider.Imdb));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void HasProviderId_FoundName_True()
|
||||||
|
{
|
||||||
|
var provider = new ProviderIdsExtensionsTestsObject();
|
||||||
|
provider.ProviderIds[MetadataProvider.Imdb.ToString()] = ExampleImdbId;
|
||||||
|
|
||||||
|
Assert.True(provider.HasProviderId(MetadataProvider.Imdb));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void HasProviderId_FoundNameEmptyValue_False()
|
||||||
|
{
|
||||||
|
var provider = new ProviderIdsExtensionsTestsObject();
|
||||||
|
provider.ProviderIds[MetadataProvider.Imdb.ToString()] = string.Empty;
|
||||||
|
|
||||||
|
Assert.False(provider.HasProviderId(MetadataProvider.Imdb));
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void GetProviderId_NullInstance_ThrowsArgumentNullException()
|
public void GetProviderId_NullInstance_ThrowsArgumentNullException()
|
||||||
{
|
{
|
||||||
@@ -30,7 +77,7 @@ namespace Jellyfin.Model.Tests.Entities
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void GetProviderId_NullProvider_Null()
|
public void GetProviderId_NullProvider_Null()
|
||||||
{
|
{
|
||||||
var nullProvider = new ProviderIdsExtensionsTestsObject()
|
var nullProvider = new ProviderIdsExtensionsTestsObject
|
||||||
{
|
{
|
||||||
ProviderIds = null!
|
ProviderIds = null!
|
||||||
};
|
};
|
||||||
@@ -47,7 +94,7 @@ namespace Jellyfin.Model.Tests.Entities
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void TryGetProviderId_NullProvider_False()
|
public void TryGetProviderId_NullProvider_False()
|
||||||
{
|
{
|
||||||
var nullProvider = new ProviderIdsExtensionsTestsObject()
|
var nullProvider = new ProviderIdsExtensionsTestsObject
|
||||||
{
|
{
|
||||||
ProviderIds = null!
|
ProviderIds = null!
|
||||||
};
|
};
|
||||||
@@ -74,6 +121,16 @@ namespace Jellyfin.Model.Tests.Entities
|
|||||||
Assert.Equal(ExampleImdbId, id);
|
Assert.Equal(ExampleImdbId, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TryGetProviderId_FoundNameEmptyValue_False()
|
||||||
|
{
|
||||||
|
var provider = new ProviderIdsExtensionsTestsObject();
|
||||||
|
provider.ProviderIds[MetadataProvider.Imdb.ToString()] = string.Empty;
|
||||||
|
|
||||||
|
Assert.False(provider.TryGetProviderId(MetadataProvider.Imdb, out var id));
|
||||||
|
Assert.Null(id);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void SetProviderId_NullInstance_ThrowsArgumentNullException()
|
public void SetProviderId_NullInstance_ThrowsArgumentNullException()
|
||||||
{
|
{
|
||||||
@@ -108,7 +165,7 @@ namespace Jellyfin.Model.Tests.Entities
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void SetProviderId_NullProvider_Success()
|
public void SetProviderId_NullProvider_Success()
|
||||||
{
|
{
|
||||||
var nullProvider = new ProviderIdsExtensionsTestsObject()
|
var nullProvider = new ProviderIdsExtensionsTestsObject
|
||||||
{
|
{
|
||||||
ProviderIds = null!
|
ProviderIds = null!
|
||||||
};
|
};
|
||||||
@@ -120,7 +177,7 @@ namespace Jellyfin.Model.Tests.Entities
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void SetProviderId_NullProviderAndEmptyName_Success()
|
public void SetProviderId_NullProviderAndEmptyName_Success()
|
||||||
{
|
{
|
||||||
var nullProvider = new ProviderIdsExtensionsTestsObject()
|
var nullProvider = new ProviderIdsExtensionsTestsObject
|
||||||
{
|
{
|
||||||
ProviderIds = null!
|
ProviderIds = null!
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace Jellyfin.Naming.Tests.Video
|
|||||||
[InlineData("Crouching.Tiger.Hidden.Dragon.BDrip.mkv", "Crouching.Tiger.Hidden.Dragon")]
|
[InlineData("Crouching.Tiger.Hidden.Dragon.BDrip.mkv", "Crouching.Tiger.Hidden.Dragon")]
|
||||||
[InlineData("Crouching.Tiger.Hidden.Dragon.BDrip-HDC.mkv", "Crouching.Tiger.Hidden.Dragon")]
|
[InlineData("Crouching.Tiger.Hidden.Dragon.BDrip-HDC.mkv", "Crouching.Tiger.Hidden.Dragon")]
|
||||||
[InlineData("Crouching.Tiger.Hidden.Dragon.4K.UltraHD.HDR.BDrip-HDC.mkv", "Crouching.Tiger.Hidden.Dragon")]
|
[InlineData("Crouching.Tiger.Hidden.Dragon.4K.UltraHD.HDR.BDrip-HDC.mkv", "Crouching.Tiger.Hidden.Dragon")]
|
||||||
|
[InlineData(null, null)]
|
||||||
// FIXME: [InlineData("After The Sunset - [0004].mkv", "After The Sunset")]
|
// FIXME: [InlineData("After The Sunset - [0004].mkv", "After The Sunset")]
|
||||||
public void CleanStringTest(string input, string expectedName)
|
public void CleanStringTest(string input, string expectedName)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,5 +24,31 @@ namespace Jellyfin.Server.Implementations.Tests.Library
|
|||||||
{
|
{
|
||||||
Assert.Throws<ArgumentException>(() => PathExtensions.GetAttributeValue(input, attribute));
|
Assert.Throws<ArgumentException>(() => PathExtensions.GetAttributeValue(input, attribute));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("C:/Users/jeff/myfile.mkv", "C:/Users/jeff", "/home/jeff", "/home/jeff/myfile.mkv")]
|
||||||
|
[InlineData("C:/Users/jeff/myfile.mkv", "C:/Users/jeff/", "/home/jeff", "/home/jeff/myfile.mkv")]
|
||||||
|
[InlineData("/home/jeff/music/jeff's band/consistently inconsistent.mp3", "/home/jeff/music/jeff's band", "/home/not jeff", "/home/not jeff/consistently inconsistent.mp3")]
|
||||||
|
[InlineData("C:\\Users\\jeff\\myfile.mkv", "C:\\Users/jeff", "/home/jeff", "/home/jeff/myfile.mkv")]
|
||||||
|
[InlineData("C:\\Users\\jeff\\myfile.mkv", "C:\\Users/jeff", "/home/jeff/", "/home/jeff/myfile.mkv")]
|
||||||
|
[InlineData("C:\\Users\\jeff\\myfile.mkv", "C:\\Users/jeff/", "/home/jeff/", "/home/jeff/myfile.mkv")]
|
||||||
|
[InlineData("C:\\Users\\jeff\\myfile.mkv", "C:\\Users/jeff/", "/", "/myfile.mkv")]
|
||||||
|
public void TryReplaceSubPath_ValidArgs_Correct(string path, string subPath, string newSubPath, string? expectedResult)
|
||||||
|
{
|
||||||
|
Assert.True(PathExtensions.TryReplaceSubPath(path, subPath, newSubPath, out var result));
|
||||||
|
Assert.Equal(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("", "", "")]
|
||||||
|
[InlineData("/my/path", "", "")]
|
||||||
|
[InlineData("", "/another/path", "")]
|
||||||
|
[InlineData("", "", "/new/subpath")]
|
||||||
|
[InlineData("/home/jeff/music/jeff's band/consistently inconsistent.mp3", "/home/jeff/music/not jeff's band", "/home/not jeff")]
|
||||||
|
public void TryReplaceSubPath_InvalidInput_ReturnsFalseAndNull(string path, string subPath, string newSubPath)
|
||||||
|
{
|
||||||
|
Assert.False(PathExtensions.TryReplaceSubPath(path, subPath, newSubPath, out var result));
|
||||||
|
Assert.Null(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user