diff --git a/.gitignore b/.gitignore
index c2ae76c1e3..9e9fae7bfc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -150,8 +150,6 @@ publish/
*.pubxml
# NuGet Packages Directory
-## TODO: If you have NuGet Package Restore enabled, uncomment the next line
-# packages/
dlls/
dllssigned/
diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs
index b73ce00b6f..65367e24f2 100644
--- a/Emby.Dlna/PlayTo/PlayToController.cs
+++ b/Emby.Dlna/PlayTo/PlayToController.cs
@@ -338,7 +338,6 @@ namespace Emby.Dlna.PlayTo
SubtitleStreamIndex = info.SubtitleStreamIndex,
VolumeLevel = _device.Volume,
- // TODO
CanSeek = true,
PlayMethod = info.IsDirectStream ? PlayMethod.DirectStream : PlayMethod.Transcode
diff --git a/Emby.Server.Implementations/Library/Resolvers/PlaylistResolver.cs b/Emby.Server.Implementations/Library/Resolvers/PlaylistResolver.cs
index 6b0dfe9864..7a2b3da3a9 100644
--- a/Emby.Server.Implementations/Library/Resolvers/PlaylistResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/PlaylistResolver.cs
@@ -31,16 +31,18 @@ namespace Emby.Server.Implementations.Library.Resolvers
if (args.IsDirectory)
{
// It's a boxset if the path is a directory with [playlist] in it's the name
- // TODO: Should this use Path.GetDirectoryName() instead?
- bool isBoxSet = Path.GetFileName(args.Path)
- ?.Contains("[playlist]", StringComparison.OrdinalIgnoreCase)
- ?? false;
- if (isBoxSet)
+ var filename = Path.GetFileName(Path.TrimEndingDirectorySeparator(args.Path));
+ if (string.IsNullOrEmpty(filename))
+ {
+ return null;
+ }
+
+ if (filename.Contains("[playlist]", StringComparison.OrdinalIgnoreCase))
{
return new Playlist
{
Path = args.Path,
- Name = Path.GetFileName(args.Path).Replace("[playlist]", string.Empty, StringComparison.OrdinalIgnoreCase).Trim()
+ Name = filename.Replace("[playlist]", string.Empty, StringComparison.OrdinalIgnoreCase).Trim()
};
}
@@ -51,7 +53,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
return new Playlist
{
Path = args.Path,
- Name = Path.GetFileName(args.Path)
+ Name = filename
};
}
}
@@ -60,8 +62,8 @@ namespace Emby.Server.Implementations.Library.Resolvers
// It should have the correct collection type and a supported file extension
else if (_musicPlaylistCollectionTypes.Contains(args.CollectionType ?? string.Empty, StringComparison.OrdinalIgnoreCase))
{
- var extension = Path.GetExtension(args.Path);
- if (Playlist.SupportedExtensions.Contains(extension ?? string.Empty, StringComparison.OrdinalIgnoreCase))
+ var extension = Path.GetExtension(args.Path.AsSpan());
+ if (Playlist.SupportedExtensions.Contains(extension, StringComparison.OrdinalIgnoreCase))
{
return new Playlist
{
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs
index 0bf0838fac..6106ae6c40 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs
@@ -16,6 +16,7 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Tasks;
+using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.ScheduledTasks.Tasks
{
@@ -24,15 +25,10 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
///
public class ChapterImagesTask : IScheduledTask
{
- ///
- /// The _library manager.
- ///
+ private readonly ILogger _logger;
private readonly ILibraryManager _libraryManager;
-
private readonly IItemRepository _itemRepo;
-
private readonly IApplicationPaths _appPaths;
-
private readonly IEncodingManager _encodingManager;
private readonly IFileSystem _fileSystem;
private readonly ILocalizationManager _localization;
@@ -40,6 +36,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
///
/// Initializes a new instance of the class.
///
+ /// The logger..
/// The library manager..
/// The item repository.
/// The application paths.
@@ -47,6 +44,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
/// The filesystem.
/// The localization manager.
public ChapterImagesTask(
+ ILogger logger,
ILibraryManager libraryManager,
IItemRepository itemRepo,
IApplicationPaths appPaths,
@@ -54,6 +52,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
IFileSystem fileSystem,
ILocalizationManager localization)
{
+ _logger = logger;
_libraryManager = libraryManager;
_itemRepo = itemRepo;
_appPaths = appPaths;
@@ -167,9 +166,10 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
progress.Report(100 * percent);
}
- catch (ObjectDisposedException)
+ catch (ObjectDisposedException ex)
{
// TODO Investigate and properly fix.
+ _logger.LogError(ex, "Object Disposed");
break;
}
}
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
index cee08eedac..74abb91b28 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
@@ -1176,24 +1176,6 @@ namespace MediaBrowser.Controller.MediaEncoding
":fontsdir='{0}'",
_mediaEncoder.EscapeSubtitleFilterPath(fontPath));
- // TODO
- // var fallbackFontPath = Path.Combine(_appPaths.ProgramDataPath, "fonts", "DroidSansFallback.ttf");
- // string fallbackFontParam = string.Empty;
-
- // if (!File.Exists(fallbackFontPath))
- // {
- // _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(fallbackFontPath));
- // using (var stream = _assemblyInfo.GetManifestResourceStream(GetType(), GetType().Namespace + ".DroidSansFallback.ttf"))
- // {
- // using (var fileStream = new FileStream(fallbackFontPath, FileMode.Create, FileAccess.Write, FileShare.Read))
- // {
- // stream.CopyTo(fileStream);
- // }
- // }
- // }
-
- // fallbackFontParam = string.Format(CultureInfo.InvariantCulture, ":force_style='FontName=Droid Sans Fallback':fontsdir='{0}'", _mediaEncoder.EscapeSubtitleFilterPath(_fileSystem.GetDirectoryName(fallbackFontPath)));
-
if (state.SubtitleStream.IsExternal)
{
var charsetParam = string.Empty;
@@ -1221,7 +1203,6 @@ namespace MediaBrowser.Controller.MediaEncoding
alphaParam,
sub2videoParam,
fontParam,
- // fallbackFontParam,
setPtsParam);
}
diff --git a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs
index 647de50030..2fe3a54723 100644
--- a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs
+++ b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs
@@ -227,9 +227,10 @@ namespace MediaBrowser.Controller.Net
connection.Item2.Cancel();
connection.Item2.Dispose();
}
- catch (ObjectDisposedException)
+ catch (ObjectDisposedException ex)
{
// TODO Investigate and properly fix.
+ Logger.LogError(ex, "Object Disposed");
}
lock (_activeConnections)
diff --git a/src/Jellyfin.Extensions/AlphanumericComparator.cs b/src/Jellyfin.Extensions/AlphanumericComparator.cs
index e3c81eba8c..98a32d5b20 100644
--- a/src/Jellyfin.Extensions/AlphanumericComparator.cs
+++ b/src/Jellyfin.Extensions/AlphanumericComparator.cs
@@ -128,9 +128,7 @@ namespace Jellyfin.Extensions
return result;
}
}
-#pragma warning disable SA1500 // TODO remove with StyleCop.Analyzers v1.2.0 https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3196
} while (pos1 < len1 && pos2 < len2);
-#pragma warning restore SA1500
return len1 - len2;
}
diff --git a/tests/Jellyfin.Model.Tests/Dlna/StreamBuilderTests.cs b/tests/Jellyfin.Model.Tests/Dlna/StreamBuilderTests.cs
index c279b6b4bb..e1bd2fe0f3 100644
--- a/tests/Jellyfin.Model.Tests/Dlna/StreamBuilderTests.cs
+++ b/tests/Jellyfin.Model.Tests/Dlna/StreamBuilderTests.cs
@@ -359,7 +359,7 @@ namespace Jellyfin.Model.Tests
Assert.Single(val.TargetAudioCodec);
// Assert.Single(val.AudioCodecs);
- if (transcodeMode == "DirectStream")
+ if (transcodeMode.Equals("DirectStream", StringComparison.Ordinal))
{
Assert.Equal(val.Container, uri.Extension);
}
@@ -371,14 +371,14 @@ namespace Jellyfin.Model.Tests
Assert.NotEmpty(val.AudioCodecs);
// Check expected container (todo: this could be a test param)
- if (transcodeProtocol == "http")
+ if (transcodeProtocol.Equals("http", StringComparison.Ordinal))
{
// Assert.Equal("webm", val.Container);
Assert.Equal(val.Container, uri.Extension);
Assert.Equal("stream", uri.Filename);
Assert.Equal("http", val.SubProtocol);
}
- else if (transcodeProtocol == "HLS.mp4")
+ else if (transcodeProtocol.Equals("HLS.mp4", StringComparison.Ordinal))
{
Assert.Equal("mp4", val.Container);
Assert.Equal("m3u8", uri.Extension);
@@ -394,7 +394,7 @@ namespace Jellyfin.Model.Tests
}
// Full transcode
- if (transcodeMode == "Transcode")
+ if (transcodeMode.Equals("Transcode", StringComparison.Ordinal))
{
if ((val.TranscodeReasons & (StreamBuilder.ContainerReasons | TranscodeReason.DirectPlayError)) == 0)
{
@@ -413,7 +413,7 @@ namespace Jellyfin.Model.Tests
Assert.Contains(targetVideoStream.Codec, val.TargetVideoCodec);
Assert.Single(val.TargetVideoCodec);
- if (transcodeMode == "DirectStream")
+ if (transcodeMode.Equals("DirectStream", StringComparison.Ordinal))
{
// Check expected audio codecs (1)
if (!targetAudioStream.IsExternal)
@@ -428,7 +428,7 @@ namespace Jellyfin.Model.Tests
}
}
}
- else if (transcodeMode == "Remux")
+ else if (transcodeMode.Equals("Remux", StringComparison.Ordinal))
{
// Check expected audio codecs (1)
Assert.Contains(targetAudioStream.Codec, val.AudioCodecs);