diff --git a/Dockerfile b/Dockerfile
index 1cd864e0b3..0bccd9d646 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -31,7 +31,7 @@ COPY --from=web-builder /dist /jellyfin/jellyfin-web
# mesa-va-drivers: needed for VAAPI
RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
- libfontconfig1 libgomp1 libva-drm2 mesa-va-drivers openssl \
+ libfontconfig1 libgomp1 libva-drm2 mesa-va-drivers openssl ca-certificates \
&& apt-get clean autoclean \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/* \
diff --git a/Dockerfile.arm b/Dockerfile.arm
index 551aa177a2..e7cbb09094 100644
--- a/Dockerfile.arm
+++ b/Dockerfile.arm
@@ -24,7 +24,7 @@ RUN dotnet publish Jellyfin.Server --configuration Release --output="/jellyfin"
FROM debian:buster-slim
RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y ffmpeg \
- libssl-dev \
+ libssl-dev ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /cache /config /media \
&& chmod 777 /cache /config /media
diff --git a/Dockerfile.arm64 b/Dockerfile.arm64
index 4c2ca12a66..a0cd0dacc2 100644
--- a/Dockerfile.arm64
+++ b/Dockerfile.arm64
@@ -24,7 +24,7 @@ RUN dotnet publish Jellyfin.Server --configuration Release --output="/jellyfin"
FROM debian:buster-slim
RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y ffmpeg \
- libssl-dev \
+ libssl-dev ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /cache /config /media \
&& chmod 777 /cache /config /media
diff --git a/DvdLib/DvdLib.csproj b/DvdLib/DvdLib.csproj
index 9dbaa9e2f0..f4df6a9f52 100644
--- a/DvdLib/DvdLib.csproj
+++ b/DvdLib/DvdLib.csproj
@@ -9,7 +9,7 @@
- netstandard2.0
+ netstandard2.1
false
true
diff --git a/DvdLib/Ifo/Dvd.cs b/DvdLib/Ifo/Dvd.cs
index 90125fa3e3..157b2e197f 100644
--- a/DvdLib/Ifo/Dvd.cs
+++ b/DvdLib/Ifo/Dvd.cs
@@ -42,7 +42,7 @@ namespace DvdLib.Ifo
}
else
{
- using (var vmgFs = _fileSystem.GetFileStream(vmgPath.FullName, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read))
+ using (var vmgFs = new FileStream(vmgPath.FullName, FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (var vmgRead = new BigEndianBinaryReader(vmgFs))
{
@@ -95,7 +95,7 @@ namespace DvdLib.Ifo
{
VTSPaths[vtsNum] = vtsPath;
- using (var vtsFs = _fileSystem.GetFileStream(vtsPath, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read))
+ using (var vtsFs = new FileStream(vtsPath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (var vtsRead = new BigEndianBinaryReader(vtsFs))
{
diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs
index 85ef9d4829..a5e46df78d 100644
--- a/Emby.Dlna/Didl/DidlBuilder.cs
+++ b/Emby.Dlna/Didl/DidlBuilder.cs
@@ -18,7 +18,6 @@ using MediaBrowser.Controller.Playlists;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Net;
using Microsoft.Extensions.Logging;
diff --git a/Emby.Dlna/Didl/Filter.cs b/Emby.Dlna/Didl/Filter.cs
index a0e67870e9..e7f9577ee6 100644
--- a/Emby.Dlna/Didl/Filter.cs
+++ b/Emby.Dlna/Didl/Filter.cs
@@ -16,7 +16,7 @@ namespace Emby.Dlna.Didl
public Filter(string filter)
{
- _all = StringHelper.EqualsIgnoreCase(filter, "*");
+ _all = string.Equals(filter, "*", StringComparison.OrdinalIgnoreCase);
_fields = (filter ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
}
diff --git a/Emby.Dlna/DlnaManager.cs b/Emby.Dlna/DlnaManager.cs
index d5d788021d..7e744e0aac 100644
--- a/Emby.Dlna/DlnaManager.cs
+++ b/Emby.Dlna/DlnaManager.cs
@@ -385,7 +385,7 @@ namespace Emby.Dlna
{
Directory.CreateDirectory(systemProfilesPath);
- using (var fileStream = _fileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
+ using (var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read))
{
await stream.CopyToAsync(fileStream);
}
diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs
index c58f16438b..d378c2c304 100644
--- a/Emby.Dlna/PlayTo/PlayToController.cs
+++ b/Emby.Dlna/PlayTo/PlayToController.cs
@@ -6,7 +6,6 @@ using System.Threading;
using System.Threading.Tasks;
using Emby.Dlna.Didl;
using MediaBrowser.Common.Configuration;
-using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Entities;
diff --git a/Emby.Dlna/PlayTo/PlaylistItemFactory.cs b/Emby.Dlna/PlayTo/PlaylistItemFactory.cs
index 446d8e1e6e..3b1cbab628 100644
--- a/Emby.Dlna/PlayTo/PlaylistItemFactory.cs
+++ b/Emby.Dlna/PlayTo/PlaylistItemFactory.cs
@@ -1,4 +1,3 @@
-using System.Globalization;
using System.IO;
using System.Linq;
using MediaBrowser.Controller.Entities;
diff --git a/Emby.Dlna/Server/DescriptionXmlBuilder.cs b/Emby.Dlna/Server/DescriptionXmlBuilder.cs
index 03d8f80abb..1b53e92424 100644
--- a/Emby.Dlna/Server/DescriptionXmlBuilder.cs
+++ b/Emby.Dlna/Server/DescriptionXmlBuilder.cs
@@ -5,7 +5,6 @@ using System.Linq;
using System.Text;
using Emby.Dlna.Common;
using MediaBrowser.Model.Dlna;
-using MediaBrowser.Model.Extensions;
namespace Emby.Dlna.Server
{
diff --git a/Emby.Dlna/Service/BaseControlHandler.cs b/Emby.Dlna/Service/BaseControlHandler.cs
index 49129f6ffd..a8da7aecd2 100644
--- a/Emby.Dlna/Service/BaseControlHandler.cs
+++ b/Emby.Dlna/Service/BaseControlHandler.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs
index ce8089e59c..4e0f9493a6 100644
--- a/Emby.Drawing/ImageProcessor.cs
+++ b/Emby.Drawing/ImageProcessor.cs
@@ -14,7 +14,6 @@ using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Net;
using Microsoft.Extensions.Logging;
@@ -129,7 +128,7 @@ namespace Emby.Drawing
{
var file = await ProcessImage(options).ConfigureAwait(false);
- using (var fileStream = _fileSystem.GetFileStream(file.Item1, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read, true))
+ using (var fileStream = new FileStream(file.Item1, FileMode.Open, FileAccess.Read, FileShare.Read, IODefaults.FileStreamBufferSize, true))
{
await fileStream.CopyToAsync(toStream).ConfigureAwait(false);
}
diff --git a/Emby.Notifications/CoreNotificationTypes.cs b/Emby.Notifications/CoreNotificationTypes.cs
index 0f9fc08d99..d11e01e334 100644
--- a/Emby.Notifications/CoreNotificationTypes.cs
+++ b/Emby.Notifications/CoreNotificationTypes.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using MediaBrowser.Controller;
using MediaBrowser.Controller.Notifications;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Notifications;
diff --git a/Emby.Photos/Emby.Photos.csproj b/Emby.Photos/Emby.Photos.csproj
index 29ed3c5f75..ed6918dba6 100644
--- a/Emby.Photos/Emby.Photos.csproj
+++ b/Emby.Photos/Emby.Photos.csproj
@@ -1,9 +1,4 @@
-
-
- true
-
-
diff --git a/Emby.Server.Implementations/Activity/ActivityManager.cs b/Emby.Server.Implementations/Activity/ActivityManager.cs
index b03c4d1824..6712c47828 100644
--- a/Emby.Server.Implementations/Activity/ActivityManager.cs
+++ b/Emby.Server.Implementations/Activity/ActivityManager.cs
@@ -2,7 +2,6 @@
#pragma warning disable SA1600
using System;
-using System.Linq;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Activity;
using MediaBrowser.Model.Events;
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 0bb1d832fb..e2df8877ab 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -599,7 +599,7 @@ namespace Emby.Server.Implementations
HttpsPort = ServerConfiguration.DefaultHttpsPort;
}
- JsonSerializer = new JsonSerializer(FileSystemManager);
+ JsonSerializer = new JsonSerializer();
if (Plugins != null)
{
@@ -1007,7 +1007,7 @@ namespace Emby.Server.Implementations
{
string dir = Path.Combine(ApplicationPaths.PluginsPath, args.Argument.name);
var types = Directory.EnumerateFiles(dir, "*.dll", SearchOption.AllDirectories)
- .Select(x => Assembly.LoadFrom(x))
+ .Select(Assembly.LoadFrom)
.SelectMany(x => x.ExportedTypes)
.Where(x => x.IsClass && !x.IsAbstract && !x.IsInterface && !x.IsGenericType)
.ToArray();
@@ -1707,29 +1707,6 @@ namespace Emby.Server.Implementations
_plugins = list.ToArray();
}
- ///
- /// This returns localhost in the case of no external dns, and the hostname if the
- /// dns is prefixed with a valid Uri prefix.
- ///
- /// The external dns prefix to get the hostname of.
- /// The hostname in .
- private static string GetHostnameFromExternalDns(string externalDns)
- {
- if (string.IsNullOrEmpty(externalDns))
- {
- return "localhost";
- }
-
- try
- {
- return new Uri(externalDns).Host;
- }
- catch
- {
- return externalDns;
- }
- }
-
public virtual void LaunchUrl(string url)
{
if (!CanLaunchWebBrowser)
diff --git a/Emby.Server.Implementations/Channels/ChannelPostScanTask.cs b/Emby.Server.Implementations/Channels/ChannelPostScanTask.cs
index 36e0e5e26d..6cbd04fea9 100644
--- a/Emby.Server.Implementations/Channels/ChannelPostScanTask.cs
+++ b/Emby.Server.Implementations/Channels/ChannelPostScanTask.cs
@@ -35,14 +35,6 @@ namespace Emby.Server.Implementations.Channels
return Task.CompletedTask;
}
- public static string GetUserDistinctValue(User user)
- {
- var channels = user.Policy.EnabledChannels
- .OrderBy(i => i);
-
- return string.Join("|", channels);
- }
-
private void CleanDatabase(CancellationToken cancellationToken)
{
var installedChannelIds = ((ChannelManager)_channelManager).GetInstalledChannelIds();
@@ -75,19 +67,23 @@ namespace Emby.Server.Implementations.Channels
{
cancellationToken.ThrowIfCancellationRequested();
- _libraryManager.DeleteItem(item, new DeleteOptions
- {
- DeleteFileLocation = false
-
- }, false);
+ _libraryManager.DeleteItem(
+ item,
+ new DeleteOptions
+ {
+ DeleteFileLocation = false
+ },
+ false);
}
// Finally, delete the channel itself
- _libraryManager.DeleteItem(channel, new DeleteOptions
- {
- DeleteFileLocation = false
-
- }, false);
+ _libraryManager.DeleteItem(
+ channel,
+ new DeleteOptions
+ {
+ DeleteFileLocation = false
+ },
+ false);
}
}
}
diff --git a/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs b/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs
index 039e2c1383..03e6abcfba 100644
--- a/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs
+++ b/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs
@@ -28,18 +28,28 @@ namespace Emby.Server.Implementations.Channels
_libraryManager = libraryManager;
}
+ ///
public string Name => "Refresh Channels";
+ ///
public string Description => "Refreshes internet channel information.";
+ ///
public string Category => "Internet Channels";
+ ///
public bool IsHidden => ((ChannelManager)_channelManager).Channels.Length == 0;
+ ///
public bool IsEnabled => true;
+ ///
public bool IsLogged => true;
+ ///
+ public string Key => "RefreshInternetChannels";
+
+ ///
public async Task Execute(CancellationToken cancellationToken, IProgress progress)
{
var manager = (ChannelManager)_channelManager;
@@ -50,18 +60,18 @@ namespace Emby.Server.Implementations.Channels
.ConfigureAwait(false);
}
- ///
- /// Creates the triggers that define when the task will run
- ///
+ ///
public IEnumerable GetDefaultTriggers()
{
- return new[] {
+ return new[]
+ {
// Every so often
- new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
+ new TaskTriggerInfo
+ {
+ Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks
+ }
};
}
-
- public string Key => "RefreshInternetChannels";
}
}
diff --git a/Emby.Server.Implementations/Collections/CollectionImageProvider.cs b/Emby.Server.Implementations/Collections/CollectionImageProvider.cs
index 8006b86948..8b14079844 100644
--- a/Emby.Server.Implementations/Collections/CollectionImageProvider.cs
+++ b/Emby.Server.Implementations/Collections/CollectionImageProvider.cs
@@ -1,7 +1,6 @@
#pragma warning disable CS1591
#pragma warning disable SA1600
-using System;
using System.Collections.Generic;
using System.Linq;
using Emby.Server.Implementations.Images;
diff --git a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs
index 3d8d15d197..30b654886b 100644
--- a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs
+++ b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.Globalization;
using System.IO;
using Emby.Server.Implementations.AppBase;
diff --git a/Emby.Server.Implementations/Devices/DeviceManager.cs b/Emby.Server.Implementations/Devices/DeviceManager.cs
index ef73170506..2bd0b840a5 100644
--- a/Emby.Server.Implementations/Devices/DeviceManager.cs
+++ b/Emby.Server.Implementations/Devices/DeviceManager.cs
@@ -243,7 +243,7 @@ namespace Emby.Server.Implementations.Devices
try
{
- using (var fs = _fileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
+ using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read))
{
await stream.CopyToAsync(fs).ConfigureAwait(false);
}
diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
index 77333a03d0..f8560ca856 100644
--- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj
+++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
@@ -29,11 +29,11 @@
-
-
-
+
+
+
-
+
diff --git a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
deleted file mode 100644
index a6eb1152fb..0000000000
--- a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
+++ /dev/null
@@ -1,128 +0,0 @@
-#pragma warning disable CS1591
-#pragma warning disable SA1600
-
-using System;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using MediaBrowser.Controller;
-using MediaBrowser.Controller.Configuration;
-using MediaBrowser.Controller.LiveTv;
-using MediaBrowser.Controller.Plugins;
-using MediaBrowser.Controller.Session;
-using MediaBrowser.Model.LiveTv;
-using MediaBrowser.Model.Tasks;
-using Microsoft.Extensions.Logging;
-
-namespace Emby.Server.Implementations.EntryPoints
-{
- public class AutomaticRestartEntryPoint : IServerEntryPoint
- {
- private readonly IServerApplicationHost _appHost;
- private readonly ILogger _logger;
- private readonly ITaskManager _iTaskManager;
- private readonly ISessionManager _sessionManager;
- private readonly IServerConfigurationManager _config;
- private readonly ILiveTvManager _liveTvManager;
-
- private Timer _timer;
-
- public AutomaticRestartEntryPoint(IServerApplicationHost appHost, ILogger logger, ITaskManager iTaskManager, ISessionManager sessionManager, IServerConfigurationManager config, ILiveTvManager liveTvManager)
- {
- _appHost = appHost;
- _logger = logger;
- _iTaskManager = iTaskManager;
- _sessionManager = sessionManager;
- _config = config;
- _liveTvManager = liveTvManager;
- }
-
- public Task RunAsync()
- {
- if (_appHost.CanSelfRestart)
- {
- _appHost.HasPendingRestartChanged += _appHost_HasPendingRestartChanged;
- }
-
- return Task.CompletedTask;
- }
-
- void _appHost_HasPendingRestartChanged(object sender, EventArgs e)
- {
- DisposeTimer();
-
- if (_appHost.HasPendingRestart)
- {
- _timer = new Timer(TimerCallback, null, TimeSpan.FromMinutes(15), TimeSpan.FromMinutes(15));
- }
- }
-
- private async void TimerCallback(object state)
- {
- if (_config.Configuration.EnableAutomaticRestart)
- {
- var isIdle = await IsIdle().ConfigureAwait(false);
-
- if (isIdle)
- {
- DisposeTimer();
-
- _logger.LogInformation("Automatically restarting the system because it is idle and a restart is required.");
-
- try
- {
- _appHost.Restart();
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error restarting server");
- }
- }
- }
- }
-
- private async Task IsIdle()
- {
- if (_iTaskManager.ScheduledTasks.Any(i => i.State != TaskState.Idle))
- {
- return false;
- }
-
- if (_liveTvManager.Services.Count == 1)
- {
- try
- {
- var timers = await _liveTvManager.GetTimers(new TimerQuery(), CancellationToken.None).ConfigureAwait(false);
- if (timers.Items.Any(i => i.Status == RecordingStatus.InProgress))
- {
- return false;
- }
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error getting timers");
- }
- }
-
- var now = DateTime.UtcNow;
-
- return !_sessionManager.Sessions.Any(i => (now - i.LastActivityDate).TotalMinutes < 30);
- }
-
- public void Dispose()
- {
- _appHost.HasPendingRestartChanged -= _appHost_HasPendingRestartChanged;
-
- DisposeTimer();
- }
-
- private void DisposeTimer()
- {
- if (_timer != null)
- {
- _timer.Dispose();
- _timer = null;
- }
- }
- }
-}
diff --git a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
index f85d52dbc1..06458baedc 100644
--- a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
@@ -16,7 +16,6 @@ using MediaBrowser.Controller.Providers;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Events;
-using MediaBrowser.Model.Extensions;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.EntryPoints
diff --git a/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs
index a83817cb96..529f835606 100644
--- a/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs
+++ b/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs
@@ -1,4 +1,3 @@
-using System;
using System.Threading;
using System.Threading.Tasks;
using Emby.Server.Implementations.Udp;
diff --git a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
index 50233ea485..8a2bc83fb0 100644
--- a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
+++ b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
@@ -197,7 +197,7 @@ namespace Emby.Server.Implementations.HttpClientManager
if (File.Exists(responseCachePath)
&& _fileSystem.GetLastWriteTimeUtc(responseCachePath).Add(cacheLength) > DateTime.UtcNow)
{
- var stream = _fileSystem.GetFileStream(responseCachePath, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read, true);
+ var stream = new FileStream(responseCachePath, FileMode.Open, FileAccess.Read, FileShare.Read, IODefaults.FileStreamBufferSize, true);
return new HttpResponseInfo
{
@@ -220,7 +220,7 @@ namespace Emby.Server.Implementations.HttpClientManager
FileMode.Create,
FileAccess.Write,
FileShare.None,
- StreamDefaults.DefaultFileStreamBufferSize,
+ IODefaults.FileStreamBufferSize,
true))
{
await response.Content.CopyToAsync(fileStream).ConfigureAwait(false);
diff --git a/Emby.Server.Implementations/HttpServer/FileWriter.cs b/Emby.Server.Implementations/HttpServer/FileWriter.cs
index 1795651fd7..d36f230d64 100644
--- a/Emby.Server.Implementations/HttpServer/FileWriter.cs
+++ b/Emby.Server.Implementations/HttpServer/FileWriter.cs
@@ -72,7 +72,7 @@ namespace Emby.Server.Implementations.HttpServer
SetRangeValues();
}
- FileShare = FileShareMode.Read;
+ FileShare = FileShare.Read;
Cookies = new List();
}
@@ -94,7 +94,7 @@ namespace Emby.Server.Implementations.HttpServer
public List Cookies { get; private set; }
- public FileShareMode FileShare { get; set; }
+ public FileShare FileShare { get; set; }
///
/// Gets the options.
@@ -222,17 +222,17 @@ namespace Emby.Server.Implementations.HttpServer
}
}
- public async Task TransmitFile(Stream stream, string path, long offset, long count, FileShareMode fileShareMode, CancellationToken cancellationToken)
+ public async Task TransmitFile(Stream stream, string path, long offset, long count, FileShare fileShare, CancellationToken cancellationToken)
{
- var fileOpenOptions = FileOpenOptions.SequentialScan;
+ var fileOptions = FileOptions.SequentialScan;
// use non-async filestream along with read due to https://github.com/dotnet/corefx/issues/6039
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
- fileOpenOptions |= FileOpenOptions.Asynchronous;
+ fileOptions |= FileOptions.Asynchronous;
}
- using (var fs = _fileSystem.GetFileStream(path, FileOpenMode.Open, FileAccessMode.Read, fileShareMode, fileOpenOptions))
+ using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read, fileShare, IODefaults.FileStreamBufferSize, fileOptions))
{
if (offset > 0)
{
@@ -245,7 +245,7 @@ namespace Emby.Server.Implementations.HttpServer
}
else
{
- await fs.CopyToAsync(stream, StreamDefaults.DefaultCopyToBufferSize, cancellationToken).ConfigureAwait(false);
+ await fs.CopyToAsync(stream, IODefaults.CopyToBufferSize, cancellationToken).ConfigureAwait(false);
}
}
}
diff --git a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
index cefcaa835f..98a4f140e3 100644
--- a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
@@ -440,7 +440,7 @@ namespace Emby.Server.Implementations.HttpServer
public Task
public class JsonSerializer : IJsonSerializer
{
- private readonly IFileSystem _fileSystem;
-
- public JsonSerializer(
- IFileSystem fileSystem)
+ public JsonSerializer()
{
- _fileSystem = fileSystem;
- Configure();
+ ServiceStack.Text.JsConfig.DateHandler = ServiceStack.Text.DateHandler.ISO8601;
+ ServiceStack.Text.JsConfig.ExcludeTypeInfo = true;
+ ServiceStack.Text.JsConfig.IncludeNullValues = false;
+ ServiceStack.Text.JsConfig.AlwaysUseUtc = true;
+ ServiceStack.Text.JsConfig.AssumeUtc = true;
+
+ ServiceStack.Text.JsConfig.SerializeFn = SerializeGuid;
}
///
@@ -81,7 +82,7 @@ namespace Emby.Server.Implementations.Serialization
throw new ArgumentNullException(nameof(file));
}
- using (var stream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
+ using (var stream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.Read))
{
SerializeToStream(obj, stream);
}
@@ -162,7 +163,6 @@ namespace Emby.Server.Implementations.Serialization
throw new ArgumentNullException(nameof(stream));
}
-
return ServiceStack.Text.JsonSerializer.DeserializeFromStreamAsync(stream);
}
@@ -225,20 +225,6 @@ namespace Emby.Server.Implementations.Serialization
}
}
- ///
- /// Configures this instance.
- ///
- private void Configure()
- {
- ServiceStack.Text.JsConfig.DateHandler = ServiceStack.Text.DateHandler.ISO8601;
- ServiceStack.Text.JsConfig.ExcludeTypeInfo = true;
- ServiceStack.Text.JsConfig.IncludeNullValues = false;
- ServiceStack.Text.JsConfig.AlwaysUseUtc = true;
- ServiceStack.Text.JsConfig.AssumeUtc = true;
-
- ServiceStack.Text.JsConfig.SerializeFn = SerializeGuid;
- }
-
private static string SerializeGuid(Guid guid)
{
if (guid.Equals(Guid.Empty))
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs
index b1d513dd4f..0bba19f2a3 100644
--- a/Emby.Server.Implementations/Session/SessionManager.cs
+++ b/Emby.Server.Implementations/Session/SessionManager.cs
@@ -30,17 +30,17 @@ using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Session
{
///
- /// Class SessionManager
+ /// Class SessionManager.
///
public class SessionManager : ISessionManager, IDisposable
{
///
- /// The _user data repository
+ /// The user data repository.
///
private readonly IUserDataManager _userDataManager;
///
- /// The _logger
+ /// The logger.
///
private readonly ILogger _logger;
@@ -57,7 +57,7 @@ namespace Emby.Server.Implementations.Session
private readonly IDeviceManager _deviceManager;
///
- /// The _active connections
+ /// The active connections.
///
private readonly ConcurrentDictionary _activeConnections =
new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase);
@@ -70,18 +70,23 @@ namespace Emby.Server.Implementations.Session
/// Occurs when [playback start].
///
public event EventHandler PlaybackStart;
+
///
/// Occurs when [playback progress].
///
public event EventHandler PlaybackProgress;
+
///
/// Occurs when [playback stopped].
///
public event EventHandler PlaybackStopped;
public event EventHandler SessionStarted;
+
public event EventHandler CapabilitiesChanged;
+
public event EventHandler SessionEnded;
+
public event EventHandler SessionActivity;
public SessionManager(
@@ -924,7 +929,6 @@ namespace Emby.Server.Implementations.Session
ClientName = session.Client,
DeviceId = session.DeviceId,
Session = session
-
},
_logger);
}
@@ -1610,7 +1614,7 @@ namespace Emby.Server.Implementations.Session
private DtoOptions _itemInfoDtoOptions;
///
- /// Converts a BaseItem to a BaseItemInfo
+ /// Converts a BaseItem to a BaseItemInfo.
///
private BaseItemDto GetItemInfo(BaseItem item, MediaSourceInfo mediaSource)
{
@@ -1680,7 +1684,7 @@ namespace Emby.Server.Implementations.Session
}
catch (Exception ex)
{
- _logger.LogError("Error getting {0} image info", ex, type);
+ _logger.LogError(ex, "Error getting image information for {Type}", type);
return null;
}
}
diff --git a/Emby.Server.Implementations/SocketSharp/HttpPostedFile.cs b/Emby.Server.Implementations/SocketSharp/HttpPostedFile.cs
index 95b7912fbb..7479d81045 100644
--- a/Emby.Server.Implementations/SocketSharp/HttpPostedFile.cs
+++ b/Emby.Server.Implementations/SocketSharp/HttpPostedFile.cs
@@ -1,11 +1,5 @@
using System;
-using System.Collections.Generic;
-using System.Globalization;
using System.IO;
-using System.Net;
-using System.Text;
-using System.Threading.Tasks;
-using MediaBrowser.Model.Services;
public sealed class HttpPostedFile : IDisposable
{
diff --git a/Emby.Server.Implementations/SocketSharp/WebSocketSharpListener.cs b/Emby.Server.Implementations/SocketSharp/WebSocketSharpListener.cs
index ba5ba1904c..2e12a19fd9 100644
--- a/Emby.Server.Implementations/SocketSharp/WebSocketSharpListener.cs
+++ b/Emby.Server.Implementations/SocketSharp/WebSocketSharpListener.cs
@@ -1,13 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Net;
using System.Net.WebSockets;
using System.Threading;
using System.Threading.Tasks;
using Emby.Server.Implementations.HttpServer;
using Emby.Server.Implementations.Net;
-using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
diff --git a/Emby.Server.Implementations/WebSockets/WebSocketManager.cs b/Emby.Server.Implementations/WebSockets/WebSocketManager.cs
index efd97e4ff1..31a7468fbc 100644
--- a/Emby.Server.Implementations/WebSockets/WebSocketManager.cs
+++ b/Emby.Server.Implementations/WebSockets/WebSocketManager.cs
@@ -1,12 +1,10 @@
using System;
-using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Net.WebSockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
-using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Serialization;
using Microsoft.Extensions.Logging;
diff --git a/Jellyfin.Api/Jellyfin.Api.csproj b/Jellyfin.Api/Jellyfin.Api.csproj
index 38cdb0998d..4241d9b95e 100644
--- a/Jellyfin.Api/Jellyfin.Api.csproj
+++ b/Jellyfin.Api/Jellyfin.Api.csproj
@@ -8,9 +8,9 @@
-
+
-
+
diff --git a/Jellyfin.Drawing.Skia/Jellyfin.Drawing.Skia.csproj b/Jellyfin.Drawing.Skia/Jellyfin.Drawing.Skia.csproj
index febb1adabc..f9ce0bbe12 100644
--- a/Jellyfin.Drawing.Skia/Jellyfin.Drawing.Skia.csproj
+++ b/Jellyfin.Drawing.Skia/Jellyfin.Drawing.Skia.csproj
@@ -12,8 +12,8 @@
-
-
+
+
@@ -25,7 +25,7 @@
-
+
diff --git a/Jellyfin.Drawing.Skia/SkiaCodecException.cs b/Jellyfin.Drawing.Skia/SkiaCodecException.cs
index 8158b846dd..1d2db5515f 100644
--- a/Jellyfin.Drawing.Skia/SkiaCodecException.cs
+++ b/Jellyfin.Drawing.Skia/SkiaCodecException.cs
@@ -1,4 +1,3 @@
-using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using SkiaSharp;
diff --git a/Jellyfin.Server/Jellyfin.Server.csproj b/Jellyfin.Server/Jellyfin.Server.csproj
index 2492ee214c..bc18f11fde 100644
--- a/Jellyfin.Server/Jellyfin.Server.csproj
+++ b/Jellyfin.Server/Jellyfin.Server.csproj
@@ -35,16 +35,16 @@
-
-
-
+
+
+
-
+
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index fa9b626744..1b4280d82d 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -4,7 +4,6 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
-using System.Net.Security;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
@@ -238,7 +237,7 @@ namespace Jellyfin.Server
{
foreach (var address in addresses)
{
- _logger.LogInformation("Kestrel listening on {ipaddr}", address);
+ _logger.LogInformation("Kestrel listening on {IpAddress}", address);
options.Listen(address, appHost.HttpPort);
if (appHost.EnableHttps && appHost.Certificate != null)
@@ -443,20 +442,18 @@ namespace Jellyfin.Server
if (!File.Exists(configPath))
{
// For some reason the csproj name is used instead of the assembly name
- using (Stream? resource = typeof(Program).Assembly.GetManifestResourceStream(ResourcePath))
+ await using Stream? resource = typeof(Program).Assembly.GetManifestResourceStream(ResourcePath);
+ if (resource == null)
{
- if (resource == null)
- {
- throw new InvalidOperationException(
- string.Format(
- CultureInfo.InvariantCulture,
- "Invalid resource path: '{0}'",
- ResourcePath));
- }
-
- using Stream dst = File.Open(configPath, FileMode.CreateNew);
- await resource.CopyToAsync(dst).ConfigureAwait(false);
+ throw new InvalidOperationException(
+ string.Format(
+ CultureInfo.InvariantCulture,
+ "Invalid resource path: '{0}'",
+ ResourcePath));
}
+
+ await using Stream dst = File.Open(configPath, FileMode.CreateNew);
+ await resource.CopyToAsync(dst).ConfigureAwait(false);
}
return new ConfigurationBuilder()
@@ -485,7 +482,7 @@ namespace Jellyfin.Server
.WriteTo.Async(x => x.File(
Path.Combine(appPaths.LogDirectoryPath, "log_.log"),
rollingInterval: RollingInterval.Day,
- outputTemplate: "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] [{ThreadId}] {SourceContext}:{Message}{NewLine}{Exception}"))
+ outputTemplate: "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message}{NewLine}{Exception}"))
.Enrich.FromLogContext()
.Enrich.WithThreadId()
.CreateLogger();
diff --git a/Jellyfin.Server/Resources/Configuration/logging.json b/Jellyfin.Server/Resources/Configuration/logging.json
index e9f71afd49..acbca8b856 100644
--- a/Jellyfin.Server/Resources/Configuration/logging.json
+++ b/Jellyfin.Server/Resources/Configuration/logging.json
@@ -20,7 +20,7 @@
"retainedFileCountLimit": 3,
"rollOnFileSizeLimit": true,
"fileSizeLimitBytes": 100000000,
- "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] [{ThreadId}] {SourceContext}:{Message}{NewLine}{Exception}"
+ "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message}{NewLine}{Exception}"
}
}
]
diff --git a/Jellyfin.Server/Startup.cs b/Jellyfin.Server/Startup.cs
index 3ee5fb8b50..4d7d56e9d4 100644
--- a/Jellyfin.Server/Startup.cs
+++ b/Jellyfin.Server/Startup.cs
@@ -3,7 +3,6 @@ using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs
index 1a3657c920..7d3546eb7d 100644
--- a/MediaBrowser.Api/ApiEntryPoint.cs
+++ b/MediaBrowser.Api/ApiEntryPoint.cs
@@ -12,7 +12,6 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Session;
-using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Session;
using Microsoft.Extensions.Logging;
diff --git a/MediaBrowser.Api/EnvironmentService.cs b/MediaBrowser.Api/EnvironmentService.cs
index c6dbfb9387..322b9805ba 100644
--- a/MediaBrowser.Api/EnvironmentService.cs
+++ b/MediaBrowser.Api/EnvironmentService.cs
@@ -6,7 +6,6 @@ using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Net;
using MediaBrowser.Model.Services;
using Microsoft.Extensions.Logging;
diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs
index e94c1321f4..c55618aa1d 100644
--- a/MediaBrowser.Api/Images/ImageService.cs
+++ b/MediaBrowser.Api/Images/ImageService.cs
@@ -656,7 +656,7 @@ namespace MediaBrowser.Api.Images
IsHeadRequest = isHeadRequest,
Path = imageResult.Item1,
- FileShare = FileShareMode.Read
+ FileShare = FileShare.Read
}).ConfigureAwait(false);
}
diff --git a/MediaBrowser.Api/Images/RemoteImageService.cs b/MediaBrowser.Api/Images/RemoteImageService.cs
index 5a37d37302..f03f5efd8d 100644
--- a/MediaBrowser.Api/Images/RemoteImageService.cs
+++ b/MediaBrowser.Api/Images/RemoteImageService.cs
@@ -274,11 +274,9 @@ namespace MediaBrowser.Api.Images
Directory.CreateDirectory(Path.GetDirectoryName(fullCachePath));
using (var stream = result.Content)
+ using (var filestream = new FileStream(fullCachePath, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true))
{
- using (var filestream = _fileSystem.GetFileStream(fullCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true))
- {
- await stream.CopyToAsync(filestream).ConfigureAwait(false);
- }
+ await stream.CopyToAsync(filestream).ConfigureAwait(false);
}
Directory.CreateDirectory(Path.GetDirectoryName(pointerCachePath));
diff --git a/MediaBrowser.Api/ItemLookupService.cs b/MediaBrowser.Api/ItemLookupService.cs
index ea5a99892d..a76369a157 100644
--- a/MediaBrowser.Api/ItemLookupService.cs
+++ b/MediaBrowser.Api/ItemLookupService.cs
@@ -305,7 +305,7 @@ namespace MediaBrowser.Api
Directory.CreateDirectory(Path.GetDirectoryName(fullCachePath));
using (var stream = result.Content)
- using (var filestream = _fileSystem.GetFileStream(fullCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true))
+ using (var filestream = new FileStream(fullCachePath, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true))
{
await stream.CopyToAsync(filestream).ConfigureAwait(false);
}
diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs
index 1847f7fde6..c81e89ca3c 100644
--- a/MediaBrowser.Api/ItemUpdateService.cs
+++ b/MediaBrowser.Api/ItemUpdateService.cs
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
-using System.Threading.Tasks;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs
index b1ea3e2627..3d1e4a3637 100644
--- a/MediaBrowser.Api/Library/LibraryService.cs
+++ b/MediaBrowser.Api/Library/LibraryService.cs
@@ -16,17 +16,13 @@ using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
-using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Net;
-using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Providers;
-using MediaBrowser.Controller.TV;
using MediaBrowser.Model.Activity;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization;
-using MediaBrowser.Model.IO;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Services;
using Microsoft.Extensions.Logging;
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 1f7dc0d71f..ab74bab1c3 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -261,7 +261,7 @@ namespace MediaBrowser.Api.Playback
var logFilePath = Path.Combine(ServerConfigurationManager.ApplicationPaths.LogDirectoryPath, logFilePrefix + "-" + Guid.NewGuid() + ".txt");
// FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory.
- Stream logStream = FileSystem.GetFileStream(logFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true);
+ Stream logStream = new FileStream(logFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true);
var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(Request.AbsoluteUri + Environment.NewLine + Environment.NewLine + JsonSerializer.SerializeToString(state.MediaSource) + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine);
await logStream.WriteAsync(commandLineLogMessageBytes, 0, commandLineLogMessageBytes.Length, cancellationTokenSource.Token).ConfigureAwait(false);
diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
index 5d0dc98ddc..0cbfe4bdfa 100644
--- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
@@ -168,7 +168,7 @@ namespace MediaBrowser.Api.Playback.Hls
private string GetLivePlaylistText(string path, int segmentLength)
{
- using (var stream = FileSystem.GetFileStream(path, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite))
+ using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
using (var reader = new StreamReader(stream))
{
@@ -211,7 +211,7 @@ namespace MediaBrowser.Api.Playback.Hls
{
try
{
- // Need to use FileShareMode.ReadWrite because we're reading the file at the same time it's being written
+ // Need to use FileShare.ReadWrite because we're reading the file at the same time it's being written
using (var fileStream = GetPlaylistFileStream(playlist))
{
using (var reader = new StreamReader(fileStream))
@@ -252,11 +252,11 @@ namespace MediaBrowser.Api.Playback.Hls
try
{
- return FileSystem.GetFileStream(tmpPath, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, FileOpenOptions.SequentialScan);
+ return new FileStream(tmpPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, IODefaults.FileStreamBufferSize, FileOptions.SequentialScan);
}
catch (IOException)
{
- return FileSystem.GetFileStream(path, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, FileOpenOptions.SequentialScan);
+ return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, IODefaults.FileStreamBufferSize, FileOptions.SequentialScan);
}
}
diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
index 0178f53af6..262f517869 100644
--- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
@@ -16,7 +16,6 @@ using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Services;
@@ -537,7 +536,7 @@ namespace MediaBrowser.Api.Playback.Hls
return ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions
{
Path = segmentPath,
- FileShare = FileShareMode.ReadWrite,
+ FileShare = FileShare.ReadWrite,
OnComplete = () =>
{
Logger.LogDebug("finished serving {0}", segmentPath);
@@ -954,12 +953,12 @@ namespace MediaBrowser.Api.Playback.Hls
// Unable to force key frames to h264_qsv transcode
if (string.Equals(codec, "h264_qsv", StringComparison.OrdinalIgnoreCase))
{
- Logger.LogInformation("Bug Workaround: Disabling force_key_frames for h264_qsv");
- }
+ Logger.LogInformation("Bug Workaround: Disabling force_key_frames for h264_qsv");
+ }
else
{
args += " " + keyFrameArg;
- }
+ }
//args += " -mixed-refs 0 -refs 3 -x264opts b_pyramid=0:weightb=0:weightp=0";
diff --git a/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs b/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
index bb12ab1f0d..87ccde2e04 100644
--- a/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
+++ b/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
@@ -140,7 +140,7 @@ namespace MediaBrowser.Api.Playback.Hls
var file = request.SegmentId + Path.GetExtension(Request.PathInfo);
file = Path.Combine(ServerConfigurationManager.GetTranscodePath(), file);
- return ResultFactory.GetStaticFileResult(Request, file, FileShareMode.ReadWrite);
+ return ResultFactory.GetStaticFileResult(Request, file, FileShare.ReadWrite);
}
private Task GetFileResult(string path, string playlistPath)
@@ -150,7 +150,7 @@ namespace MediaBrowser.Api.Playback.Hls
return ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions
{
Path = path,
- FileShare = FileShareMode.ReadWrite,
+ FileShare = FileShare.ReadWrite,
OnComplete = () =>
{
if (transcodingJob != null)
diff --git a/MediaBrowser.Api/Playback/MediaInfoService.cs b/MediaBrowser.Api/Playback/MediaInfoService.cs
index 15880a9a16..0eb184d148 100644
--- a/MediaBrowser.Api/Playback/MediaInfoService.cs
+++ b/MediaBrowser.Api/Playback/MediaInfoService.cs
@@ -5,7 +5,6 @@
using System;
using System.Buffers;
-using System.Collections.Generic;
using System.Globalization;
using System.Text.Json;
using System.Linq;
@@ -23,7 +22,6 @@ using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.MediaInfo;
-using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Services;
using MediaBrowser.Model.Session;
using Microsoft.Extensions.Logging;
diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
index ed30dbba61..ed68219c9f 100644
--- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
+++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
@@ -248,7 +248,7 @@ namespace MediaBrowser.Api.Playback.Progressive
// ContentType = contentType,
// IsHeadRequest = isHeadRequest,
// Path = outputPath,
- // FileShare = FileShareMode.ReadWrite,
+ // FileShare = FileShare.ReadWrite,
// OnComplete = () =>
// {
// if (transcodingJob != null)
diff --git a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs
index 6609120655..a53b848f9e 100644
--- a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs
+++ b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs
@@ -21,8 +21,6 @@ namespace MediaBrowser.Api.Playback.Progressive
private readonly CancellationToken _cancellationToken;
private readonly Dictionary _outputHeaders;
- const int StreamCopyToBufferSize = 81920;
-
private long _bytesWritten = 0;
public long StartPosition { get; set; }
public bool AllowEndOfFile = true;
@@ -52,14 +50,14 @@ namespace MediaBrowser.Api.Playback.Progressive
private Stream GetInputStream(bool allowAsyncFileRead)
{
- var fileOpenOptions = FileOpenOptions.SequentialScan;
+ var fileOptions = FileOptions.SequentialScan;
if (allowAsyncFileRead)
{
- fileOpenOptions |= FileOpenOptions.Asynchronous;
+ fileOptions |= FileOptions.Asynchronous;
}
- return _fileSystem.GetFileStream(_path, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, fileOpenOptions);
+ return new FileStream(_path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, IODefaults.FileStreamBufferSize, fileOptions);
}
public async Task WriteToAsync(Stream outputStream, CancellationToken cancellationToken)
@@ -127,7 +125,7 @@ namespace MediaBrowser.Api.Playback.Progressive
private async Task CopyToInternalAsyncWithSyncRead(Stream source, Stream destination, CancellationToken cancellationToken)
{
- var array = new byte[StreamCopyToBufferSize];
+ var array = new byte[IODefaults.CopyToBufferSize];
int bytesRead;
int totalBytesRead = 0;
@@ -154,7 +152,7 @@ namespace MediaBrowser.Api.Playback.Progressive
private async Task CopyToInternalAsync(Stream source, Stream destination, CancellationToken cancellationToken)
{
- var array = new byte[StreamCopyToBufferSize];
+ var array = new byte[IODefaults.CopyToBufferSize];
int bytesRead;
int totalBytesRead = 0;
diff --git a/MediaBrowser.Api/Playback/StreamRequest.cs b/MediaBrowser.Api/Playback/StreamRequest.cs
index 7626cc3785..9ba8eda91f 100644
--- a/MediaBrowser.Api/Playback/StreamRequest.cs
+++ b/MediaBrowser.Api/Playback/StreamRequest.cs
@@ -1,4 +1,3 @@
-using System;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Services;
diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs
index 7396b5c99b..d5d2f58c03 100644
--- a/MediaBrowser.Api/Playback/StreamState.cs
+++ b/MediaBrowser.Api/Playback/StreamState.cs
@@ -103,7 +103,7 @@ namespace MediaBrowser.Api.Playback
_mediaSourceManager = mediaSourceManager;
}
- public override void ReportTranscodingProgress(TimeSpan? transcodingPosition, float framerate, double? percentComplete, long bytesTranscoded, int? bitRate)
+ public override void ReportTranscodingProgress(TimeSpan? transcodingPosition, float? framerate, double? percentComplete, long? bytesTranscoded, int? bitRate)
{
ApiEntryPoint.Instance.ReportTranscodingProgress(TranscodingJob, this, transcodingPosition, framerate, percentComplete, bytesTranscoded, bitRate);
}
diff --git a/MediaBrowser.Api/Session/SessionsService.cs b/MediaBrowser.Api/Session/SessionsService.cs
index 700861c554..9aa7b2c88a 100644
--- a/MediaBrowser.Api/Session/SessionsService.cs
+++ b/MediaBrowser.Api/Session/SessionsService.cs
@@ -18,7 +18,7 @@ using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.Session
{
///
- /// Class GetSessions
+ /// Class GetSessions.
///
[Route("/Sessions", "GET", Summary = "Gets a list of sessions")]
[Authenticated]
@@ -34,7 +34,7 @@ namespace MediaBrowser.Api.Session
}
///
- /// Class DisplayContent
+ /// Class DisplayContent.
///
[Route("/Sessions/{Id}/Viewing", "POST", Summary = "Instructs a session to browse to an item or view")]
[Authenticated]
diff --git a/MediaBrowser.Api/System/ActivityLogWebSocketListener.cs b/MediaBrowser.Api/System/ActivityLogWebSocketListener.cs
index a036619b81..4b6a22b7d5 100644
--- a/MediaBrowser.Api/System/ActivityLogWebSocketListener.cs
+++ b/MediaBrowser.Api/System/ActivityLogWebSocketListener.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Activity;
diff --git a/MediaBrowser.Api/System/SystemService.cs b/MediaBrowser.Api/System/SystemService.cs
index 3a56ba701e..3a3eeb8b8f 100644
--- a/MediaBrowser.Api/System/SystemService.cs
+++ b/MediaBrowser.Api/System/SystemService.cs
@@ -170,10 +170,10 @@ namespace MediaBrowser.Api.System
// For older files, assume fully static
if (file.LastWriteTimeUtc < DateTime.UtcNow.AddHours(-1))
{
- return ResultFactory.GetStaticFileResult(Request, file.FullName, FileShareMode.Read);
+ return ResultFactory.GetStaticFileResult(Request, file.FullName, FileShare.Read);
}
- return ResultFactory.GetStaticFileResult(Request, file.FullName, FileShareMode.ReadWrite);
+ return ResultFactory.GetStaticFileResult(Request, file.FullName, FileShare.ReadWrite);
}
///
diff --git a/MediaBrowser.Api/UserLibrary/GenresService.cs b/MediaBrowser.Api/UserLibrary/GenresService.cs
index 13bb88ca8d..1fa272a5f7 100644
--- a/MediaBrowser.Api/UserLibrary/GenresService.cs
+++ b/MediaBrowser.Api/UserLibrary/GenresService.cs
@@ -5,7 +5,6 @@ using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
-using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
diff --git a/MediaBrowser.Api/UserLibrary/PersonsService.cs b/MediaBrowser.Api/UserLibrary/PersonsService.cs
index 853eada256..3204e5219f 100644
--- a/MediaBrowser.Api/UserLibrary/PersonsService.cs
+++ b/MediaBrowser.Api/UserLibrary/PersonsService.cs
@@ -6,7 +6,6 @@ using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
-using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Services;
diff --git a/MediaBrowser.Api/UserLibrary/YearsService.cs b/MediaBrowser.Api/UserLibrary/YearsService.cs
index 07b9aff1b8..d023ee90ab 100644
--- a/MediaBrowser.Api/UserLibrary/YearsService.cs
+++ b/MediaBrowser.Api/UserLibrary/YearsService.cs
@@ -6,7 +6,6 @@ using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
-using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Services;
using Microsoft.Extensions.Logging;
diff --git a/MediaBrowser.Api/UserService.cs b/MediaBrowser.Api/UserService.cs
index e1b01b012c..ac140150ba 100644
--- a/MediaBrowser.Api/UserService.cs
+++ b/MediaBrowser.Api/UserService.cs
@@ -281,7 +281,6 @@ namespace MediaBrowser.Api
{
IsHidden = false,
IsDisabled = false
-
}, true, true);
}
@@ -395,10 +394,11 @@ namespace MediaBrowser.Api
throw new MethodNotAllowedException("Hashed-only passwords are not valid for this API.");
}
+ // Password should always be null
return Post(new AuthenticateUserByName
{
Username = user.Name,
- Password = null, // This should always be null
+ Password = null,
Pw = request.Pw
});
}
diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj
index 567fcdda19..3da8644040 100644
--- a/MediaBrowser.Common/MediaBrowser.Common.csproj
+++ b/MediaBrowser.Common/MediaBrowser.Common.csproj
@@ -12,7 +12,7 @@
-
+
diff --git a/MediaBrowser.Controller/Entities/Person.cs b/MediaBrowser.Controller/Entities/Person.cs
index d9b4b22067..64e216e69f 100644
--- a/MediaBrowser.Controller/Entities/Person.cs
+++ b/MediaBrowser.Controller/Entities/Person.cs
@@ -135,57 +135,4 @@ namespace MediaBrowser.Controller.Entities
return hasChanges;
}
}
-
- ///
- /// This is the small Person stub that is attached to BaseItems
- ///
- public class PersonInfo : IHasProviderIds
- {
- public PersonInfo()
- {
- ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase);
- }
-
- public Guid ItemId { get; set; }
-
- ///
- /// Gets or sets the name.
- ///
- /// The name.
- public string Name { get; set; }
- ///
- /// Gets or sets the role.
- ///
- /// The role.
- public string Role { get; set; }
- ///
- /// Gets or sets the type.
- ///
- /// The type.
- public string Type { get; set; }
-
- ///
- /// Gets or sets the sort order - ascending
- ///
- /// The sort order.
- public int? SortOrder { get; set; }
-
- public string ImageUrl { get; set; }
-
- public Dictionary ProviderIds { get; set; }
-
- ///
- /// Returns a that represents this instance.
- ///
- /// A that represents this instance.
- public override string ToString()
- {
- return Name;
- }
-
- public bool IsType(string type)
- {
- return string.Equals(Type, type, StringComparison.OrdinalIgnoreCase) || string.Equals(Role, type, StringComparison.OrdinalIgnoreCase);
- }
- }
}
diff --git a/MediaBrowser.Controller/Entities/PersonInfo.cs b/MediaBrowser.Controller/Entities/PersonInfo.cs
new file mode 100644
index 0000000000..e90c55a8ac
--- /dev/null
+++ b/MediaBrowser.Controller/Entities/PersonInfo.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using MediaBrowser.Model.Entities;
+
+namespace MediaBrowser.Controller.Entities
+{
+ ///
+ /// This is a small Person stub that is attached to BaseItems.
+ ///
+ public sealed class PersonInfo : IHasProviderIds
+ {
+ public PersonInfo()
+ {
+ ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase);
+ }
+
+ public Guid ItemId { get; set; }
+
+ ///
+ /// Gets or sets the name.
+ ///
+ /// The name.
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the role.
+ ///
+ /// The role.
+ public string Role { get; set; }
+
+ ///
+ /// Gets or sets the type.
+ ///
+ /// The type.
+ public string Type { get; set; }
+
+ ///
+ /// Gets or sets the ascending sort order.
+ ///
+ /// The sort order.
+ public int? SortOrder { get; set; }
+
+ public string ImageUrl { get; set; }
+
+ public Dictionary ProviderIds { get; set; }
+
+ ///
+ /// Returns a that represents this instance.
+ ///
+ /// A that represents this instance.
+ public override string ToString()
+ {
+ return Name;
+ }
+
+ public bool IsType(string type)
+ {
+ return string.Equals(Type, type, StringComparison.OrdinalIgnoreCase)
+ || string.Equals(Role, type, StringComparison.OrdinalIgnoreCase);
+ }
+ }
+}
diff --git a/MediaBrowser.Controller/Entities/UserRootFolder.cs b/MediaBrowser.Controller/Entities/UserRootFolder.cs
index 7fcf48a48f..8a68f830cc 100644
--- a/MediaBrowser.Controller/Entities/UserRootFolder.cs
+++ b/MediaBrowser.Controller/Entities/UserRootFolder.cs
@@ -60,14 +60,7 @@ namespace MediaBrowser.Controller.Entities
PresetViews = query.PresetViews
});
- var itemsArray = result;
- var totalCount = itemsArray.Length;
-
- return new QueryResult
- {
- TotalRecordCount = totalCount,
- Items = itemsArray //TODO Fix The co-variant conversion between Folder[] and BaseItem[], this can generate runtime issues.
- };
+ return UserViewBuilder.SortAndPage(result, null, query, LibraryManager, true);
}
public override int GetChildCount(User user)
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index af4d227bc8..c3ea7f347a 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -7,7 +7,6 @@ using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv;
-using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Dto;
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index 60c76ef7db..88e9055e84 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -8,7 +8,7 @@
-
+
@@ -26,4 +26,16 @@
true
+
+
+
+
+
+
+
+
+
+ ../jellyfin.ruleset
+
+
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
index acc89e352b..342c764146 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
@@ -475,7 +475,7 @@ namespace MediaBrowser.Controller.MediaEncoding
.Append(' ');
}
- if (state.IsVideoRequest
+ if (state.IsVideoRequest
&& string.Equals(encodingOptions.HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
{
var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, encodingOptions);
@@ -486,11 +486,11 @@ namespace MediaBrowser.Controller.MediaEncoding
if (!string.IsNullOrEmpty(videoDecoder) && videoDecoder.Contains("qsv", StringComparison.OrdinalIgnoreCase))
{
arg.Append("-hwaccel qsv ");
- }
- else
+ }
+ else
{
arg.Append("-init_hw_device qsv=hw -filter_hw_device hw ");
- }
+ }
}
arg.Append(videoDecoder + " ");
@@ -653,7 +653,7 @@ namespace MediaBrowser.Controller.MediaEncoding
// _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(fallbackFontPath));
// using (var stream = _assemblyInfo.GetManifestResourceStream(GetType(), GetType().Namespace + ".DroidSansFallback.ttf"))
// {
- // using (var fileStream = _fileSystem.GetFileStream(fallbackFontPath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
+ // using (var fileStream = new FileStream(fallbackFontPath, FileMode.Create, FileAccess.Write, FileShare.Read))
// {
// stream.CopyTo(fileStream);
// }
@@ -1624,22 +1624,22 @@ namespace MediaBrowser.Controller.MediaEncoding
// Setup default filtergraph utilizing FFMpeg overlay() and FFMpeg scale() (see the return of this function for index reference)
var retStr = " -filter_complex \"[{0}:{1}]{4}[sub];[0:{2}][sub]overlay{3}\"";
- if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase))
{
/*
QSV in FFMpeg can now setup hardware overlay for transcodes.
For software decoding and hardware encoding option, frames must be hwuploaded into hardware
- with fixed frame size.
+ with fixed frame size.
*/
if (!string.IsNullOrEmpty(videoDecoder) && videoDecoder.Contains("qsv", StringComparison.OrdinalIgnoreCase))
{
retStr = " -filter_complex \"[{0}:{1}]{4}[sub];[0:{2}][sub]overlay_qsv=x=(W-w)/2:y=(H-h)/2{3}\"";
- }
- else
+ }
+ else
{
retStr = " -filter_complex \"[{0}:{1}]{4}[sub];[0:{2}]hwupload=extra_hw_frames=64[v];[v][sub]overlay_qsv=x=(W-w)/2:y=(H-h)/2{3}\"";
}
- }
+ }
return string.Format(
CultureInfo.InvariantCulture,
@@ -1731,8 +1731,8 @@ namespace MediaBrowser.Controller.MediaEncoding
vaapi_or_qsv,
outputWidth,
outputHeight));
- }
- else
+ }
+ else
{
filters.Add(string.Format(CultureInfo.InvariantCulture, "scale_{0}=format=nv12", vaapi_or_qsv));
}
@@ -1979,8 +1979,8 @@ namespace MediaBrowser.Controller.MediaEncoding
var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, options);
- // If we are software decoding, and hardware encoding
- if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase)
+ // If we are software decoding, and hardware encoding
+ if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase)
&& (string.IsNullOrEmpty(videoDecoder) || !videoDecoder.Contains("qsv", StringComparison.OrdinalIgnoreCase)))
{
filters.Add("format=nv12|qsv");
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
index 34af3b1568..35f188bb79 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
@@ -665,7 +665,7 @@ namespace MediaBrowser.Controller.MediaEncoding
}
public IProgress Progress { get; set; }
- public virtual void ReportTranscodingProgress(TimeSpan? transcodingPosition, float framerate, double? percentComplete, long bytesTranscoded, int? bitRate)
+ public virtual void ReportTranscodingProgress(TimeSpan? transcodingPosition, float? framerate, double? percentComplete, long? bytesTranscoded, int? bitRate)
{
Progress.Report(percentComplete.Value);
}
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs
index d64feb2f7c..addc88174f 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Globalization;
using System.Linq;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Services;
diff --git a/MediaBrowser.Controller/MediaEncoding/JobLogger.cs b/MediaBrowser.Controller/MediaEncoding/JobLogger.cs
index ac989f6ba1..c9f64c7075 100644
--- a/MediaBrowser.Controller/MediaEncoding/JobLogger.cs
+++ b/MediaBrowser.Controller/MediaEncoding/JobLogger.cs
@@ -4,7 +4,6 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using MediaBrowser.Model.Extensions;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Controller.MediaEncoding
@@ -90,6 +89,15 @@ namespace MediaBrowser.Controller.MediaEncoding
framerate = val;
}
}
+ else if (part.StartsWith("fps=", StringComparison.OrdinalIgnoreCase))
+ {
+ var rate = part.Split(new[] { '=' }, 2)[^1];
+
+ if (float.TryParse(rate, NumberStyles.Any, _usCulture, out var val))
+ {
+ framerate = val;
+ }
+ }
else if (state.RunTimeTicks.HasValue &&
part.StartsWith("time=", StringComparison.OrdinalIgnoreCase))
{
@@ -146,7 +154,7 @@ namespace MediaBrowser.Controller.MediaEncoding
if (framerate.HasValue || percent.HasValue)
{
- state.ReportTranscodingProgress(transcodingPosition, 0, percent, 0, bitRate);
+ state.ReportTranscodingProgress(transcodingPosition, framerate, percent, bytesTranscoded, bitRate);
}
}
}
diff --git a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs
index ee5c1a165a..b710318eee 100644
--- a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs
+++ b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs
@@ -22,7 +22,7 @@ namespace MediaBrowser.Controller.Net
///
/// The _active connections
///
- protected readonly List> ActiveConnections =
+ private readonly List> _activeConnections =
new List>();
///
@@ -100,9 +100,9 @@ namespace MediaBrowser.Controller.Net
InitialDelayMs = dueTimeMs
};
- lock (ActiveConnections)
+ lock (_activeConnections)
{
- ActiveConnections.Add(new Tuple(message.Connection, cancellationTokenSource, state));
+ _activeConnections.Add(new Tuple(message.Connection, cancellationTokenSource, state));
}
}
@@ -110,9 +110,9 @@ namespace MediaBrowser.Controller.Net
{
Tuple[] tuples;
- lock (ActiveConnections)
+ lock (_activeConnections)
{
- tuples = ActiveConnections
+ tuples = _activeConnections
.Where(c =>
{
if (c.Item1.State == WebSocketState.Open && !c.Item2.IsCancellationRequested)
@@ -180,9 +180,9 @@ namespace MediaBrowser.Controller.Net
/// The message.
private void Stop(WebSocketMessageInfo message)
{
- lock (ActiveConnections)
+ lock (_activeConnections)
{
- var connection = ActiveConnections.FirstOrDefault(c => c.Item1 == message.Connection);
+ var connection = _activeConnections.FirstOrDefault(c => c.Item1 == message.Connection);
if (connection != null)
{
@@ -212,9 +212,9 @@ namespace MediaBrowser.Controller.Net
//TODO Investigate and properly fix.
}
- lock (ActiveConnections)
+ lock (_activeConnections)
{
- ActiveConnections.Remove(connection);
+ _activeConnections.Remove(connection);
}
}
@@ -226,9 +226,9 @@ namespace MediaBrowser.Controller.Net
{
if (dispose)
{
- lock (ActiveConnections)
+ lock (_activeConnections)
{
- foreach (var connection in ActiveConnections.ToArray())
+ foreach (var connection in _activeConnections.ToArray())
{
DisposeConnection(connection);
}
diff --git a/MediaBrowser.Controller/Net/IHttpResultFactory.cs b/MediaBrowser.Controller/Net/IHttpResultFactory.cs
index ff9ecf8af0..25404fa78d 100644
--- a/MediaBrowser.Controller/Net/IHttpResultFactory.cs
+++ b/MediaBrowser.Controller/Net/IHttpResultFactory.cs
@@ -2,8 +2,6 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
-
-using MediaBrowser.Model.IO;
using MediaBrowser.Model.Services;
namespace MediaBrowser.Controller.Net
@@ -66,7 +64,7 @@ namespace MediaBrowser.Controller.Net
/// The path.
/// The file share.
/// System.Object.
- Task GetStaticFileResult(IRequest requestContext, string path, FileShareMode fileShare = FileShareMode.Read);
+ Task GetStaticFileResult(IRequest requestContext, string path, FileShare fileShare = FileShare.Read);
///
/// Gets the static file result.
diff --git a/MediaBrowser.Controller/Net/IWebSocketConnection.cs b/MediaBrowser.Controller/Net/IWebSocketConnection.cs
index 566897b31f..31eb7ccb75 100644
--- a/MediaBrowser.Controller/Net/IWebSocketConnection.cs
+++ b/MediaBrowser.Controller/Net/IWebSocketConnection.cs
@@ -3,7 +3,6 @@ using System.Net.WebSockets;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Net;
-using MediaBrowser.Model.Services;
using Microsoft.AspNetCore.Http;
namespace MediaBrowser.Controller.Net
diff --git a/MediaBrowser.Controller/Net/StaticResultOptions.cs b/MediaBrowser.Controller/Net/StaticResultOptions.cs
index 7a179913ac..071beaed19 100644
--- a/MediaBrowser.Controller/Net/StaticResultOptions.cs
+++ b/MediaBrowser.Controller/Net/StaticResultOptions.cs
@@ -3,8 +3,6 @@ using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
-using MediaBrowser.Model.IO;
-
namespace MediaBrowser.Controller.Net
{
public class StaticResultOptions
@@ -24,12 +22,12 @@ namespace MediaBrowser.Controller.Net
public string Path { get; set; }
public long? ContentLength { get; set; }
- public FileShareMode FileShare { get; set; }
+ public FileShare FileShare { get; set; }
public StaticResultOptions()
{
ResponseHeaders = new Dictionary(StringComparer.OrdinalIgnoreCase);
- FileShare = FileShareMode.Read;
+ FileShare = FileShare.Read;
}
}
diff --git a/MediaBrowser.Controller/Persistence/MediaAttachmentQuery.cs b/MediaBrowser.Controller/Persistence/MediaAttachmentQuery.cs
index 91ab34aab6..e3b2d46650 100644
--- a/MediaBrowser.Controller/Persistence/MediaAttachmentQuery.cs
+++ b/MediaBrowser.Controller/Persistence/MediaAttachmentQuery.cs
@@ -1,5 +1,4 @@
using System;
-using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Persistence
{
diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs
index acda6a4166..6e8385cf85 100644
--- a/MediaBrowser.Controller/Session/SessionInfo.cs
+++ b/MediaBrowser.Controller/Session/SessionInfo.cs
@@ -126,12 +126,6 @@ namespace MediaBrowser.Controller.Session
[JsonIgnore]
public ISessionController[] SessionControllers { get; set; }
- ///
- /// Gets or sets the application icon URL.
- ///
- /// The application icon URL.
- public string AppIconUrl { get; set; }
-
///
/// Gets or sets the supported commands.
///
@@ -259,7 +253,7 @@ namespace MediaBrowser.Controller.Session
foreach (var additionalUser in AdditionalUsers)
{
- if (userId.Equals(userId))
+ if (additionalUser.UserId.Equals(userId))
{
return true;
}
@@ -321,7 +315,7 @@ namespace MediaBrowser.Controller.Session
var newPositionTicks = positionTicks + ProgressIncrement;
var item = progressInfo.Item;
- long? runtimeTicks = item == null ? null : item.RunTimeTicks;
+ long? runtimeTicks = item?.RunTimeTicks;
// Don't report beyond the runtime
if (runtimeTicks.HasValue && newPositionTicks >= runtimeTicks.Value)
diff --git a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs
index 59c8f4da50..d4b98182f9 100644
--- a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs
+++ b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs
@@ -9,7 +9,6 @@ using System.Xml;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.IO;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.LocalMetadata.Parsers
diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs
index bd727bcdf9..ba1d850e3c 100644
--- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs
+++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -93,7 +92,7 @@ namespace MediaBrowser.LocalMetadata.Savers
// On Windows, savint the file will fail if the file is hidden or readonly
FileSystem.SetAttributes(path, false, false);
- using (var filestream = FileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
+ using (var filestream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read))
{
stream.CopyTo(filestream);
}
diff --git a/MediaBrowser.MediaEncoding/BdInfo/BdInfoDirectoryInfo.cs b/MediaBrowser.MediaEncoding/BdInfo/BdInfoDirectoryInfo.cs
index 91c8b27925..e040286ab9 100644
--- a/MediaBrowser.MediaEncoding/BdInfo/BdInfoDirectoryInfo.cs
+++ b/MediaBrowser.MediaEncoding/BdInfo/BdInfoDirectoryInfo.cs
@@ -1,16 +1,27 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using BDInfo.IO;
using MediaBrowser.Model.IO;
namespace MediaBrowser.MediaEncoding.BdInfo
{
- class BdInfoDirectoryInfo : BDInfo.IO.IDirectoryInfo
+ class BdInfoDirectoryInfo : IDirectoryInfo
{
- IFileSystem _fileSystem = null;
+ private readonly IFileSystem _fileSystem = null;
- FileSystemMetadata _impl = null;
+ private readonly FileSystemMetadata _impl = null;
+
+ public BdInfoDirectoryInfo(IFileSystem fileSystem, string path)
+ {
+ _fileSystem = fileSystem;
+ _impl = _fileSystem.GetDirectoryInfo(path);
+ }
+
+ private BdInfoDirectoryInfo(IFileSystem fileSystem, FileSystemMetadata impl)
+ {
+ _fileSystem = fileSystem;
+ _impl = impl;
+ }
public string Name => _impl.Name;
@@ -25,22 +36,11 @@ namespace MediaBrowser.MediaEncoding.BdInfo
{
return new BdInfoDirectoryInfo(_fileSystem, parentFolder);
}
+
return null;
}
}
- public BdInfoDirectoryInfo(IFileSystem fileSystem, string path)
- {
- _fileSystem = fileSystem;
- _impl = _fileSystem.GetDirectoryInfo(path);
- }
-
- private BdInfoDirectoryInfo(IFileSystem fileSystem, FileSystemMetadata impl)
- {
- _fileSystem = fileSystem;
- _impl = impl;
- }
-
public IDirectoryInfo[] GetDirectories()
{
return Array.ConvertAll(_fileSystem.GetDirectories(_impl.FullName).ToArray(),
@@ -50,20 +50,20 @@ namespace MediaBrowser.MediaEncoding.BdInfo
public IFileInfo[] GetFiles()
{
return Array.ConvertAll(_fileSystem.GetFiles(_impl.FullName).ToArray(),
- x => new BdInfoFileInfo(_fileSystem, x));
+ x => new BdInfoFileInfo(x));
}
public IFileInfo[] GetFiles(string searchPattern)
{
return Array.ConvertAll(_fileSystem.GetFiles(_impl.FullName, new[] { searchPattern }, false, false).ToArray(),
- x => new BdInfoFileInfo(_fileSystem, x));
+ x => new BdInfoFileInfo(x));
}
public IFileInfo[] GetFiles(string searchPattern, System.IO.SearchOption searchOption)
{
return Array.ConvertAll(_fileSystem.GetFiles(_impl.FullName, new[] { searchPattern }, false,
searchOption.HasFlag(System.IO.SearchOption.AllDirectories)).ToArray(),
- x => new BdInfoFileInfo(_fileSystem, x));
+ x => new BdInfoFileInfo(x));
}
public static IDirectoryInfo FromFileSystemPath(Model.IO.IFileSystem fs, string path)
diff --git a/MediaBrowser.MediaEncoding/BdInfo/BdInfoFileInfo.cs b/MediaBrowser.MediaEncoding/BdInfo/BdInfoFileInfo.cs
index de9d7cb784..a6ff4f7678 100644
--- a/MediaBrowser.MediaEncoding/BdInfo/BdInfoFileInfo.cs
+++ b/MediaBrowser.MediaEncoding/BdInfo/BdInfoFileInfo.cs
@@ -1,11 +1,10 @@
+using System.IO;
using MediaBrowser.Model.IO;
namespace MediaBrowser.MediaEncoding.BdInfo
{
class BdInfoFileInfo : BDInfo.IO.IFileInfo
{
- IFileSystem _fileSystem = null;
-
FileSystemMetadata _impl = null;
public string Name => _impl.Name;
@@ -18,18 +17,17 @@ namespace MediaBrowser.MediaEncoding.BdInfo
public bool IsDir => _impl.IsDirectory;
- public BdInfoFileInfo(IFileSystem fileSystem, FileSystemMetadata impl)
+ public BdInfoFileInfo(FileSystemMetadata impl)
{
- _fileSystem = fileSystem;
_impl = impl;
}
public System.IO.Stream OpenRead()
{
- return _fileSystem.GetFileStream(FullName,
- FileOpenMode.Open,
- FileAccessMode.Read,
- FileShareMode.Read);
+ return new FileStream(FullName,
+ FileMode.Open,
+ FileAccess.Read,
+ FileShare.Read);
}
public System.IO.StreamReader OpenText()
diff --git a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj
index 783457bda3..a312dcd705 100644
--- a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj
+++ b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj
@@ -18,8 +18,8 @@
-
-
+
+
diff --git a/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs b/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs
index 605504418b..293cf5ea5b 100644
--- a/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs
+++ b/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs
@@ -5,7 +5,6 @@ using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
-using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.MediaEncoding.Subtitles
diff --git a/MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs b/MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs
index 0606dbdb29..c98dd15024 100644
--- a/MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs
+++ b/MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs
@@ -4,7 +4,6 @@ using System.Globalization;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading;
-using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.MediaInfo;
using Microsoft.Extensions.Logging;
diff --git a/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs b/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs
index 0d696b9064..b94d451653 100644
--- a/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs
+++ b/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading;
-using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.MediaEncoding.Subtitles
diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs
index 99bb368b26..a4a7595d29 100644
--- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs
@@ -691,7 +691,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
if (!string.Equals(text, newText))
{
- using (var fileStream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
+ using (var fileStream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.Read))
using (var writer = new StreamWriter(fileStream, encoding))
{
writer.Write(newText);
diff --git a/MediaBrowser.MediaEncoding/Subtitles/TtmlWriter.cs b/MediaBrowser.MediaEncoding/Subtitles/TtmlWriter.cs
index 4f15bac496..7d3e185784 100644
--- a/MediaBrowser.MediaEncoding/Subtitles/TtmlWriter.cs
+++ b/MediaBrowser.MediaEncoding/Subtitles/TtmlWriter.cs
@@ -1,4 +1,3 @@
-using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index cf6d9c2f6c..598ff3a808 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -159,7 +159,6 @@ namespace MediaBrowser.Model.Configuration
public MetadataOptions[] MetadataOptions { get; set; }
- public bool EnableAutomaticRestart { get; set; }
public bool SkipDeserializationForBasicTypes { get; set; }
public string ServerName { get; set; }
@@ -249,7 +248,6 @@ namespace MediaBrowser.Model.Configuration
EnableDashboardResponseCaching = true;
EnableCaseSensitiveItemIds = true;
- EnableAutomaticRestart = true;
AutoRunWebApp = true;
EnableRemoteAccess = true;
diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.cs
index 3629d15470..caaceda1bc 100644
--- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs
+++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs
@@ -169,9 +169,9 @@ namespace MediaBrowser.Model.Dlna
return ListHelper.ContainsIgnoreCase(expected.Split('|'), currentValue);
}
case ProfileConditionType.Equals:
- return StringHelper.EqualsIgnoreCase(currentValue, expected);
+ return string.Equals(currentValue, expected, StringComparison.OrdinalIgnoreCase);
case ProfileConditionType.NotEquals:
- return !StringHelper.EqualsIgnoreCase(currentValue, expected);
+ return !string.Equals(currentValue, expected, StringComparison.OrdinalIgnoreCase);
default:
throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
}
diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs
index 8d8fe9eb5b..f152ee8808 100644
--- a/MediaBrowser.Model/Dlna/DeviceProfile.cs
+++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs
@@ -122,7 +122,7 @@ namespace MediaBrowser.Model.Dlna
continue;
}
- if (!StringHelper.EqualsIgnoreCase(container, i.Container))
+ if (!string.Equals(container, i.Container, StringComparison.OrdinalIgnoreCase))
{
continue;
}
@@ -148,7 +148,7 @@ namespace MediaBrowser.Model.Dlna
continue;
}
- if (!StringHelper.EqualsIgnoreCase(container, i.Container))
+ if (!string.Equals(container, i.Container, StringComparison.OrdinalIgnoreCase))
{
continue;
}
@@ -158,7 +158,7 @@ namespace MediaBrowser.Model.Dlna
continue;
}
- if (!StringHelper.EqualsIgnoreCase(videoCodec, i.VideoCodec ?? string.Empty))
+ if (!string.Equals(videoCodec, i.VideoCodec ?? string.Empty, StringComparison.OrdinalIgnoreCase))
{
continue;
}
diff --git a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs
index 672784589f..333cab60da 100644
--- a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs
+++ b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs
@@ -17,53 +17,53 @@ namespace MediaBrowser.Model.Dlna
private MediaFormatProfile[] ResolveVideoFormatInternal(string container, string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType)
{
- if (StringHelper.EqualsIgnoreCase(container, "asf"))
+ if (string.Equals(container, "asf", StringComparison.OrdinalIgnoreCase))
{
MediaFormatProfile? val = ResolveVideoASFFormat(videoCodec, audioCodec, width, height);
return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { };
}
- if (StringHelper.EqualsIgnoreCase(container, "mp4"))
+ if (string.Equals(container, "mp4", StringComparison.OrdinalIgnoreCase))
{
MediaFormatProfile? val = ResolveVideoMP4Format(videoCodec, audioCodec, width, height);
return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { };
}
- if (StringHelper.EqualsIgnoreCase(container, "avi"))
+ if (string.Equals(container, "avi", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { MediaFormatProfile.AVI };
- if (StringHelper.EqualsIgnoreCase(container, "mkv"))
+ if (string.Equals(container, "mkv", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { MediaFormatProfile.MATROSKA };
- if (StringHelper.EqualsIgnoreCase(container, "mpeg2ps") ||
- StringHelper.EqualsIgnoreCase(container, "ts"))
+ if (string.Equals(container, "mpeg2ps", StringComparison.OrdinalIgnoreCase) ||
+ string.Equals(container, "ts", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { MediaFormatProfile.MPEG_PS_NTSC, MediaFormatProfile.MPEG_PS_PAL };
- if (StringHelper.EqualsIgnoreCase(container, "mpeg1video"))
+ if (string.Equals(container, "mpeg1video", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { MediaFormatProfile.MPEG1 };
- if (StringHelper.EqualsIgnoreCase(container, "mpeg2ts") ||
- StringHelper.EqualsIgnoreCase(container, "mpegts") ||
- StringHelper.EqualsIgnoreCase(container, "m2ts"))
+ if (string.Equals(container, "mpeg2ts", StringComparison.OrdinalIgnoreCase) ||
+ string.Equals(container, "mpegts", StringComparison.OrdinalIgnoreCase) ||
+ string.Equals(container, "m2ts", StringComparison.OrdinalIgnoreCase))
{
return ResolveVideoMPEG2TSFormat(videoCodec, audioCodec, width, height, timestampType);
}
- if (StringHelper.EqualsIgnoreCase(container, "flv"))
+ if (string.Equals(container, "flv", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { MediaFormatProfile.FLV };
- if (StringHelper.EqualsIgnoreCase(container, "wtv"))
+ if (string.Equals(container, "wtv", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { MediaFormatProfile.WTV };
- if (StringHelper.EqualsIgnoreCase(container, "3gp"))
+ if (string.Equals(container, "3gp", StringComparison.OrdinalIgnoreCase))
{
MediaFormatProfile? val = ResolveVideo3GPFormat(videoCodec, audioCodec);
return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { };
}
- if (StringHelper.EqualsIgnoreCase(container, "ogv") || StringHelper.EqualsIgnoreCase(container, "ogg"))
+ if (string.Equals(container, "ogv", StringComparison.OrdinalIgnoreCase) || string.Equals(container, "ogg", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { MediaFormatProfile.OGV };
return new MediaFormatProfile[] { };
@@ -89,7 +89,7 @@ namespace MediaBrowser.Model.Dlna
resolution = "H";
}
- if (StringHelper.EqualsIgnoreCase(videoCodec, "mpeg2video"))
+ if (string.Equals(videoCodec, "mpeg2video", StringComparison.OrdinalIgnoreCase))
{
var list = new List();
@@ -97,18 +97,18 @@ namespace MediaBrowser.Model.Dlna
list.Add(ValueOf("MPEG_TS_SD_EU" + suffix));
list.Add(ValueOf("MPEG_TS_SD_KO" + suffix));
- if ((timestampType == TransportStreamTimestamp.Valid) && StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
+ if ((timestampType == TransportStreamTimestamp.Valid) && string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
{
list.Add(MediaFormatProfile.MPEG_TS_JP_T);
}
return list.ToArray();
}
- if (StringHelper.EqualsIgnoreCase(videoCodec, "h264"))
+ if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
{
- if (StringHelper.EqualsIgnoreCase(audioCodec, "lpcm"))
+ if (string.Equals(audioCodec, "lpcm", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_50_LPCM_T };
- if (StringHelper.EqualsIgnoreCase(audioCodec, "dts"))
+ if (string.Equals(audioCodec, "dts", StringComparison.OrdinalIgnoreCase))
{
if (timestampType == TransportStreamTimestamp.None)
{
@@ -117,7 +117,7 @@ namespace MediaBrowser.Model.Dlna
return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_DTS_T };
}
- if (StringHelper.EqualsIgnoreCase(audioCodec, "mp2"))
+ if (string.Equals(audioCodec, "mp2", StringComparison.OrdinalIgnoreCase))
{
if (timestampType == TransportStreamTimestamp.None)
{
@@ -127,19 +127,19 @@ namespace MediaBrowser.Model.Dlna
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_T", resolution)) };
}
- if (StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
+ if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AAC_MULT5{1}", resolution, suffix)) };
- if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))
+ if (string.Equals(audioCodec, "mp3", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_MPEG1_L3{1}", resolution, suffix)) };
if (string.IsNullOrEmpty(audioCodec) ||
- StringHelper.EqualsIgnoreCase(audioCodec, "ac3"))
+ string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AC3{1}", resolution, suffix)) };
}
- else if (StringHelper.EqualsIgnoreCase(videoCodec, "vc1"))
+ else if (string.Equals(videoCodec, "vc1", StringComparison.OrdinalIgnoreCase))
{
- if (string.IsNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "ac3"))
+ if (string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase))
{
if ((width.HasValue && width.Value > 720) || (height.HasValue && height.Value > 576))
{
@@ -147,23 +147,23 @@ namespace MediaBrowser.Model.Dlna
}
return new MediaFormatProfile[] { MediaFormatProfile.VC1_TS_AP_L1_AC3_ISO };
}
- if (StringHelper.EqualsIgnoreCase(audioCodec, "dts"))
+ if (string.Equals(audioCodec, "dts", StringComparison.OrdinalIgnoreCase))
{
- suffix = StringHelper.EqualsIgnoreCase(suffix, "_ISO") ? suffix : "_T";
+ suffix = string.Equals(suffix, "_ISO", StringComparison.OrdinalIgnoreCase) ? suffix : "_T";
return new MediaFormatProfile[] { ValueOf(string.Format("VC1_TS_HD_DTS{0}", suffix)) };
}
}
- else if (StringHelper.EqualsIgnoreCase(videoCodec, "mpeg4") || StringHelper.EqualsIgnoreCase(videoCodec, "msmpeg4"))
+ else if (string.Equals(videoCodec, "mpeg4", StringComparison.OrdinalIgnoreCase) || string.Equals(videoCodec, "msmpeg4", StringComparison.OrdinalIgnoreCase))
{
- if (StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
+ if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AAC{0}", suffix)) };
- if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))
+ if (string.Equals(audioCodec, "mp3", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG1_L3{0}", suffix)) };
- if (StringHelper.EqualsIgnoreCase(audioCodec, "mp2"))
+ if (string.Equals(audioCodec, "mp2", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG2_L2{0}", suffix)) };
- if (StringHelper.EqualsIgnoreCase(audioCodec, "ac3"))
+ if (string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AC3{0}", suffix)) };
}
@@ -177,16 +177,16 @@ namespace MediaBrowser.Model.Dlna
private MediaFormatProfile? ResolveVideoMP4Format(string videoCodec, string audioCodec, int? width, int? height)
{
- if (StringHelper.EqualsIgnoreCase(videoCodec, "h264"))
+ if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
{
- if (StringHelper.EqualsIgnoreCase(audioCodec, "lpcm"))
+ if (string.Equals(audioCodec, "lpcm", StringComparison.OrdinalIgnoreCase))
return MediaFormatProfile.AVC_MP4_LPCM;
if (string.IsNullOrEmpty(audioCodec) ||
- StringHelper.EqualsIgnoreCase(audioCodec, "ac3"))
+ string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.AVC_MP4_MP_SD_AC3;
}
- if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))
+ if (string.Equals(audioCodec, "mp3", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.AVC_MP4_MP_SD_MPEG1_L3;
}
@@ -194,41 +194,41 @@ namespace MediaBrowser.Model.Dlna
{
if ((width.Value <= 720) && (height.Value <= 576))
{
- if (StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
+ if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
return MediaFormatProfile.AVC_MP4_MP_SD_AAC_MULT5;
}
else if ((width.Value <= 1280) && (height.Value <= 720))
{
- if (StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
+ if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
return MediaFormatProfile.AVC_MP4_MP_HD_720p_AAC;
}
else if ((width.Value <= 1920) && (height.Value <= 1080))
{
- if (StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
+ if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.AVC_MP4_MP_HD_1080i_AAC;
}
}
}
}
- else if (StringHelper.EqualsIgnoreCase(videoCodec, "mpeg4") ||
- StringHelper.EqualsIgnoreCase(videoCodec, "msmpeg4"))
+ else if (string.Equals(videoCodec, "mpeg4", StringComparison.OrdinalIgnoreCase) ||
+ string.Equals(videoCodec, "msmpeg4", StringComparison.OrdinalIgnoreCase))
{
if (width.HasValue && height.HasValue && width.Value <= 720 && height.Value <= 576)
{
- if (string.IsNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
+ if (string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
return MediaFormatProfile.MPEG4_P2_MP4_ASP_AAC;
- if (StringHelper.EqualsIgnoreCase(audioCodec, "ac3") || StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))
+ if (string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase) || string.Equals(audioCodec, "mp3", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.MPEG4_P2_MP4_NDSD;
}
}
- else if (string.IsNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
+ else if (string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.MPEG4_P2_MP4_SP_L6_AAC;
}
}
- else if (StringHelper.EqualsIgnoreCase(videoCodec, "h263") && StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
+ else if (string.Equals(videoCodec, "h263", StringComparison.OrdinalIgnoreCase) && string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.MPEG4_H263_MP4_P0_L10_AAC;
}
@@ -238,20 +238,20 @@ namespace MediaBrowser.Model.Dlna
private MediaFormatProfile? ResolveVideo3GPFormat(string videoCodec, string audioCodec)
{
- if (StringHelper.EqualsIgnoreCase(videoCodec, "h264"))
+ if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
{
- if (string.IsNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
+ if (string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
return MediaFormatProfile.AVC_3GPP_BL_QCIF15_AAC;
}
- else if (StringHelper.EqualsIgnoreCase(videoCodec, "mpeg4") ||
- StringHelper.EqualsIgnoreCase(videoCodec, "msmpeg4"))
+ else if (string.Equals(videoCodec, "mpeg4", StringComparison.OrdinalIgnoreCase) ||
+ string.Equals(videoCodec, "msmpeg4", StringComparison.OrdinalIgnoreCase))
{
- if (string.IsNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "wma"))
+ if (string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "wma", StringComparison.OrdinalIgnoreCase))
return MediaFormatProfile.MPEG4_P2_3GPP_SP_L0B_AAC;
- if (StringHelper.EqualsIgnoreCase(audioCodec, "amrnb"))
+ if (string.Equals(audioCodec, "amrnb", StringComparison.OrdinalIgnoreCase))
return MediaFormatProfile.MPEG4_P2_3GPP_SP_L0B_AMR;
}
- else if (StringHelper.EqualsIgnoreCase(videoCodec, "h263") && StringHelper.EqualsIgnoreCase(audioCodec, "amrnb"))
+ else if (string.Equals(videoCodec, "h263", StringComparison.OrdinalIgnoreCase) && string.Equals(audioCodec, "amrnb", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.MPEG4_H263_3GPP_P0_L10_AMR;
}
@@ -261,15 +261,15 @@ namespace MediaBrowser.Model.Dlna
private MediaFormatProfile? ResolveVideoASFFormat(string videoCodec, string audioCodec, int? width, int? height)
{
- if (StringHelper.EqualsIgnoreCase(videoCodec, "wmv") &&
- (string.IsNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "wma") || StringHelper.EqualsIgnoreCase(videoCodec, "wmapro")))
+ if (string.Equals(videoCodec, "wmv", StringComparison.OrdinalIgnoreCase) &&
+ (string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "wma", StringComparison.OrdinalIgnoreCase) || string.Equals(videoCodec, "wmapro", StringComparison.OrdinalIgnoreCase)))
{
if (width.HasValue && height.HasValue)
{
if ((width.Value <= 720) && (height.Value <= 576))
{
- if (string.IsNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "wma"))
+ if (string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "wma", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.WMVMED_FULL;
}
@@ -277,14 +277,14 @@ namespace MediaBrowser.Model.Dlna
}
}
- if (string.IsNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "wma"))
+ if (string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "wma", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.WMVHIGH_FULL;
}
return MediaFormatProfile.WMVHIGH_PRO;
}
- if (StringHelper.EqualsIgnoreCase(videoCodec, "vc1"))
+ if (string.Equals(videoCodec, "vc1", StringComparison.OrdinalIgnoreCase))
{
if (width.HasValue && height.HasValue)
{
@@ -296,7 +296,7 @@ namespace MediaBrowser.Model.Dlna
return MediaFormatProfile.VC1_ASF_AP_L3_WMA;
}
}
- else if (StringHelper.EqualsIgnoreCase(videoCodec, "mpeg2video"))
+ else if (string.Equals(videoCodec, "mpeg2video", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.DVR_MS;
}
@@ -306,27 +306,27 @@ namespace MediaBrowser.Model.Dlna
public MediaFormatProfile? ResolveAudioFormat(string container, int? bitrate, int? frequency, int? channels)
{
- if (StringHelper.EqualsIgnoreCase(container, "asf"))
+ if (string.Equals(container, "asf", StringComparison.OrdinalIgnoreCase))
return ResolveAudioASFFormat(bitrate);
- if (StringHelper.EqualsIgnoreCase(container, "mp3"))
+ if (string.Equals(container, "mp3", StringComparison.OrdinalIgnoreCase))
return MediaFormatProfile.MP3;
- if (StringHelper.EqualsIgnoreCase(container, "lpcm"))
+ if (string.Equals(container, "lpcm", StringComparison.OrdinalIgnoreCase))
return ResolveAudioLPCMFormat(frequency, channels);
- if (StringHelper.EqualsIgnoreCase(container, "mp4") ||
- StringHelper.EqualsIgnoreCase(container, "aac"))
+ if (string.Equals(container, "mp4", StringComparison.OrdinalIgnoreCase) ||
+ string.Equals(container, "aac", StringComparison.OrdinalIgnoreCase))
return ResolveAudioMP4Format(bitrate);
- if (StringHelper.EqualsIgnoreCase(container, "adts"))
+ if (string.Equals(container, "adts", StringComparison.OrdinalIgnoreCase))
return ResolveAudioADTSFormat(bitrate);
- if (StringHelper.EqualsIgnoreCase(container, "flac"))
+ if (string.Equals(container, "flac", StringComparison.OrdinalIgnoreCase))
return MediaFormatProfile.FLAC;
- if (StringHelper.EqualsIgnoreCase(container, "oga") ||
- StringHelper.EqualsIgnoreCase(container, "ogg"))
+ if (string.Equals(container, "oga", StringComparison.OrdinalIgnoreCase) ||
+ string.Equals(container, "ogg", StringComparison.OrdinalIgnoreCase))
return MediaFormatProfile.OGG;
return null;
@@ -388,17 +388,17 @@ namespace MediaBrowser.Model.Dlna
public MediaFormatProfile? ResolveImageFormat(string container, int? width, int? height)
{
- if (StringHelper.EqualsIgnoreCase(container, "jpeg") ||
- StringHelper.EqualsIgnoreCase(container, "jpg"))
+ if (string.Equals(container, "jpeg", StringComparison.OrdinalIgnoreCase) ||
+ string.Equals(container, "jpg", StringComparison.OrdinalIgnoreCase))
return ResolveImageJPGFormat(width, height);
- if (StringHelper.EqualsIgnoreCase(container, "png"))
+ if (string.Equals(container, "png", StringComparison.OrdinalIgnoreCase))
return ResolveImagePNGFormat(width, height);
- if (StringHelper.EqualsIgnoreCase(container, "gif"))
+ if (string.Equals(container, "gif", StringComparison.OrdinalIgnoreCase))
return MediaFormatProfile.GIF_LRG;
- if (StringHelper.EqualsIgnoreCase(container, "raw"))
+ if (string.Equals(container, "raw", StringComparison.OrdinalIgnoreCase))
return MediaFormatProfile.RAW;
return null;
diff --git a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs
index cf92633c31..8a00f4ae4f 100644
--- a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs
+++ b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs
@@ -76,9 +76,9 @@ namespace MediaBrowser.Model.Dlna
private static double GetVideoBitrateScaleFactor(string codec)
{
- if (StringHelper.EqualsIgnoreCase(codec, "h265") ||
- StringHelper.EqualsIgnoreCase(codec, "hevc") ||
- StringHelper.EqualsIgnoreCase(codec, "vp9"))
+ if (string.Equals(codec, "h265", StringComparison.OrdinalIgnoreCase) ||
+ string.Equals(codec, "hevc", StringComparison.OrdinalIgnoreCase) ||
+ string.Equals(codec, "vp9", StringComparison.OrdinalIgnoreCase))
{
return .5;
}
diff --git a/MediaBrowser.Model/Dlna/SearchCriteria.cs b/MediaBrowser.Model/Dlna/SearchCriteria.cs
index 4f47c28219..8919938814 100644
--- a/MediaBrowser.Model/Dlna/SearchCriteria.cs
+++ b/MediaBrowser.Model/Dlna/SearchCriteria.cs
@@ -48,22 +48,22 @@ namespace MediaBrowser.Model.Dlna
if (subFactors.Length == 3)
{
- if (StringHelper.EqualsIgnoreCase("upnp:class", subFactors[0]) &&
- (StringHelper.EqualsIgnoreCase("=", subFactors[1]) || StringHelper.EqualsIgnoreCase("derivedfrom", subFactors[1])))
+ if (string.Equals("upnp:class", subFactors[0], StringComparison.OrdinalIgnoreCase) &&
+ (string.Equals("=", subFactors[1]) || string.Equals("derivedfrom", subFactors[1], StringComparison.OrdinalIgnoreCase)))
{
- if (StringHelper.EqualsIgnoreCase("\"object.item.imageItem\"", subFactors[2]) || StringHelper.EqualsIgnoreCase("\"object.item.imageItem.photo\"", subFactors[2]))
+ if (string.Equals("\"object.item.imageItem\"", subFactors[2]) || string.Equals("\"object.item.imageItem.photo\"", subFactors[2], StringComparison.OrdinalIgnoreCase))
{
SearchType = SearchType.Image;
}
- else if (StringHelper.EqualsIgnoreCase("\"object.item.videoItem\"", subFactors[2]))
+ else if (string.Equals("\"object.item.videoItem\"", subFactors[2], StringComparison.OrdinalIgnoreCase))
{
SearchType = SearchType.Video;
}
- else if (StringHelper.EqualsIgnoreCase("\"object.container.playlistContainer\"", subFactors[2]))
+ else if (string.Equals("\"object.container.playlistContainer\"", subFactors[2], StringComparison.OrdinalIgnoreCase))
{
SearchType = SearchType.Playlist;
}
- else if (StringHelper.EqualsIgnoreCase("\"object.container.album.musicAlbum\"", subFactors[2]))
+ else if (string.Equals("\"object.container.album.musicAlbum\"", subFactors[2], StringComparison.OrdinalIgnoreCase))
{
SearchType = SearchType.MusicAlbum;
}
diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs
index 586e322e48..e039ac5d6f 100644
--- a/MediaBrowser.Model/Dlna/StreamBuilder.cs
+++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs
@@ -35,7 +35,7 @@ namespace MediaBrowser.Model.Dlna
foreach (MediaSourceInfo i in options.MediaSources)
{
if (string.IsNullOrEmpty(options.MediaSourceId) ||
- StringHelper.EqualsIgnoreCase(i.Id, options.MediaSourceId))
+ string.Equals(i.Id, options.MediaSourceId, StringComparison.OrdinalIgnoreCase))
{
mediaSources.Add(i);
}
@@ -68,7 +68,7 @@ namespace MediaBrowser.Model.Dlna
foreach (MediaSourceInfo i in options.MediaSources)
{
if (string.IsNullOrEmpty(options.MediaSourceId) ||
- StringHelper.EqualsIgnoreCase(i.Id, options.MediaSourceId))
+ string.Equals(i.Id, options.MediaSourceId, StringComparison.OrdinalIgnoreCase))
{
mediaSources.Add(i);
}
@@ -582,7 +582,7 @@ namespace MediaBrowser.Model.Dlna
{
foreach (var profile in subtitleProfiles)
{
- if (profile.Method == SubtitleDeliveryMethod.External && StringHelper.EqualsIgnoreCase(profile.Format, stream.Codec))
+ if (profile.Method == SubtitleDeliveryMethod.External && string.Equals(profile.Format, stream.Codec, StringComparison.OrdinalIgnoreCase))
{
return stream.Index;
}
@@ -1198,7 +1198,7 @@ namespace MediaBrowser.Model.Dlna
continue;
}
- if (subtitleStream.IsTextSubtitleStream == MediaStream.IsTextFormat(profile.Format) && StringHelper.EqualsIgnoreCase(profile.Format, subtitleStream.Codec))
+ if (subtitleStream.IsTextSubtitleStream == MediaStream.IsTextFormat(profile.Format) && string.Equals(profile.Format, subtitleStream.Codec, StringComparison.OrdinalIgnoreCase))
{
return profile;
}
@@ -1292,7 +1292,7 @@ namespace MediaBrowser.Model.Dlna
if ((profile.Method == SubtitleDeliveryMethod.External && subtitleStream.IsTextSubtitleStream == MediaStream.IsTextFormat(profile.Format)) ||
(profile.Method == SubtitleDeliveryMethod.Hls && subtitleStream.IsTextSubtitleStream))
{
- bool requiresConversion = !StringHelper.EqualsIgnoreCase(subtitleStream.Codec, profile.Format);
+ bool requiresConversion = !string.Equals(subtitleStream.Codec, profile.Format, StringComparison.OrdinalIgnoreCase);
if (!requiresConversion)
{
diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs
index 10efb9b383..7962b51ce2 100644
--- a/MediaBrowser.Model/Dlna/StreamInfo.cs
+++ b/MediaBrowser.Model/Dlna/StreamInfo.cs
@@ -153,18 +153,18 @@ namespace MediaBrowser.Model.Dlna
}
// Try to keep the url clean by omitting defaults
- if (StringHelper.EqualsIgnoreCase(pair.Name, "StartTimeTicks") &&
- StringHelper.EqualsIgnoreCase(pair.Value, "0"))
+ if (string.Equals(pair.Name, "StartTimeTicks", StringComparison.OrdinalIgnoreCase) &&
+ string.Equals(pair.Value, "0", StringComparison.OrdinalIgnoreCase))
{
continue;
}
- if (StringHelper.EqualsIgnoreCase(pair.Name, "SubtitleStreamIndex") &&
- StringHelper.EqualsIgnoreCase(pair.Value, "-1"))
+ if (string.Equals(pair.Name, "SubtitleStreamIndex", StringComparison.OrdinalIgnoreCase) &&
+ string.Equals(pair.Value, "-1", StringComparison.OrdinalIgnoreCase))
{
continue;
}
- if (StringHelper.EqualsIgnoreCase(pair.Name, "Static") &&
- StringHelper.EqualsIgnoreCase(pair.Value, "false"))
+ if (string.Equals(pair.Name, "Static", StringComparison.OrdinalIgnoreCase) &&
+ string.Equals(pair.Value, "false", StringComparison.OrdinalIgnoreCase))
{
continue;
}
@@ -192,7 +192,7 @@ namespace MediaBrowser.Model.Dlna
if (MediaType == DlnaProfileType.Audio)
{
- if (StringHelper.EqualsIgnoreCase(SubProtocol, "hls"))
+ if (string.Equals(SubProtocol, "hls", StringComparison.OrdinalIgnoreCase))
{
return string.Format("{0}/audio/{1}/master.m3u8?{2}", baseUrl, ItemId, queryString);
}
@@ -200,7 +200,7 @@ namespace MediaBrowser.Model.Dlna
return string.Format("{0}/audio/{1}/stream{2}?{3}", baseUrl, ItemId, extension, queryString);
}
- if (StringHelper.EqualsIgnoreCase(SubProtocol, "hls"))
+ if (string.Equals(SubProtocol, "hls", StringComparison.OrdinalIgnoreCase))
{
return string.Format("{0}/videos/{1}/master.m3u8?{2}", baseUrl, ItemId, queryString);
}
@@ -237,7 +237,7 @@ namespace MediaBrowser.Model.Dlna
long startPositionTicks = item.StartPositionTicks;
- var isHls = StringHelper.EqualsIgnoreCase(item.SubProtocol, "hls");
+ var isHls = string.Equals(item.SubProtocol, "hls", StringComparison.OrdinalIgnoreCase);
if (isHls)
{
@@ -370,7 +370,7 @@ namespace MediaBrowser.Model.Dlna
var list = new List();
// HLS will preserve timestamps so we can just grab the full subtitle stream
- long startPositionTicks = StringHelper.EqualsIgnoreCase(SubProtocol, "hls")
+ long startPositionTicks = string.Equals(SubProtocol, "hls", StringComparison.OrdinalIgnoreCase)
? 0
: (PlayMethod == PlayMethod.Transcode && !CopyTimestamps ? StartPositionTicks : 0);
@@ -435,7 +435,7 @@ namespace MediaBrowser.Model.Dlna
if (info.DeliveryMethod == SubtitleDeliveryMethod.External)
{
- if (MediaSource.Protocol == MediaProtocol.File || !StringHelper.EqualsIgnoreCase(stream.Codec, subtitleProfile.Format) || !stream.IsExternal)
+ if (MediaSource.Protocol == MediaProtocol.File || !string.Equals(stream.Codec, subtitleProfile.Format, StringComparison.OrdinalIgnoreCase) || !stream.IsExternal)
{
info.Url = string.Format("{0}/Videos/{1}/{2}/Subtitles/{3}/{4}/Stream.{5}",
baseUrl,
@@ -802,7 +802,7 @@ namespace MediaBrowser.Model.Dlna
foreach (string codec in AudioCodecs)
{
- if (StringHelper.EqualsIgnoreCase(codec, inputCodec))
+ if (string.Equals(codec, inputCodec, StringComparison.OrdinalIgnoreCase))
{
return string.IsNullOrEmpty(codec) ? new string[] { } : new[] { codec };
}
@@ -827,7 +827,7 @@ namespace MediaBrowser.Model.Dlna
foreach (string codec in VideoCodecs)
{
- if (StringHelper.EqualsIgnoreCase(codec, inputCodec))
+ if (string.Equals(codec, inputCodec, StringComparison.OrdinalIgnoreCase))
{
return string.IsNullOrEmpty(codec) ? new string[] { } : new[] { codec };
}
@@ -884,7 +884,7 @@ namespace MediaBrowser.Model.Dlna
{
get
{
- var defaultValue = StringHelper.EqualsIgnoreCase(Container, "m2ts")
+ var defaultValue = string.Equals(Container, "m2ts", StringComparison.OrdinalIgnoreCase)
? TransportStreamTimestamp.Valid
: TransportStreamTimestamp.None;
diff --git a/MediaBrowser.Model/Dto/MediaSourceInfo.cs b/MediaBrowser.Model/Dto/MediaSourceInfo.cs
index 16a212a81b..563865ebe9 100644
--- a/MediaBrowser.Model/Dto/MediaSourceInfo.cs
+++ b/MediaBrowser.Model/Dto/MediaSourceInfo.cs
@@ -210,10 +210,7 @@ namespace MediaBrowser.Model.Dto
{
if (currentStream.Type == MediaStreamType.Audio && currentStream.IsDefault)
{
- if (currentStream.Index != stream.Index)
- {
- return true;
- }
+ return currentStream.Index != stream.Index;
}
}
diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs
index 5652962daf..5122f42b8a 100644
--- a/MediaBrowser.Model/Entities/MediaStream.cs
+++ b/MediaBrowser.Model/Entities/MediaStream.cs
@@ -88,11 +88,11 @@ namespace MediaBrowser.Model.Entities
{
attributes.Add(StringHelper.FirstToUpper(Language));
}
- if (!string.IsNullOrEmpty(Codec) && !StringHelper.EqualsIgnoreCase(Codec, "dca"))
+ if (!string.IsNullOrEmpty(Codec) && !string.Equals(Codec, "dca", StringComparison.OrdinalIgnoreCase))
{
attributes.Add(AudioCodec.GetFriendlyName(Codec));
}
- else if (!string.IsNullOrEmpty(Profile) && !StringHelper.EqualsIgnoreCase(Profile, "lc"))
+ else if (!string.IsNullOrEmpty(Profile) && !string.Equals(Profile, "lc", StringComparison.OrdinalIgnoreCase))
{
attributes.Add(Profile);
}
@@ -394,8 +394,8 @@ namespace MediaBrowser.Model.Entities
return codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) == -1 &&
codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) == -1 &&
codec.IndexOf("dvbsub", StringComparison.OrdinalIgnoreCase) == -1 &&
- !StringHelper.EqualsIgnoreCase(codec, "sub") &&
- !StringHelper.EqualsIgnoreCase(codec, "dvb_subtitle");
+ !string.Equals(codec, "sub", StringComparison.OrdinalIgnoreCase) &&
+ !string.Equals(codec, "dvb_subtitle", StringComparison.OrdinalIgnoreCase);
}
public bool SupportsSubtitleConversionTo(string toCodec)
@@ -408,21 +408,21 @@ namespace MediaBrowser.Model.Entities
var fromCodec = Codec;
// Can't convert from this
- if (StringHelper.EqualsIgnoreCase(fromCodec, "ass"))
+ if (string.Equals(fromCodec, "ass", StringComparison.OrdinalIgnoreCase))
{
return false;
}
- if (StringHelper.EqualsIgnoreCase(fromCodec, "ssa"))
+ if (string.Equals(fromCodec, "ssa", StringComparison.OrdinalIgnoreCase))
{
return false;
}
// Can't convert to this
- if (StringHelper.EqualsIgnoreCase(toCodec, "ass"))
+ if (string.Equals(toCodec, "ass", StringComparison.OrdinalIgnoreCase))
{
return false;
}
- if (StringHelper.EqualsIgnoreCase(toCodec, "ssa"))
+ if (string.Equals(toCodec, "ssa", StringComparison.OrdinalIgnoreCase))
{
return false;
}
diff --git a/MediaBrowser.Model/Extensions/ListHelper.cs b/MediaBrowser.Model/Extensions/ListHelper.cs
index b5bd077028..d751f77a77 100644
--- a/MediaBrowser.Model/Extensions/ListHelper.cs
+++ b/MediaBrowser.Model/Extensions/ListHelper.cs
@@ -2,6 +2,7 @@ using System;
namespace MediaBrowser.Model.Extensions
{
+ // TODO: @bond remove
public static class ListHelper
{
public static bool ContainsIgnoreCase(string[] list, string value)
diff --git a/MediaBrowser.Model/Extensions/StringHelper.cs b/MediaBrowser.Model/Extensions/StringHelper.cs
index 75ba12a178..f97a07096c 100644
--- a/MediaBrowser.Model/Extensions/StringHelper.cs
+++ b/MediaBrowser.Model/Extensions/StringHelper.cs
@@ -1,57 +1,38 @@
-using System;
-using System.Text;
-
namespace MediaBrowser.Model.Extensions
{
///
- /// Isolating these helpers allow this entire project to be easily converted to Java
+ /// Helper methods for manipulating strings.
///
public static class StringHelper
{
///
- /// Equalses the ignore case.
+ /// Returns the string with the first character as uppercase.
///
- /// The STR1.
- /// The STR2.
- /// true if XXXX, false otherwise.
- public static bool EqualsIgnoreCase(string str1, string str2)
+ /// The input string.
+ /// The string with the first character as uppercase.
+ public static string FirstToUpper(string str)
{
- return string.Equals(str1, str2, StringComparison.OrdinalIgnoreCase);
- }
-
- ///
- /// Replaces the specified STR.
- ///
- /// The STR.
- /// The old value.
- /// The new value.
- /// The comparison.
- /// System.String.
- public static string Replace(this string str, string oldValue, string newValue, StringComparison comparison)
- {
- var sb = new StringBuilder();
-
- var previousIndex = 0;
- var index = str.IndexOf(oldValue, comparison);
-
- while (index != -1)
+ if (string.IsNullOrEmpty(str))
{
- sb.Append(str.Substring(previousIndex, index - previousIndex));
- sb.Append(newValue);
- index += oldValue.Length;
-
- previousIndex = index;
- index = str.IndexOf(oldValue, index, comparison);
+ return string.Empty;
}
- sb.Append(str.Substring(previousIndex));
-
- return sb.ToString();
- }
+ if (char.IsUpper(str[0]))
+ {
+ return str;
+ }
- public static string FirstToUpper(this string str)
- {
- return string.IsNullOrEmpty(str) ? string.Empty : str.Substring(0, 1).ToUpperInvariant() + str.Substring(1);
+ return string.Create(
+ str.Length,
+ str,
+ (chars, buf) =>
+ {
+ chars[0] = char.ToUpperInvariant(buf[0]);
+ for (int i = 1; i < chars.Length; i++)
+ {
+ chars[i] = buf[i];
+ }
+ });
}
}
}
diff --git a/MediaBrowser.Model/IO/IFileSystem.cs b/MediaBrowser.Model/IO/IFileSystem.cs
index ca99b28ca4..6a874d0470 100644
--- a/MediaBrowser.Model/IO/IFileSystem.cs
+++ b/MediaBrowser.Model/IO/IFileSystem.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.IO;
namespace MediaBrowser.Model.IO
{
@@ -98,20 +97,6 @@ namespace MediaBrowser.Model.IO
/// DateTime.
DateTime GetLastWriteTimeUtc(string path);
- ///
- /// Gets the file stream.
- ///
- /// The path.
- /// The mode.
- /// The access.
- /// The share.
- /// if set to true [is asynchronous].
- /// FileStream.
- Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileShareMode share, bool isAsync = false);
-
- Stream GetFileStream(string path, FileOpenMode mode, FileAccessMode access, FileShareMode share,
- FileOpenOptions fileOpenOptions);
-
///
/// Swaps the files.
///
@@ -218,128 +203,4 @@ namespace MediaBrowser.Model.IO
List GetDrives();
void SetExecutable(string path);
}
-
- //TODO Investigate if can be replaced by the one from System.IO ?
- public enum FileOpenMode
- {
- //
- // Summary:
- // Specifies that the operating system should create a new file. This requires System.Security.Permissions.FileIOPermissionAccess.Write
- // permission. If the file already exists, an System.IO.IOException exception is
- // thrown.
- CreateNew = 1,
- //
- // Summary:
- // Specifies that the operating system should create a new file. If the file already
- // exists, it will be overwritten. This requires System.Security.Permissions.FileIOPermissionAccess.Write
- // permission. FileMode.Create is equivalent to requesting that if the file does
- // not exist, use System.IO.FileMode.CreateNew; otherwise, use System.IO.FileMode.Truncate.
- // If the file already exists but is a hidden file, an System.UnauthorizedAccessException
- // exception is thrown.
- Create = 2,
- //
- // Summary:
- // Specifies that the operating system should open an existing file. The ability
- // to open the file is dependent on the value specified by the System.IO.FileAccess
- // enumeration. A System.IO.FileNotFoundException exception is thrown if the file
- // does not exist.
- Open = 3,
- //
- // Summary:
- // Specifies that the operating system should open a file if it exists; otherwise,
- // a new file should be created. If the file is opened with FileAccess.Read, System.Security.Permissions.FileIOPermissionAccess.Read
- // permission is required. If the file access is FileAccess.Write, System.Security.Permissions.FileIOPermissionAccess.Write
- // permission is required. If the file is opened with FileAccess.ReadWrite, both
- // System.Security.Permissions.FileIOPermissionAccess.Read and System.Security.Permissions.FileIOPermissionAccess.Write
- // permissions are required.
- OpenOrCreate = 4
- }
-
- public enum FileAccessMode
- {
- //
- // Summary:
- // Read access to the file. Data can be read from the file. Combine with Write for
- // read/write access.
- Read = 1,
- //
- // Summary:
- // Write access to the file. Data can be written to the file. Combine with Read
- // for read/write access.
- Write = 2
- }
-
- public enum FileShareMode
- {
- //
- // Summary:
- // Declines sharing of the current file. Any request to open the file (by this process
- // or another process) will fail until the file is closed.
- None = 0,
- //
- // Summary:
- // Allows subsequent opening of the file for reading. If this flag is not specified,
- // any request to open the file for reading (by this process or another process)
- // will fail until the file is closed. However, even if this flag is specified,
- // additional permissions might still be needed to access the file.
- Read = 1,
- //
- // Summary:
- // Allows subsequent opening of the file for writing. If this flag is not specified,
- // any request to open the file for writing (by this process or another process)
- // will fail until the file is closed. However, even if this flag is specified,
- // additional permissions might still be needed to access the file.
- Write = 2,
- //
- // Summary:
- // Allows subsequent opening of the file for reading or writing. If this flag is
- // not specified, any request to open the file for reading or writing (by this process
- // or another process) will fail until the file is closed. However, even if this
- // flag is specified, additional permissions might still be needed to access the
- // file.
- ReadWrite = 3
- }
-
- //
- // Summary:
- // Represents advanced options for creating a System.IO.FileStream object.
- [Flags]
- public enum FileOpenOptions
- {
- //
- // Summary:
- // Indicates that the system should write through any intermediate cache and go
- // directly to disk.
- WriteThrough = int.MinValue,
- //
- // Summary:
- // Indicates that no additional options should be used when creating a System.IO.FileStream
- // object.
- None = 0,
- //
- // Summary:
- // Indicates that a file is encrypted and can be decrypted only by using the same
- // user account used for encryption.
- Encrypted = 16384,
- //
- // Summary:
- // Indicates that a file is automatically deleted when it is no longer in use.
- DeleteOnClose = 67108864,
- //
- // Summary:
- // Indicates that the file is to be accessed sequentially from beginning to end.
- // The system can use this as a hint to optimize file caching. If an application
- // moves the file pointer for random access, optimum caching may not occur; however,
- // correct operation is still guaranteed.
- SequentialScan = 134217728,
- //
- // Summary:
- // Indicates that the file is accessed randomly. The system can use this as a hint
- // to optimize file caching.
- RandomAccess = 268435456,
- //
- // Summary:
- // Indicates that a file can be used for asynchronous reading and writing.
- Asynchronous = 1073741824
- }
}
diff --git a/MediaBrowser.Model/IO/StreamDefaults.cs b/MediaBrowser.Model/IO/IODefaults.cs
similarity index 58%
rename from MediaBrowser.Model/IO/StreamDefaults.cs
rename to MediaBrowser.Model/IO/IODefaults.cs
index 4b55ce1f30..f392dbcce2 100644
--- a/MediaBrowser.Model/IO/StreamDefaults.cs
+++ b/MediaBrowser.Model/IO/IODefaults.cs
@@ -1,18 +1,18 @@
namespace MediaBrowser.Model.IO
{
///
- /// Class StreamDefaults.
+ /// Class IODefaults.
///
- public static class StreamDefaults
+ public static class IODefaults
{
///
/// The default copy to buffer size.
///
- public const int DefaultCopyToBufferSize = 81920;
+ public const int CopyToBufferSize = 81920;
///
/// The default file stream buffer size.
///
- public const int DefaultFileStreamBufferSize = 4096;
+ public const int FileStreamBufferSize = 4096;
}
}
diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj
index 53cd08fbd0..dc9c78ab16 100644
--- a/MediaBrowser.Model/MediaBrowser.Model.csproj
+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj
@@ -8,16 +8,16 @@
- netstandard2.0
+ netstandard2.1
false
true
-
+
-
+
diff --git a/MediaBrowser.Model/Net/ISocketFactory.cs b/MediaBrowser.Model/Net/ISocketFactory.cs
index dc69b1fb25..a7965463ae 100644
--- a/MediaBrowser.Model/Net/ISocketFactory.cs
+++ b/MediaBrowser.Model/Net/ISocketFactory.cs
@@ -1,4 +1,3 @@
-using System.IO;
using System.Net;
namespace MediaBrowser.Model.Net
diff --git a/MediaBrowser.Model/Net/MimeTypes.cs b/MediaBrowser.Model/Net/MimeTypes.cs
index de5e58d220..42fff3775a 100644
--- a/MediaBrowser.Model/Net/MimeTypes.cs
+++ b/MediaBrowser.Model/Net/MimeTypes.cs
@@ -165,20 +165,20 @@ namespace MediaBrowser.Model.Net
}
// Type text
- if (StringHelper.EqualsIgnoreCase(ext, ".html")
- || StringHelper.EqualsIgnoreCase(ext, ".htm"))
+ if (string.Equals(ext, ".html", StringComparison.OrdinalIgnoreCase)
+ || string.Equals(ext, ".htm", StringComparison.OrdinalIgnoreCase))
{
return "text/html; charset=UTF-8";
}
- if (StringHelper.EqualsIgnoreCase(ext, ".log")
- || StringHelper.EqualsIgnoreCase(ext, ".srt"))
+ if (string.Equals(ext, ".log", StringComparison.OrdinalIgnoreCase)
+ || string.Equals(ext, ".srt", StringComparison.OrdinalIgnoreCase))
{
return "text/plain";
}
// Misc
- if (StringHelper.EqualsIgnoreCase(ext, ".dll"))
+ if (string.Equals(ext, ".dll", StringComparison.OrdinalIgnoreCase))
{
return "application/octet-stream";
}
diff --git a/MediaBrowser.Model/Notifications/NotificationOptions.cs b/MediaBrowser.Model/Notifications/NotificationOptions.cs
index f48b5ee7fc..38600b9c87 100644
--- a/MediaBrowser.Model/Notifications/NotificationOptions.cs
+++ b/MediaBrowser.Model/Notifications/NotificationOptions.cs
@@ -79,7 +79,7 @@ namespace MediaBrowser.Model.Notifications
{
foreach (NotificationOption i in Options)
{
- if (StringHelper.EqualsIgnoreCase(type, i.Type)) return i;
+ if (string.Equals(type, i.Type, StringComparison.OrdinalIgnoreCase)) return i;
}
return null;
}
diff --git a/MediaBrowser.Model/Tasks/IScheduledTask.cs b/MediaBrowser.Model/Tasks/IScheduledTask.cs
index a615ebb07e..71f6e15f8e 100644
--- a/MediaBrowser.Model/Tasks/IScheduledTask.cs
+++ b/MediaBrowser.Model/Tasks/IScheduledTask.cs
@@ -39,9 +39,9 @@ namespace MediaBrowser.Model.Tasks
Task Execute(CancellationToken cancellationToken, IProgress progress);
///
- /// Gets the default triggers.
+ /// Gets the default triggers that define when the task will run.
///
- /// IEnumerable{BaseTaskTrigger}.
+ /// The default triggers that define when the task will run.
IEnumerable GetDefaultTriggers();
}
}
diff --git a/MediaBrowser.Providers/Manager/ImageSaver.cs b/MediaBrowser.Providers/Manager/ImageSaver.cs
index ab906809f3..3ab621ba41 100644
--- a/MediaBrowser.Providers/Manager/ImageSaver.cs
+++ b/MediaBrowser.Providers/Manager/ImageSaver.cs
@@ -244,9 +244,9 @@ namespace MediaBrowser.Providers.Manager
_fileSystem.SetAttributes(path, false, false);
- using (var fs = _fileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, FileOpenOptions.Asynchronous))
+ using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, FileOptions.Asynchronous))
{
- await source.CopyToAsync(fs, StreamDefaults.DefaultCopyToBufferSize, cancellationToken).ConfigureAwait(false);
+ await source.CopyToAsync(fs, IODefaults.CopyToBufferSize, cancellationToken).ConfigureAwait(false);
}
if (_config.Configuration.SaveMetadataHidden)
diff --git a/MediaBrowser.Providers/Manager/ItemImageProvider.cs b/MediaBrowser.Providers/Manager/ItemImageProvider.cs
index e9179815e7..01c950260a 100644
--- a/MediaBrowser.Providers/Manager/ItemImageProvider.cs
+++ b/MediaBrowser.Providers/Manager/ItemImageProvider.cs
@@ -5,7 +5,6 @@ using System.Linq;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
-using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
@@ -25,14 +24,12 @@ namespace MediaBrowser.Providers.Manager
{
private readonly ILogger _logger;
private readonly IProviderManager _providerManager;
- private readonly IServerConfigurationManager _config;
private readonly IFileSystem _fileSystem;
- public ItemImageProvider(ILogger logger, IProviderManager providerManager, IServerConfigurationManager config, IFileSystem fileSystem)
+ public ItemImageProvider(ILogger logger, IProviderManager providerManager, IFileSystem fileSystem)
{
_logger = logger;
_providerManager = providerManager;
- _config = config;
_fileSystem = fileSystem;
}
@@ -141,7 +138,7 @@ namespace MediaBrowser.Providers.Manager
{
var mimeType = MimeTypes.GetMimeType(response.Path);
- var stream = _fileSystem.GetFileStream(response.Path, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read, true);
+ var stream = new FileStream(response.Path, FileMode.Open, FileAccess.Read, FileShare.Read, IODefaults.FileStreamBufferSize, true);
await _providerManager.SaveImage(item, stream, mimeType, imageType, null, cancellationToken).ConfigureAwait(false);
}
diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs
index c3401f12b9..e6cb923e33 100644
--- a/MediaBrowser.Providers/Manager/MetadataService.cs
+++ b/MediaBrowser.Providers/Manager/MetadataService.cs
@@ -73,7 +73,7 @@ namespace MediaBrowser.Providers.Manager
}
}
- var itemImageProvider = new ItemImageProvider(Logger, ProviderManager, ServerConfigurationManager, FileSystem);
+ var itemImageProvider = new ItemImageProvider(Logger, ProviderManager, FileSystem);
var localImagesFailed = false;
var allImageProviders = ((ProviderManager)ProviderManager).GetImageProviders(item, refreshOptions).ToList();
diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs
index 631d063a54..e7b349f67b 100644
--- a/MediaBrowser.Providers/Manager/ProviderManager.cs
+++ b/MediaBrowser.Providers/Manager/ProviderManager.cs
@@ -182,7 +182,7 @@ namespace MediaBrowser.Providers.Manager
throw new ArgumentNullException(nameof(source));
}
- var fileStream = _fileSystem.GetFileStream(source, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, true);
+ var fileStream = new FileStream(source, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, IODefaults.FileStreamBufferSize, true);
return new ImageSaver(ConfigurationManager, _libraryMonitor, _fileSystem, _logger).SaveImage(item, fileStream, mimeType, type, imageIndex, saveLocallyWithMedia, cancellationToken);
}
diff --git a/MediaBrowser.Providers/MediaBrowser.Providers.csproj b/MediaBrowser.Providers/MediaBrowser.Providers.csproj
index 8d373be289..5593c5036c 100644
--- a/MediaBrowser.Providers/MediaBrowser.Providers.csproj
+++ b/MediaBrowser.Providers/MediaBrowser.Providers.csproj
@@ -11,11 +11,11 @@
-
-
+
+
-
+
diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs b/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs
index 8195591e17..7ebbb9e237 100644
--- a/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs
+++ b/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs
@@ -5,7 +5,6 @@ using System.Linq;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.IO;
diff --git a/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs b/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs
index e61d8792c5..939c74c01c 100644
--- a/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs
+++ b/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
+using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Configuration;
@@ -164,11 +165,10 @@ namespace MediaBrowser.Providers.Music
{
Url = url,
CancellationToken = cancellationToken
-
},
- "GET").ConfigureAwait(false))
+ HttpMethod.Get).ConfigureAwait(false))
using (var response = httpResponse.Content)
- using (var xmlFileStream = _fileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true))
+ using (var xmlFileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true))
{
await response.CopyToAsync(xmlFileStream).ConfigureAwait(false);
}
diff --git a/MediaBrowser.Providers/Music/AudioDbArtistProvider.cs b/MediaBrowser.Providers/Music/AudioDbArtistProvider.cs
index 7e5893d49a..e073a295b0 100644
--- a/MediaBrowser.Providers/Music/AudioDbArtistProvider.cs
+++ b/MediaBrowser.Providers/Music/AudioDbArtistProvider.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Configuration;
@@ -152,12 +153,12 @@ namespace MediaBrowser.Providers.Music
CancellationToken = cancellationToken,
BufferContent = true
},
- "GET").ConfigureAwait(false))
+ HttpMethod.Get).ConfigureAwait(false))
using (var response = httpResponse.Content)
{
Directory.CreateDirectory(Path.GetDirectoryName(path));
- using (var xmlFileStream = _fileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true))
+ using (var xmlFileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true))
{
await response.CopyToAsync(xmlFileStream).ConfigureAwait(false);
}
diff --git a/MediaBrowser.Providers/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Omdb/OmdbProvider.cs
index f8b8765802..fbf6ae135b 100644
--- a/MediaBrowser.Providers/Omdb/OmdbProvider.cs
+++ b/MediaBrowser.Providers/Omdb/OmdbProvider.cs
@@ -209,7 +209,7 @@ namespace MediaBrowser.Providers.Omdb
string resultString;
- using (var stream = _fileSystem.GetFileStream(path, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read))
+ using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (var reader = new StreamReader(stream, new UTF8Encoding(false)))
{
@@ -228,7 +228,7 @@ namespace MediaBrowser.Providers.Omdb
string resultString;
- using (var stream = _fileSystem.GetFileStream(path, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read))
+ using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (var reader = new StreamReader(stream, new UTF8Encoding(false)))
{
diff --git a/MediaBrowser.Providers/Studios/StudiosImageProvider.cs b/MediaBrowser.Providers/Studios/StudiosImageProvider.cs
index ef412db5ac..cbef27a091 100644
--- a/MediaBrowser.Providers/Studios/StudiosImageProvider.cs
+++ b/MediaBrowser.Providers/Studios/StudiosImageProvider.cs
@@ -78,7 +78,7 @@ namespace MediaBrowser.Providers.Studios
private RemoteImageInfo GetImage(BaseItem item, string filename, ImageType type, string remoteFilename)
{
- var list = GetAvailableImages(filename, _fileSystem);
+ var list = GetAvailableImages(filename);
var match = FindMatch(item, list);
@@ -179,9 +179,9 @@ namespace MediaBrowser.Providers.Studios
.Replace("/", string.Empty);
}
- public IEnumerable GetAvailableImages(string file, IFileSystem fileSystem)
+ public IEnumerable GetAvailableImages(string file)
{
- using (var fileStream = fileSystem.GetFileStream(file, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read))
+ using (var fileStream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (var reader = new StreamReader(fileStream))
{
diff --git a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs
index 37d1230e23..583c7e8ea4 100644
--- a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs
+++ b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs
@@ -19,7 +19,7 @@ using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Providers;
using Microsoft.Extensions.Logging;
-using static MediaBrowser.Model.IO.StreamDefaults;
+using static MediaBrowser.Model.IO.IODefaults;
namespace MediaBrowser.Providers.Subtitles
{
@@ -210,7 +210,7 @@ namespace MediaBrowser.Providers.Subtitles
{
Directory.CreateDirectory(Path.GetDirectoryName(savePath));
- using (var fs = new FileStream(savePath, FileMode.Create, FileAccess.Write, FileShare.Read, DefaultFileStreamBufferSize, true))
+ using (var fs = new FileStream(savePath, FileMode.Create, FileAccess.Write, FileShare.Read, FileStreamBufferSize, true))
{
await stream.CopyToAsync(fs).ConfigureAwait(false);
}
diff --git a/MediaBrowser.Providers/TV/DummySeasonProvider.cs b/MediaBrowser.Providers/TV/DummySeasonProvider.cs
index 4a6676cb99..6a1e6df8fd 100644
--- a/MediaBrowser.Providers/TV/DummySeasonProvider.cs
+++ b/MediaBrowser.Providers/TV/DummySeasonProvider.cs
@@ -3,7 +3,6 @@ using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
index 72ceadaf1d..9e791bd9d5 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
diff --git a/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetImageProvider.cs b/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetImageProvider.cs
index 5db0edac2a..0bdf2bce1e 100644
--- a/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetImageProvider.cs
+++ b/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetImageProvider.cs
@@ -10,7 +10,6 @@ using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Providers;
-using MediaBrowser.Providers.Movies;
using MediaBrowser.Providers.Tmdb.Models.Collections;
using MediaBrowser.Providers.Tmdb.Models.General;
using MediaBrowser.Providers.Tmdb.Movies;
diff --git a/MediaBrowser.Providers/Tmdb/Models/Search/ExternalIdLookupResult.cs b/MediaBrowser.Providers/Tmdb/Models/Search/ExternalIdLookupResult.cs
index 6d9fe7081d..d19f4e8cbd 100644
--- a/MediaBrowser.Providers/Tmdb/Models/Search/ExternalIdLookupResult.cs
+++ b/MediaBrowser.Providers/Tmdb/Models/Search/ExternalIdLookupResult.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using MediaBrowser.Providers.Movies;
namespace MediaBrowser.Providers.Tmdb.Models.Search
{
diff --git a/MediaBrowser.Providers/Tmdb/Movies/GenericTmdbMovieInfo.cs b/MediaBrowser.Providers/Tmdb/Movies/GenericTmdbMovieInfo.cs
index b7b447b684..ad42b564c6 100644
--- a/MediaBrowser.Providers/Tmdb/Movies/GenericTmdbMovieInfo.cs
+++ b/MediaBrowser.Providers/Tmdb/Movies/GenericTmdbMovieInfo.cs
@@ -11,10 +11,8 @@ using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Providers.Movies;
using MediaBrowser.Providers.Tmdb.Models.Movies;
using Microsoft.Extensions.Logging;
diff --git a/MediaBrowser.Providers/Tmdb/Movies/TmdbImageProvider.cs b/MediaBrowser.Providers/Tmdb/Movies/TmdbImageProvider.cs
index cdb96e6acf..039a49728b 100644
--- a/MediaBrowser.Providers/Tmdb/Movies/TmdbImageProvider.cs
+++ b/MediaBrowser.Providers/Tmdb/Movies/TmdbImageProvider.cs
@@ -13,7 +13,6 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Providers.Movies;
using MediaBrowser.Providers.Tmdb.Models.General;
using MediaBrowser.Providers.Tmdb.Models.Movies;
diff --git a/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieProvider.cs b/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieProvider.cs
index a1bea5847d..861847f71f 100644
--- a/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieProvider.cs
+++ b/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieProvider.cs
@@ -19,7 +19,6 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Providers.Movies;
using MediaBrowser.Providers.Tmdb.Models.Movies;
using Microsoft.Extensions.Logging;
diff --git a/MediaBrowser.Providers/Tmdb/Music/TmdbMusicVideoProvider.cs b/MediaBrowser.Providers/Tmdb/Music/TmdbMusicVideoProvider.cs
index f3f8a92cf0..81909fa38f 100644
--- a/MediaBrowser.Providers/Tmdb/Music/TmdbMusicVideoProvider.cs
+++ b/MediaBrowser.Providers/Tmdb/Music/TmdbMusicVideoProvider.cs
@@ -6,7 +6,6 @@ using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Providers;
-using MediaBrowser.Providers.Movies;
using MediaBrowser.Providers.Tmdb.Movies;
namespace MediaBrowser.Providers.Tmdb.Music
diff --git a/MediaBrowser.Providers/Tmdb/People/TmdbPersonImageProvider.cs b/MediaBrowser.Providers/Tmdb/People/TmdbPersonImageProvider.cs
index 44ccbf4534..e205d796ae 100644
--- a/MediaBrowser.Providers/Tmdb/People/TmdbPersonImageProvider.cs
+++ b/MediaBrowser.Providers/Tmdb/People/TmdbPersonImageProvider.cs
@@ -10,7 +10,6 @@ using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Providers.Movies;
using MediaBrowser.Providers.Tmdb.Models.General;
using MediaBrowser.Providers.Tmdb.Models.People;
using MediaBrowser.Providers.Tmdb.Movies;
diff --git a/MediaBrowser.Providers/Tmdb/People/TmdbPersonProvider.cs b/MediaBrowser.Providers/Tmdb/People/TmdbPersonProvider.cs
index 130403e4d1..50af9913aa 100644
--- a/MediaBrowser.Providers/Tmdb/People/TmdbPersonProvider.cs
+++ b/MediaBrowser.Providers/Tmdb/People/TmdbPersonProvider.cs
@@ -234,7 +234,7 @@ namespace MediaBrowser.Providers.Tmdb.People
{
Directory.CreateDirectory(Path.GetDirectoryName(dataFilePath));
- using (var fs = _fileSystem.GetFileStream(dataFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true))
+ using (var fs = new FileStream(dataFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true))
{
await json.CopyToAsync(fs).ConfigureAwait(false);
}
diff --git a/MediaBrowser.Providers/Tmdb/TV/TmdbEpisodeImageProvider.cs b/MediaBrowser.Providers/Tmdb/TV/TmdbEpisodeImageProvider.cs
index 51e7891a14..558c8149e5 100644
--- a/MediaBrowser.Providers/Tmdb/TV/TmdbEpisodeImageProvider.cs
+++ b/MediaBrowser.Providers/Tmdb/TV/TmdbEpisodeImageProvider.cs
@@ -13,7 +13,6 @@ using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Providers.Movies;
using MediaBrowser.Providers.Tmdb.Models.General;
using MediaBrowser.Providers.Tmdb.Movies;
using Microsoft.Extensions.Logging;
diff --git a/MediaBrowser.Providers/Tmdb/TV/TmdbEpisodeProviderBase.cs b/MediaBrowser.Providers/Tmdb/TV/TmdbEpisodeProviderBase.cs
index 2003261c9d..e87fe9332f 100644
--- a/MediaBrowser.Providers/Tmdb/TV/TmdbEpisodeProviderBase.cs
+++ b/MediaBrowser.Providers/Tmdb/TV/TmdbEpisodeProviderBase.cs
@@ -8,7 +8,6 @@ using MediaBrowser.Controller.Configuration;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Providers.Movies;
using MediaBrowser.Providers.Tmdb.Models.TV;
using MediaBrowser.Providers.Tmdb.Movies;
using Microsoft.Extensions.Logging;
diff --git a/MediaBrowser.Providers/Tmdb/TV/TmdbSeasonImageProvider.cs b/MediaBrowser.Providers/Tmdb/TV/TmdbSeasonImageProvider.cs
index 24cc8c73b2..698a436046 100644
--- a/MediaBrowser.Providers/Tmdb/TV/TmdbSeasonImageProvider.cs
+++ b/MediaBrowser.Providers/Tmdb/TV/TmdbSeasonImageProvider.cs
@@ -10,8 +10,6 @@ using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Globalization;
-using MediaBrowser.Model.IO;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Providers.Tmdb.Models.General;
diff --git a/MediaBrowser.Providers/Tmdb/TV/TmdbSeasonProvider.cs b/MediaBrowser.Providers/Tmdb/TV/TmdbSeasonProvider.cs
index fc0cde8b37..5ad3319717 100644
--- a/MediaBrowser.Providers/Tmdb/TV/TmdbSeasonProvider.cs
+++ b/MediaBrowser.Providers/Tmdb/TV/TmdbSeasonProvider.cs
@@ -14,7 +14,6 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Providers.Movies;
using MediaBrowser.Providers.Tmdb.Models.TV;
using MediaBrowser.Providers.Tmdb.Movies;
using Microsoft.Extensions.Logging;
diff --git a/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesImageProvider.cs b/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesImageProvider.cs
index 882ec7574a..0460fe9940 100644
--- a/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesImageProvider.cs
+++ b/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesImageProvider.cs
@@ -12,7 +12,6 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Providers.Movies;
using MediaBrowser.Providers.Tmdb.Models.General;
using MediaBrowser.Providers.Tmdb.Models.TV;
using MediaBrowser.Providers.Tmdb.Movies;
diff --git a/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesProvider.cs b/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesProvider.cs
index 304f34c25c..7dcb272d68 100644
--- a/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesProvider.cs
+++ b/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesProvider.cs
@@ -17,7 +17,6 @@ using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Providers.Movies;
using MediaBrowser.Providers.Tmdb.Models.Search;
using MediaBrowser.Providers.Tmdb.Models.TV;
using MediaBrowser.Providers.Tmdb.Movies;
diff --git a/MediaBrowser.Providers/Tmdb/Trailers/TmdbTrailerProvider.cs b/MediaBrowser.Providers/Tmdb/Trailers/TmdbTrailerProvider.cs
index b0dec02450..b15de01255 100644
--- a/MediaBrowser.Providers/Tmdb/Trailers/TmdbTrailerProvider.cs
+++ b/MediaBrowser.Providers/Tmdb/Trailers/TmdbTrailerProvider.cs
@@ -5,7 +5,6 @@ using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Providers;
-using MediaBrowser.Providers.Movies;
using MediaBrowser.Providers.Tmdb.Movies;
namespace MediaBrowser.Providers.Tmdb.Trailers
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs
index fadf32b28f..a8768459ac 100644
--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs
+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs
@@ -9,11 +9,9 @@ using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Plugins;
-using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Plugins;
-using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Services;
using Microsoft.Extensions.Logging;
@@ -425,7 +423,7 @@ namespace MediaBrowser.WebDashboard.Api
private async Task DumpFile(PackageCreator packageCreator, string resourceVirtualPath, string destinationFilePath, string mode, string appVersion)
{
using (var stream = await packageCreator.GetResource(resourceVirtualPath, mode, null, appVersion).ConfigureAwait(false))
- using (var fs = _fileSystem.GetFileStream(destinationFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
+ using (var fs = new FileStream(destinationFilePath, FileMode.Create, FileAccess.Write, FileShare.Read))
{
await stream.CopyToAsync(fs);
}
diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs
index b8d0e6560d..62d7a8cf4a 100644
--- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs
+++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs
@@ -12,7 +12,6 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Extensions;
using MediaBrowser.XbmcMetadata.Configuration;
using MediaBrowser.XbmcMetadata.Savers;
using Microsoft.Extensions.Logging;
diff --git a/RSSDP/DeviceEventArgs.cs b/RSSDP/DeviceEventArgs.cs
index 3925ba2481..05eb4a2567 100644
--- a/RSSDP/DeviceEventArgs.cs
+++ b/RSSDP/DeviceEventArgs.cs
@@ -1,6 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Text;
namespace Rssdp
{
diff --git a/RSSDP/DeviceUnavailableEventArgs.cs b/RSSDP/DeviceUnavailableEventArgs.cs
index d90ddfb603..ef04904bdc 100644
--- a/RSSDP/DeviceUnavailableEventArgs.cs
+++ b/RSSDP/DeviceUnavailableEventArgs.cs
@@ -1,7 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
namespace Rssdp
{
diff --git a/RSSDP/DiscoveredSsdpDevice.cs b/RSSDP/DiscoveredSsdpDevice.cs
index f42e7c6747..1244ce523d 100644
--- a/RSSDP/DiscoveredSsdpDevice.cs
+++ b/RSSDP/DiscoveredSsdpDevice.cs
@@ -1,8 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Net.Http;
-using System.Text;
-using System.Threading.Tasks;
using System.Net.Http.Headers;
namespace Rssdp
diff --git a/RSSDP/DisposableManagedObjectBase.cs b/RSSDP/DisposableManagedObjectBase.cs
index 0f656fb469..bb36229c40 100644
--- a/RSSDP/DisposableManagedObjectBase.cs
+++ b/RSSDP/DisposableManagedObjectBase.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
-using System.Threading.Tasks;
namespace Rssdp.Infrastructure
{
diff --git a/RSSDP/HttpParserBase.cs b/RSSDP/HttpParserBase.cs
index 76d816e7bd..773a06cdb6 100644
--- a/RSSDP/HttpParserBase.cs
+++ b/RSSDP/HttpParserBase.cs
@@ -2,8 +2,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
-using System.Text;
-using System.IO;
namespace Rssdp.Infrastructure
{
diff --git a/RSSDP/HttpRequestParser.cs b/RSSDP/HttpRequestParser.cs
index d4505b8ad6..279ef883ca 100644
--- a/RSSDP/HttpRequestParser.cs
+++ b/RSSDP/HttpRequestParser.cs
@@ -1,10 +1,6 @@
using System;
-using System.Collections.Generic;
using System.Linq;
-using System.Net;
using System.Net.Http;
-using System.Text;
-using System.Threading.Tasks;
namespace Rssdp.Infrastructure
{
diff --git a/RSSDP/HttpResponseParser.cs b/RSSDP/HttpResponseParser.cs
index a77c898ffe..b96eaf625d 100644
--- a/RSSDP/HttpResponseParser.cs
+++ b/RSSDP/HttpResponseParser.cs
@@ -1,10 +1,7 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
-using System.Text;
-using System.Threading.Tasks;
namespace Rssdp.Infrastructure
{
diff --git a/RSSDP/IEnumerableExtensions.cs b/RSSDP/IEnumerableExtensions.cs
index c96542dca4..371454893d 100644
--- a/RSSDP/IEnumerableExtensions.cs
+++ b/RSSDP/IEnumerableExtensions.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
namespace Rssdp.Infrastructure
{
diff --git a/RSSDP/ISsdpDevicePublisher.cs b/RSSDP/ISsdpDevicePublisher.cs
index 7e914c109d..96c15443d4 100644
--- a/RSSDP/ISsdpDevicePublisher.cs
+++ b/RSSDP/ISsdpDevicePublisher.cs
@@ -1,4 +1,3 @@
-using System;
using System.Threading.Tasks;
namespace Rssdp.Infrastructure
diff --git a/RSSDP/SsdpConstants.cs b/RSSDP/SsdpConstants.cs
index 8372d1cb3b..28a014fce8 100644
--- a/RSSDP/SsdpConstants.cs
+++ b/RSSDP/SsdpConstants.cs
@@ -1,8 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-
namespace Rssdp.Infrastructure
{
///
diff --git a/RSSDP/SsdpEmbeddedDevice.cs b/RSSDP/SsdpEmbeddedDevice.cs
index 6f05518a93..4810703d74 100644
--- a/RSSDP/SsdpEmbeddedDevice.cs
+++ b/RSSDP/SsdpEmbeddedDevice.cs
@@ -1,7 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
namespace Rssdp
{
///
diff --git a/deployment/linux-x64/docker-build.sh b/deployment/linux-x64/docker-build.sh
index 8860f943c9..e33328a36a 100755
--- a/deployment/linux-x64/docker-build.sh
+++ b/deployment/linux-x64/docker-build.sh
@@ -26,7 +26,7 @@ rm -rf ${web_build_dir}
version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )"
# Build archives
-dotnet publish --configuration Release --self-contained --runtime linux-x64 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true"
+dotnet publish Jellyfin.Server --configuration Release --self-contained --runtime linux-x64 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true"
tar -cvzf /jellyfin_${version}.portable.tar.gz -C /dist jellyfin_${version}
rm -rf /dist/jellyfin_${version}
diff --git a/deployment/macos/docker-build.sh b/deployment/macos/docker-build.sh
index 1b4a554e6d..f9417388d7 100755
--- a/deployment/macos/docker-build.sh
+++ b/deployment/macos/docker-build.sh
@@ -26,7 +26,7 @@ rm -rf ${web_build_dir}
version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )"
# Build archives
-dotnet publish --configuration Release --self-contained --runtime osx-x64 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true"
+dotnet publish Jellyfin.Server --configuration Release --self-contained --runtime osx-x64 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true"
tar -cvzf /jellyfin_${version}.portable.tar.gz -C /dist jellyfin_${version}
rm -rf /dist/jellyfin_${version}
diff --git a/deployment/portable/docker-build.sh b/deployment/portable/docker-build.sh
index 0cc6e84f06..094190bbf6 100755
--- a/deployment/portable/docker-build.sh
+++ b/deployment/portable/docker-build.sh
@@ -26,7 +26,7 @@ rm -rf ${web_build_dir}
version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )"
# Build archives
-dotnet publish --configuration Release --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none"
+dotnet publish Jellyfin.Server --configuration Release --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none"
tar -cvzf /jellyfin_${version}.portable.tar.gz -C /dist jellyfin_${version}
rm -rf /dist/jellyfin_${version}
diff --git a/deployment/ubuntu-package-arm64/Dockerfile.amd64 b/deployment/ubuntu-package-arm64/Dockerfile.amd64
index ac4f7404d6..b11994a18a 100644
--- a/deployment/ubuntu-package-arm64/Dockerfile.amd64
+++ b/deployment/ubuntu-package-arm64/Dockerfile.amd64
@@ -23,7 +23,7 @@ RUN wget https://download.visualstudio.microsoft.com/download/pr/d731f991-8e68-4
# Install npm package manager
RUN wget -q -O- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
- && echo "deb https://deb.nodesource.com/node_8.x $(lsb_release -s -c) main" > /etc/apt/sources.list.d/npm.list \
+ && echo "deb https://deb.nodesource.com/node_10.x $(lsb_release -s -c) main" > /etc/apt/sources.list.d/npm.list \
&& apt update \
&& apt install -y nodejs
diff --git a/deployment/ubuntu-package-arm64/Dockerfile.arm64 b/deployment/ubuntu-package-arm64/Dockerfile.arm64
index af70844591..8f004b2f1a 100644
--- a/deployment/ubuntu-package-arm64/Dockerfile.arm64
+++ b/deployment/ubuntu-package-arm64/Dockerfile.arm64
@@ -23,7 +23,7 @@ RUN wget https://download.visualstudio.microsoft.com/download/pr/5a4c8f96-1c73-4
# Install npm package manager
RUN wget -q -O- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
- && echo "deb https://deb.nodesource.com/node_8.x $(lsb_release -s -c) main" > /etc/apt/sources.list.d/npm.list \
+ && echo "deb https://deb.nodesource.com/node_10.x $(lsb_release -s -c) main" > /etc/apt/sources.list.d/npm.list \
&& apt update \
&& apt install -y nodejs
diff --git a/deployment/ubuntu-package-armhf/Dockerfile.amd64 b/deployment/ubuntu-package-armhf/Dockerfile.amd64
index 590eecab7f..e475b14389 100644
--- a/deployment/ubuntu-package-armhf/Dockerfile.amd64
+++ b/deployment/ubuntu-package-armhf/Dockerfile.amd64
@@ -23,7 +23,7 @@ RUN wget https://download.visualstudio.microsoft.com/download/pr/d731f991-8e68-4
# Install npm package manager
RUN wget -q -O- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
- && echo "deb https://deb.nodesource.com/node_8.x $(lsb_release -s -c) main" > /etc/apt/sources.list.d/npm.list \
+ && echo "deb https://deb.nodesource.com/node_10.x $(lsb_release -s -c) main" > /etc/apt/sources.list.d/npm.list \
&& apt update \
&& apt install -y nodejs
diff --git a/deployment/ubuntu-package-armhf/Dockerfile.armhf b/deployment/ubuntu-package-armhf/Dockerfile.armhf
index 06a8dace29..0e71fa6938 100644
--- a/deployment/ubuntu-package-armhf/Dockerfile.armhf
+++ b/deployment/ubuntu-package-armhf/Dockerfile.armhf
@@ -23,7 +23,7 @@ RUN wget https://download.visualstudio.microsoft.com/download/pr/67766a96-eb8c-4
# Install npm package manager
RUN wget -q -O- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
- && echo "deb https://deb.nodesource.com/node_8.x $(lsb_release -s -c) main" > /etc/apt/sources.list.d/npm.list \
+ && echo "deb https://deb.nodesource.com/node_10.x $(lsb_release -s -c) main" > /etc/apt/sources.list.d/npm.list \
&& apt update \
&& apt install -y nodejs
diff --git a/deployment/ubuntu-package-x64/Dockerfile b/deployment/ubuntu-package-x64/Dockerfile
index 8237ced299..e2dda6392c 100644
--- a/deployment/ubuntu-package-x64/Dockerfile
+++ b/deployment/ubuntu-package-x64/Dockerfile
@@ -25,7 +25,7 @@ RUN wget https://download.visualstudio.microsoft.com/download/pr/d731f991-8e68-4
# Install npm package manager
RUN wget -q -O- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
- && echo "deb https://deb.nodesource.com/node_8.x $(lsb_release -s -c) main" > /etc/apt/sources.list.d/npm.list \
+ && echo "deb https://deb.nodesource.com/node_10.x $(lsb_release -s -c) main" > /etc/apt/sources.list.d/npm.list \
&& apt update \
&& apt install -y nodejs
diff --git a/deployment/win-x64/docker-build.sh b/deployment/win-x64/docker-build.sh
index 77372a66f7..79e5fb0bcd 100755
--- a/deployment/win-x64/docker-build.sh
+++ b/deployment/win-x64/docker-build.sh
@@ -32,7 +32,7 @@ rm -rf ${web_build_dir}
version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )"
# Build binary
-dotnet publish --configuration Release --self-contained --runtime win-x64 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true"
+dotnet publish Jellyfin.Server --configuration Release --self-contained --runtime win-x64 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true"
# Prepare addins
addin_build_dir="$( mktemp -d )"
diff --git a/deployment/win-x86/docker-build.sh b/deployment/win-x86/docker-build.sh
index dd411756a8..977dcf78fa 100755
--- a/deployment/win-x86/docker-build.sh
+++ b/deployment/win-x86/docker-build.sh
@@ -32,7 +32,7 @@ rm -rf ${web_build_dir}
version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )"
# Build binary
-dotnet publish --configuration Release --self-contained --runtime win-x86 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true"
+dotnet publish Jellyfin.Server --configuration Release --self-contained --runtime win-x86 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true"
# Prepare addins
addin_build_dir="$( mktemp -d )"
diff --git a/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj b/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj
index 1f83489bdf..0e8ef135ef 100644
--- a/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj
+++ b/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj
@@ -9,11 +9,11 @@
-
+
-
+
diff --git a/tests/Jellyfin.Common.Tests/Jellyfin.Common.Tests.csproj b/tests/Jellyfin.Common.Tests/Jellyfin.Common.Tests.csproj
index bc0114d1ef..da5e6576d3 100644
--- a/tests/Jellyfin.Common.Tests/Jellyfin.Common.Tests.csproj
+++ b/tests/Jellyfin.Common.Tests/Jellyfin.Common.Tests.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/tests/Jellyfin.MediaEncoding.Tests/Jellyfin.MediaEncoding.Tests.csproj b/tests/Jellyfin.MediaEncoding.Tests/Jellyfin.MediaEncoding.Tests.csproj
index 5d9b32086c..c01edd9fed 100644
--- a/tests/Jellyfin.MediaEncoding.Tests/Jellyfin.MediaEncoding.Tests.csproj
+++ b/tests/Jellyfin.MediaEncoding.Tests/Jellyfin.MediaEncoding.Tests.csproj
@@ -15,7 +15,7 @@
-
+
diff --git a/tests/Jellyfin.Naming.Tests/Jellyfin.Naming.Tests.csproj b/tests/Jellyfin.Naming.Tests/Jellyfin.Naming.Tests.csproj
index 79d2f21441..f246d459ba 100644
--- a/tests/Jellyfin.Naming.Tests/Jellyfin.Naming.Tests.csproj
+++ b/tests/Jellyfin.Naming.Tests/Jellyfin.Naming.Tests.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/tests/Jellyfin.Naming.Tests/Video/StubTests.cs b/tests/Jellyfin.Naming.Tests/Video/StubTests.cs
index c06bb6bf94..8d5ced9a41 100644
--- a/tests/Jellyfin.Naming.Tests/Video/StubTests.cs
+++ b/tests/Jellyfin.Naming.Tests/Video/StubTests.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Globalization;
-using Emby.Naming.Common;
+using Emby.Naming.Common;
using Emby.Naming.Video;
using Xunit;
diff --git a/tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs b/tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs
index e324002f0c..671c59b2ec 100644
--- a/tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs
+++ b/tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs
@@ -1,4 +1,3 @@
-using System;
using AutoFixture;
using AutoFixture.AutoMoq;
using Emby.Server.Implementations.IO;
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj b/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj
index f62d3dcbc5..c554bc9372 100644
--- a/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj
+++ b/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj
@@ -1,19 +1,18 @@
- netcoreapp3.1
- false
- Jellyfin.Server.Implementations.Tests
+ netcoreapp3.1
+ false
+ Jellyfin.Server.Implementations.Tests
-
-
-
-
-
-
-
+
+
+
+
+
+