aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Playlists
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/Playlists')
-rw-r--r--Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs23
-rw-r--r--Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs19
-rw-r--r--Emby.Server.Implementations/Playlists/PlaylistManager.cs50
3 files changed, 42 insertions, 50 deletions
diff --git a/Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs b/Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs
index 908fa65de..f4decc856 100644
--- a/Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs
+++ b/Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Playlists;
@@ -25,28 +25,13 @@ namespace Emby.Server.Implementations.Playlists
}
[IgnoreDataMember]
- public override bool IsHidden
- {
- get
- {
- return true;
- }
- }
+ public override bool IsHidden => true;
[IgnoreDataMember]
- public override bool SupportsInheritedParentImages
- {
- get
- {
- return false;
- }
- }
+ public override bool SupportsInheritedParentImages => false;
[IgnoreDataMember]
- public override string CollectionType
- {
- get { return MediaBrowser.Model.Entities.CollectionType.Playlists; }
- }
+ public override string CollectionType => MediaBrowser.Model.Entities.CollectionType.Playlists;
protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query)
{
diff --git a/Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs b/Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs
index e69b4a34e..223153164 100644
--- a/Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs
+++ b/Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs
@@ -1,23 +1,20 @@
-using System;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Emby.Server.Implementations.Images;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Drawing;
+using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
+using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
+using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Playlists;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Emby.Server.Implementations.Images;
-
-using MediaBrowser.Controller.Dto;
-using MediaBrowser.Controller.Entities.Movies;
-using MediaBrowser.Controller.IO;
-using MediaBrowser.Model.IO;
-using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Extensions;
+using MediaBrowser.Model.IO;
using MediaBrowser.Model.Querying;
namespace Emby.Server.Implementations.Playlists
diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
index 470711b9e..17f445708 100644
--- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs
+++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
@@ -1,11 +1,3 @@
-using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.Entities.Audio;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Controller.Playlists;
-using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Entities;
-using Microsoft.Extensions.Logging;
-using MediaBrowser.Model.Playlists;
using System;
using System.Collections.Generic;
using System.IO;
@@ -13,12 +5,17 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Dto;
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities.Audio;
+using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.Playlists;
+using MediaBrowser.Controller.Providers;
+using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Extensions;
-using PlaylistsNET;
+using MediaBrowser.Model.Playlists;
+using Microsoft.Extensions.Logging;
using PlaylistsNET.Content;
using PlaylistsNET.Models;
-using PlaylistsNET.Utils;
namespace Emby.Server.Implementations.Playlists
{
@@ -31,12 +28,18 @@ namespace Emby.Server.Implementations.Playlists
private readonly IUserManager _userManager;
private readonly IProviderManager _providerManager;
- public PlaylistManager(ILibraryManager libraryManager, IFileSystem fileSystem, ILibraryMonitor iLibraryMonitor, ILogger logger, IUserManager userManager, IProviderManager providerManager)
+ public PlaylistManager(
+ ILibraryManager libraryManager,
+ IFileSystem fileSystem,
+ ILibraryMonitor iLibraryMonitor,
+ ILoggerFactory loggerFactory,
+ IUserManager userManager,
+ IProviderManager providerManager)
{
_libraryManager = libraryManager;
_fileSystem = fileSystem;
_iLibraryMonitor = iLibraryMonitor;
- _logger = logger;
+ _logger = loggerFactory.CreateLogger(nameof(PlaylistManager));
_userManager = userManager;
_providerManager = providerManager;
}
@@ -455,23 +458,30 @@ namespace Emby.Server.Implementations.Playlists
return MakeRelativePath(_fileSystem.GetDirectoryName(playlistPath), itemPath);
}
- private static String MakeRelativePath(string folderPath, string fileAbsolutePath)
+ private static string MakeRelativePath(string folderPath, string fileAbsolutePath)
{
- if (String.IsNullOrEmpty(folderPath)) throw new ArgumentNullException("folderPath");
- if (String.IsNullOrEmpty(fileAbsolutePath)) throw new ArgumentNullException("filePath");
+ if (string.IsNullOrEmpty(folderPath))
+ {
+ throw new ArgumentException("Folder path was null or empty.", nameof(folderPath));
+ }
+
+ if (string.IsNullOrEmpty(fileAbsolutePath))
+ {
+ throw new ArgumentException("File absolute path was null or empty.", nameof(fileAbsolutePath));
+ }
if (!folderPath.EndsWith(Path.DirectorySeparatorChar.ToString()))
{
folderPath = folderPath + Path.DirectorySeparatorChar;
}
- Uri folderUri = new Uri(folderPath);
- Uri fileAbsoluteUri = new Uri(fileAbsolutePath);
+ var folderUri = new Uri(folderPath);
+ var fileAbsoluteUri = new Uri(fileAbsolutePath);
if (folderUri.Scheme != fileAbsoluteUri.Scheme) { return fileAbsolutePath; } // path can't be made relative.
- Uri relativeUri = folderUri.MakeRelativeUri(fileAbsoluteUri);
- String relativePath = Uri.UnescapeDataString(relativeUri.ToString());
+ var relativeUri = folderUri.MakeRelativeUri(fileAbsoluteUri);
+ string relativePath = Uri.UnescapeDataString(relativeUri.ToString());
if (fileAbsoluteUri.Scheme.Equals("file", StringComparison.CurrentCultureIgnoreCase))
{