diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index f22944a8b..d69e6330b 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -30,6 +30,7 @@
- [Khinenw](https://github.com/HelloWorld017)
- [fhriley](https://github.com/fhriley)
- [nevado](https://github.com/nevado)
+ - [mark-monteiro](https://github.com/mark-monteiro)
# Emby Contributors
diff --git a/Emby.Dlna/Api/DlnaServerService.cs b/Emby.Dlna/Api/DlnaServerService.cs
index 7ddcaf7e6..a451bbcf9 100644
--- a/Emby.Dlna/Api/DlnaServerService.cs
+++ b/Emby.Dlna/Api/DlnaServerService.cs
@@ -1,7 +1,5 @@
using System;
-using System.Collections.Generic;
using System.IO;
-using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Emby.Dlna.Main;
@@ -195,7 +193,7 @@ namespace Emby.Dlna.Api
private ControlResponse PostAsync(Stream requestStream, IUpnpService service)
{
- var id = GetPathValue(2);
+ var id = GetPathValue(2).ToString();
return service.ProcessControlRequest(new ControlRequest
{
@@ -206,51 +204,99 @@ namespace Emby.Dlna.Api
});
}
- protected string GetPathValue(int index)
+ // Copied from MediaBrowser.Api/BaseApiService.cs
+ // TODO: Remove code duplication
+ ///
+ /// Gets the path segment at the specified index.
+ ///
+ /// The index of the path segment.
+ /// The path segment at the specified index.
+ /// Path doesn't contain enough segments.
+ /// Path doesn't start with the base url.
+ protected internal ReadOnlySpan GetPathValue(int index)
{
- var pathInfo = Parse(Request.PathInfo);
- var first = pathInfo[0];
+ static void ThrowIndexOutOfRangeException()
+ => throw new IndexOutOfRangeException("Path doesn't contain enough segments.");
+ static void ThrowInvalidDataException()
+ => throw new InvalidDataException("Path doesn't start with the base url.");
+
+ ReadOnlySpan path = Request.PathInfo;
+
+ // Remove the protocol part from the url
+ int pos = path.LastIndexOf("://");
+ if (pos != -1)
+ {
+ path = path.Slice(pos + 3);
+ }
+
+ // Remove the query string
+ pos = path.LastIndexOf('?');
+ if (pos != -1)
+ {
+ path = path.Slice(0, pos);
+ }
+
+ // Remove the domain
+ pos = path.IndexOf('/');
+ if (pos != -1)
+ {
+ path = path.Slice(pos);
+ }
+
+ // Remove base url
string baseUrl = _configurationManager.Configuration.BaseUrl;
-
- // backwards compatibility
- if (baseUrl.Length == 0)
+ int baseUrlLen = baseUrl.Length;
+ if (baseUrlLen != 0)
{
- if (string.Equals(first, "mediabrowser", StringComparison.OrdinalIgnoreCase)
- || string.Equals(first, "emby", StringComparison.OrdinalIgnoreCase))
+ if (path.StartsWith(baseUrl, StringComparison.OrdinalIgnoreCase))
{
- index++;
+ path = path.Slice(baseUrlLen);
}
- }
- else if (string.Equals(first, baseUrl.Remove(0, 1)))
- {
- index++;
- var second = pathInfo[1];
- if (string.Equals(second, "mediabrowser", StringComparison.OrdinalIgnoreCase)
- || string.Equals(second, "emby", StringComparison.OrdinalIgnoreCase))
+ else
{
- index++;
+ // The path doesn't start with the base url,
+ // how did we get here?
+ ThrowInvalidDataException();
}
}
- return pathInfo[index];
- }
+ // Remove leading /
+ path = path.Slice(1);
- private static string[] Parse(string pathUri)
- {
- var actionParts = pathUri.Split(new[] { "://" }, StringSplitOptions.None);
-
- var pathInfo = actionParts[actionParts.Length - 1];
-
- var optionsPos = pathInfo.LastIndexOf('?');
- if (optionsPos != -1)
+ // Backwards compatibility
+ const string Emby = "emby/";
+ if (path.StartsWith(Emby, StringComparison.OrdinalIgnoreCase))
{
- pathInfo = pathInfo.Substring(0, optionsPos);
+ path = path.Slice(Emby.Length);
}
- var args = pathInfo.Split('/');
+ const string MediaBrowser = "mediabrowser/";
+ if (path.StartsWith(MediaBrowser, StringComparison.OrdinalIgnoreCase))
+ {
+ path = path.Slice(MediaBrowser.Length);
+ }
- return args.Skip(1).ToArray();
+ // Skip segments until we are at the right index
+ for (int i = 0; i < index; i++)
+ {
+ pos = path.IndexOf('/');
+ if (pos == -1)
+ {
+ ThrowIndexOutOfRangeException();
+ }
+
+ path = path.Slice(pos + 1);
+ }
+
+ // Remove the rest
+ pos = path.IndexOf('/');
+ if (pos != -1)
+ {
+ path = path.Slice(0, pos);
+ }
+
+ return path;
}
public object Get(GetIcon request)
diff --git a/Emby.Dlna/ContentDirectory/ContentDirectory.cs b/Emby.Dlna/ContentDirectory/ContentDirectory.cs
index 5175898ab..78d69b338 100644
--- a/Emby.Dlna/ContentDirectory/ContentDirectory.cs
+++ b/Emby.Dlna/ContentDirectory/ContentDirectory.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using Emby.Dlna.Service;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
@@ -104,7 +103,7 @@ namespace Emby.Dlna.ContentDirectory
{
if (!string.IsNullOrEmpty(profile.UserId))
{
- var user = _userManager.GetUserById(profile.UserId);
+ var user = _userManager.GetUserById(Guid.Parse(profile.UserId));
if (user != null)
{
@@ -116,7 +115,7 @@ namespace Emby.Dlna.ContentDirectory
if (!string.IsNullOrEmpty(userId))
{
- var user = _userManager.GetUserById(userId);
+ var user = _userManager.GetUserById(Guid.Parse(userId));
if (user != null)
{
diff --git a/Emby.Dlna/ContentDirectory/ControlHandler.cs b/Emby.Dlna/ContentDirectory/ControlHandler.cs
index d22fc2177..4f74bb222 100644
--- a/Emby.Dlna/ContentDirectory/ControlHandler.cs
+++ b/Emby.Dlna/ContentDirectory/ControlHandler.cs
@@ -425,10 +425,10 @@ namespace Emby.Dlna.ContentDirectory
{
var folder = (Folder)item;
- var sortOrders = new List();
+ var sortOrders = new List<(string, SortOrder)>();
if (!folder.IsPreSorted)
{
- sortOrders.Add(ItemSortBy.SortName);
+ sortOrders.Add((ItemSortBy.SortName, sort.SortOrder));
}
var mediaTypes = new List();
@@ -464,7 +464,7 @@ namespace Emby.Dlna.ContentDirectory
{
Limit = limit,
StartIndex = startIndex,
- OrderBy = sortOrders.Select(i => new ValueTuple(i, sort.SortOrder)).ToArray(),
+ OrderBy = sortOrders,
User = user,
Recursive = true,
IsMissing = false,
@@ -872,10 +872,10 @@ namespace Emby.Dlna.ContentDirectory
query.Parent = parent;
query.SetUser(user);
- query.OrderBy = new ValueTuple[]
+ query.OrderBy = new[]
{
- new ValueTuple (ItemSortBy.DatePlayed, SortOrder.Descending),
- new ValueTuple (ItemSortBy.SortName, SortOrder.Ascending)
+ (ItemSortBy.DatePlayed, SortOrder.Descending),
+ (ItemSortBy.SortName, SortOrder.Ascending)
};
query.IsResumable = true;
@@ -1121,7 +1121,7 @@ namespace Emby.Dlna.ContentDirectory
private QueryResult GetMusicLatest(BaseItem parent, User user, InternalItemsQuery query)
{
- query.OrderBy = new ValueTuple[] { };
+ query.OrderBy = Array.Empty<(string, SortOrder)>();
var items = _userViewManager.GetLatestItems(new LatestItemsQuery
{
@@ -1138,7 +1138,7 @@ namespace Emby.Dlna.ContentDirectory
private QueryResult GetNextUp(BaseItem parent, User user, InternalItemsQuery query)
{
- query.OrderBy = new ValueTuple[] { };
+ query.OrderBy = Array.Empty<(string, SortOrder)>();
var result = _tvSeriesManager.GetNextUp(new NextUpQuery
{
@@ -1153,7 +1153,7 @@ namespace Emby.Dlna.ContentDirectory
private QueryResult GetTvLatest(BaseItem parent, User user, InternalItemsQuery query)
{
- query.OrderBy = new ValueTuple[] { };
+ query.OrderBy = Array.Empty<(string, SortOrder)>();
var items = _userViewManager.GetLatestItems(new LatestItemsQuery
{
@@ -1170,7 +1170,7 @@ namespace Emby.Dlna.ContentDirectory
private QueryResult GetMovieLatest(BaseItem parent, User user, InternalItemsQuery query)
{
- query.OrderBy = new ValueTuple[] { };
+ query.OrderBy = Array.Empty<(string, SortOrder)>();
var items = _userViewManager.GetLatestItems(new LatestItemsQuery
{
@@ -1274,13 +1274,14 @@ namespace Emby.Dlna.ContentDirectory
private void SetSorting(InternalItemsQuery query, SortCriteria sort, bool isPreSorted)
{
- var sortOrders = new List();
- if (!isPreSorted)
+ if (isPreSorted)
{
- sortOrders.Add(ItemSortBy.SortName);
+ query.OrderBy = Array.Empty<(string, SortOrder)>();
+ }
+ else
+ {
+ query.OrderBy = new[] { (ItemSortBy.SortName, sort.SortOrder) };
}
-
- query.OrderBy = sortOrders.Select(i => new ValueTuple(i, sort.SortOrder)).ToArray();
}
private QueryResult ApplyPaging(QueryResult result, int? startIndex, int? limit)
diff --git a/Emby.Naming/Common/NamingOptions.cs b/Emby.Naming/Common/NamingOptions.cs
index f8601c59f..77796a28e 100644
--- a/Emby.Naming/Common/NamingOptions.cs
+++ b/Emby.Naming/Common/NamingOptions.cs
@@ -315,7 +315,7 @@ namespace Emby.Naming.Common
// This isn't a Kodi naming rule, but the expression below causes false positives,
// so we make sure this one gets tested first.
// "Foo Bar 889"
- new EpisodeExpression(@".*[\\\/](?![Ee]pisode)(?(\w+\s*?)*)\s(?\d{1,3})(-(?\d{2,3}))*[^\\\/]*$")
+ new EpisodeExpression(@".*[\\\/](?![Ee]pisode)(?[\w\s]+?)\s(?\d{1,3})(-(?\d{2,3}))*[^\\\/]*$")
{
IsNamed = true
},
@@ -337,8 +337,8 @@ namespace Emby.Naming.Common
// *** End Kodi Standard Naming
- // [bar] Foo - 1 [baz]
- new EpisodeExpression(@".*?(\[.*?\])+.*?(?(\w+\s*?)+?)[-\s_]+(?\d+).*$")
+ // [bar] Foo - 1 [baz]
+ new EpisodeExpression(@".*?(\[.*?\])+.*?(?[\w\s]+?)[-\s_]+(?\d+).*$")
{
IsNamed = true
},
diff --git a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
index efaaa116c..b622a3167 100644
--- a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
+++ b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -39,6 +41,19 @@ namespace Emby.Server.Implementations.Activity
private readonly IServerApplicationHost _appHost;
private readonly IDeviceManager _deviceManager;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public ActivityLogEntryPoint(
ILogger logger,
ISessionManager sessionManager,
diff --git a/Emby.Server.Implementations/Activity/ActivityManager.cs b/Emby.Server.Implementations/Activity/ActivityManager.cs
index 0c513ea12..a30e93912 100644
--- a/Emby.Server.Implementations/Activity/ActivityManager.cs
+++ b/Emby.Server.Implementations/Activity/ActivityManager.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Linq;
using MediaBrowser.Controller.Library;
diff --git a/Emby.Server.Implementations/Activity/ActivityRepository.cs b/Emby.Server.Implementations/Activity/ActivityRepository.cs
index ffaeaa541..7be72319e 100644
--- a/Emby.Server.Implementations/Activity/ActivityRepository.cs
+++ b/Emby.Server.Implementations/Activity/ActivityRepository.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
index 2a5d56c60..080cfbbd1 100644
--- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
+++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
@@ -133,6 +133,10 @@ namespace Emby.Server.Implementations.AppBase
}
}
+ ///
+ /// Adds parts.
+ ///
+ /// The configuration factories.
public virtual void AddParts(IEnumerable factories)
{
_configurationFactories = factories.ToArray();
@@ -247,6 +251,10 @@ namespace Emby.Server.Implementations.AppBase
}
}
+ ///
+ /// Ensures that we have write access to the path.
+ ///
+ /// The path.
protected void EnsureWriteAccess(string path)
{
var file = Path.Combine(path, Guid.NewGuid().ToString());
@@ -259,6 +267,7 @@ namespace Emby.Server.Implementations.AppBase
return Path.Combine(CommonApplicationPaths.ConfigurationDirectoryPath, key.ToLowerInvariant() + ".xml");
}
+ ///
public object GetConfiguration(string key)
{
return _configurations.GetOrAdd(key, k =>
@@ -305,6 +314,7 @@ namespace Emby.Server.Implementations.AppBase
}
}
+ ///
public void SaveConfiguration(string key, object configuration)
{
var configurationStore = GetConfigurationStore(key);
@@ -341,6 +351,11 @@ namespace Emby.Server.Implementations.AppBase
OnNamedConfigurationUpdated(key, configuration);
}
+ ///
+ /// Event handler for when a named configuration has been updated.
+ ///
+ /// The key of the configuration.
+ /// The old configuration.
protected virtual void OnNamedConfigurationUpdated(string key, object configuration)
{
NamedConfigurationUpdated?.Invoke(this, new ConfigurationUpdateEventArgs
@@ -350,6 +365,7 @@ namespace Emby.Server.Implementations.AppBase
});
}
+ ///
public Type GetConfigurationType(string key)
{
return GetConfigurationStore(key)
diff --git a/Emby.Server.Implementations/Archiving/ZipClient.cs b/Emby.Server.Implementations/Archiving/ZipClient.cs
index 6b0fd2dc6..4a6e5cfd7 100644
--- a/Emby.Server.Implementations/Archiving/ZipClient.cs
+++ b/Emby.Server.Implementations/Archiving/ZipClient.cs
@@ -10,15 +10,10 @@ using SharpCompress.Readers.Zip;
namespace Emby.Server.Implementations.Archiving
{
///
- /// Class DotNetZipClient
+ /// Class DotNetZipClient.
///
public class ZipClient : IZipClient
{
- public ZipClient()
- {
-
- }
-
///
/// Extracts all.
///
@@ -144,7 +139,6 @@ namespace Emby.Server.Implementations.Archiving
}
}
-
///
/// Extracts all from tar.
///
diff --git a/Emby.Server.Implementations/Branding/BrandingConfigurationFactory.cs b/Emby.Server.Implementations/Branding/BrandingConfigurationFactory.cs
index b27f84848..93000ae12 100644
--- a/Emby.Server.Implementations/Branding/BrandingConfigurationFactory.cs
+++ b/Emby.Server.Implementations/Branding/BrandingConfigurationFactory.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System.Collections.Generic;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Branding;
diff --git a/Emby.Server.Implementations/Browser/BrowserLauncher.cs b/Emby.Server.Implementations/Browser/BrowserLauncher.cs
index 718129ef0..f5da0d018 100644
--- a/Emby.Server.Implementations/Browser/BrowserLauncher.cs
+++ b/Emby.Server.Implementations/Browser/BrowserLauncher.cs
@@ -4,7 +4,7 @@ using MediaBrowser.Controller;
namespace Emby.Server.Implementations.Browser
{
///
- /// Class BrowserLauncher
+ /// Class BrowserLauncher.
///
public static class BrowserLauncher
{
@@ -32,6 +32,7 @@ namespace Emby.Server.Implementations.Browser
///
/// Opens the URL.
///
+ /// The application host instance.
/// The URL.
private static void OpenUrl(IServerApplicationHost appHost, string url)
{
diff --git a/Emby.Server.Implementations/Channels/ChannelDynamicMediaSourceProvider.cs b/Emby.Server.Implementations/Channels/ChannelDynamicMediaSourceProvider.cs
index c10f00f9b..6016fed07 100644
--- a/Emby.Server.Implementations/Channels/ChannelDynamicMediaSourceProvider.cs
+++ b/Emby.Server.Implementations/Channels/ChannelDynamicMediaSourceProvider.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Threading;
@@ -13,11 +15,16 @@ namespace Emby.Server.Implementations.Channels
{
private readonly ChannelManager _channelManager;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The channel manager.
public ChannelDynamicMediaSourceProvider(IChannelManager channelManager)
{
_channelManager = (ChannelManager)channelManager;
}
+ ///
public Task> GetMediaSources(BaseItem item, CancellationToken cancellationToken)
{
if (item.SourceType == SourceType.Channel)
@@ -28,6 +35,7 @@ namespace Emby.Server.Implementations.Channels
return Task.FromResult>(new List());
}
+ ///
public Task OpenMediaSource(string openToken, List currentLiveStreams, CancellationToken cancellationToken)
{
throw new NotImplementedException();
diff --git a/Emby.Server.Implementations/Channels/ChannelImageProvider.cs b/Emby.Server.Implementations/Channels/ChannelImageProvider.cs
index bafa68818..62aeb9bcb 100644
--- a/Emby.Server.Implementations/Channels/ChannelImageProvider.cs
+++ b/Emby.Server.Implementations/Channels/ChannelImageProvider.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System.Collections.Generic;
using System.Linq;
using System.Threading;
diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs
index 151670074..6e1baddfe 100644
--- a/Emby.Server.Implementations/Channels/ChannelManager.cs
+++ b/Emby.Server.Implementations/Channels/ChannelManager.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -510,7 +512,7 @@ namespace Emby.Server.Implementations.Channels
return _libraryManager.GetItemIds(new InternalItemsQuery
{
IncludeItemTypes = new[] { typeof(Channel).Name },
- OrderBy = new ValueTuple[] { new ValueTuple(ItemSortBy.SortName, SortOrder.Ascending) }
+ OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) }
}).Select(i => GetChannelFeatures(i.ToString("N", CultureInfo.InvariantCulture))).ToArray();
}
@@ -618,16 +620,16 @@ namespace Emby.Server.Implementations.Channels
{
query.OrderBy = new[]
{
- new ValueTuple(ItemSortBy.PremiereDate, SortOrder.Descending),
- new ValueTuple(ItemSortBy.ProductionYear, SortOrder.Descending),
- new ValueTuple(ItemSortBy.DateCreated, SortOrder.Descending)
+ (ItemSortBy.PremiereDate, SortOrder.Descending),
+ (ItemSortBy.ProductionYear, SortOrder.Descending),
+ (ItemSortBy.DateCreated, SortOrder.Descending)
};
}
else
{
query.OrderBy = new[]
{
- new ValueTuple(ItemSortBy.DateCreated, SortOrder.Descending)
+ (ItemSortBy.DateCreated, SortOrder.Descending)
};
}
diff --git a/Emby.Server.Implementations/Channels/ChannelPostScanTask.cs b/Emby.Server.Implementations/Channels/ChannelPostScanTask.cs
index 3c7cbb115..2712fc8c5 100644
--- a/Emby.Server.Implementations/Channels/ChannelPostScanTask.cs
+++ b/Emby.Server.Implementations/Channels/ChannelPostScanTask.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Linq;
using System.Threading;
diff --git a/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs b/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs
index 303a8ac7b..5774c0415 100644
--- a/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs
+++ b/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Threading;
diff --git a/Emby.Server.Implementations/Collections/CollectionImageProvider.cs b/Emby.Server.Implementations/Collections/CollectionImageProvider.cs
index 0244c4a68..1fa556ec9 100644
--- a/Emby.Server.Implementations/Collections/CollectionImageProvider.cs
+++ b/Emby.Server.Implementations/Collections/CollectionImageProvider.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Linq;
@@ -76,7 +78,6 @@ namespace Emby.Server.Implementations.Collections
.Where(i => i != null)
.GroupBy(x => x.Id)
.Select(x => x.First())
- .OrderBy(i => Guid.NewGuid())
.ToList();
}
diff --git a/Emby.Server.Implementations/Collections/CollectionManager.cs b/Emby.Server.Implementations/Collections/CollectionManager.cs
index c5a77ce5b..2b8a5bdc5 100644
--- a/Emby.Server.Implementations/Collections/CollectionManager.cs
+++ b/Emby.Server.Implementations/Collections/CollectionManager.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
diff --git a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs
index 2291345be..3d8d15d19 100644
--- a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs
+++ b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Generic;
+using System.Globalization;
using System.IO;
using Emby.Server.Implementations.AppBase;
using MediaBrowser.Common.Configuration;
@@ -17,7 +19,6 @@ namespace Emby.Server.Implementations.Configuration
///
public class ServerConfigurationManager : BaseConfigurationManager, IServerConfigurationManager
{
-
///
/// Initializes a new instance of the class.
///
@@ -31,6 +32,9 @@ namespace Emby.Server.Implementations.Configuration
UpdateMetadataPath();
}
+ ///
+ /// Configuration updating event.
+ ///
public event EventHandler> ConfigurationUpdating;
///
@@ -97,7 +101,7 @@ namespace Emby.Server.Implementations.Configuration
/// Validates the SSL certificate.
///
/// The new configuration.
- ///
+ /// The certificate path doesn't exist.
private void ValidateSslCertificate(BaseApplicationConfiguration newConfig)
{
var serverConfig = (ServerConfiguration)newConfig;
@@ -105,12 +109,16 @@ namespace Emby.Server.Implementations.Configuration
var newPath = serverConfig.CertificatePath;
if (!string.IsNullOrWhiteSpace(newPath)
- && !string.Equals(Configuration.CertificatePath ?? string.Empty, newPath))
+ && !string.Equals(Configuration.CertificatePath, newPath, StringComparison.Ordinal))
{
// Validate
if (!File.Exists(newPath))
{
- throw new FileNotFoundException(string.Format("Certificate file '{0}' does not exist.", newPath));
+ throw new FileNotFoundException(
+ string.Format(
+ CultureInfo.InvariantCulture,
+ "Certificate file '{0}' does not exist.",
+ newPath));
}
}
}
@@ -119,24 +127,32 @@ namespace Emby.Server.Implementations.Configuration
/// Validates the metadata path.
///
/// The new configuration.
- ///
+ /// The new config path doesn't exist.
private void ValidateMetadataPath(ServerConfiguration newConfig)
{
var newPath = newConfig.MetadataPath;
if (!string.IsNullOrWhiteSpace(newPath)
- && !string.Equals(Configuration.MetadataPath ?? string.Empty, newPath))
+ && !string.Equals(Configuration.MetadataPath, newPath, StringComparison.Ordinal))
{
// Validate
if (!Directory.Exists(newPath))
{
- throw new FileNotFoundException(string.Format("{0} does not exist.", newPath));
+ throw new DirectoryNotFoundException(
+ string.Format(
+ CultureInfo.InvariantCulture,
+ "{0} does not exist.",
+ newPath));
}
EnsureWriteAccess(newPath);
}
}
+ ///
+ /// Sets all configuration values to their optimal values.
+ ///
+ /// If the configuration changed.
public bool SetOptimalValues()
{
var config = Configuration;
diff --git a/Emby.Server.Implementations/Cryptography/CryptographyProvider.cs b/Emby.Server.Implementations/Cryptography/CryptographyProvider.cs
index fec7d161e..776074b72 100644
--- a/Emby.Server.Implementations/Cryptography/CryptographyProvider.cs
+++ b/Emby.Server.Implementations/Cryptography/CryptographyProvider.cs
@@ -6,6 +6,9 @@ using static MediaBrowser.Common.Cryptography.Constants;
namespace Emby.Server.Implementations.Cryptography
{
+ ///
+ /// Class providing abstractions over cryptographic functions.
+ ///
public class CryptographyProvider : ICryptoProvider, IDisposable
{
private static readonly HashSet _supportedHashMethods = new HashSet()
@@ -42,8 +45,10 @@ namespace Emby.Server.Implementations.Cryptography
_randomNumberGenerator = RandomNumberGenerator.Create();
}
+ ///
public string DefaultHashMethod => "PBKDF2";
+ ///
public IEnumerable GetSupportedHashMethods()
=> _supportedHashMethods;
@@ -62,6 +67,7 @@ namespace Emby.Server.Implementations.Cryptography
throw new CryptographicException($"Cannot currently use PBKDF2 with requested hash method: {method}");
}
+ ///
public byte[] ComputeHash(string hashMethod, byte[] bytes, byte[] salt)
{
if (hashMethod == DefaultHashMethod)
@@ -89,12 +95,15 @@ namespace Emby.Server.Implementations.Cryptography
throw new CryptographicException($"Requested hash method is not supported: {hashMethod}");
}
+ ///
public byte[] ComputeHashWithDefaultMethod(byte[] bytes, byte[] salt)
=> PBKDF2(DefaultHashMethod, bytes, salt, DefaultIterations);
+ ///
public byte[] GenerateSalt()
=> GenerateSalt(DefaultSaltLength);
+ ///
public byte[] GenerateSalt(int length)
{
byte[] salt = new byte[length];
@@ -109,6 +118,10 @@ namespace Emby.Server.Implementations.Cryptography
GC.SuppressFinalize(this);
}
+ ///
+ /// Releases unmanaged and - optionally - managed resources.
+ ///
+ /// true to release both managed and unmanaged resources; false to release only unmanaged resources.
protected virtual void Dispose(bool disposing)
{
if (_disposed)
diff --git a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs
index 4e392f6c9..0654132f4 100644
--- a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs
+++ b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,6 +13,10 @@ namespace Emby.Server.Implementations.Data
{
private bool _disposed = false;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The logger.
protected BaseSqliteRepository(ILogger logger)
{
Logger = logger;
diff --git a/Emby.Server.Implementations/Data/CleanDatabaseScheduledTask.cs b/Emby.Server.Implementations/Data/CleanDatabaseScheduledTask.cs
index f7743a3c2..2a8f2d6b3 100644
--- a/Emby.Server.Implementations/Data/CleanDatabaseScheduledTask.cs
+++ b/Emby.Server.Implementations/Data/CleanDatabaseScheduledTask.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Threading;
using System.Threading.Tasks;
diff --git a/Emby.Server.Implementations/Data/ManagedConnection.cs b/Emby.Server.Implementations/Data/ManagedConnection.cs
index 4c3424410..5c094ddd2 100644
--- a/Emby.Server.Implementations/Data/ManagedConnection.cs
+++ b/Emby.Server.Implementations/Data/ManagedConnection.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Threading;
diff --git a/Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs b/Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs
index 2f6c1288d..d474f1c6b 100644
--- a/Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
diff --git a/Emby.Server.Implementations/Data/SqliteExtensions.cs b/Emby.Server.Implementations/Data/SqliteExtensions.cs
index c76ae0cac..c87793072 100644
--- a/Emby.Server.Implementations/Data/SqliteExtensions.cs
+++ b/Emby.Server.Implementations/Data/SqliteExtensions.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
index 8d509f688..69cfcb67b 100644
--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
@@ -7,6 +7,7 @@ using System.Text;
using System.Text.Json;
using System.Threading;
using Emby.Server.Implementations.Playlists;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Json;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Channels;
@@ -2831,8 +2832,8 @@ namespace Emby.Server.Implementations.Data
BindSimilarParams(query, statement);
BindSearchParams(query, statement);
- // Running this again will bind the params
- GetWhereClauses(query, statement);
+ // Running this again will bind the params
+ GetWhereClauses(query, statement);
var hasEpisodeAttributes = HasEpisodeAttributes(query);
var hasServiceName = HasServiceName(query);
@@ -2881,14 +2882,14 @@ namespace Emby.Server.Implementations.Data
private string GetOrderByText(InternalItemsQuery query)
{
+ var orderBy = query.OrderBy;
if (string.IsNullOrEmpty(query.SearchTerm))
{
- int oldLen = query.OrderBy.Length;
-
- if (query.SimilarTo != null && oldLen == 0)
+ int oldLen = orderBy.Count;
+ if (oldLen == 0 && query.SimilarTo != null)
{
var arr = new (string, SortOrder)[oldLen + 2];
- query.OrderBy.CopyTo(arr, 0);
+ orderBy.CopyTo(arr, 0);
arr[oldLen] = ("SimilarityScore", SortOrder.Descending);
arr[oldLen + 1] = (ItemSortBy.Random, SortOrder.Ascending);
query.OrderBy = arr;
@@ -2896,16 +2897,15 @@ namespace Emby.Server.Implementations.Data
}
else
{
- query.OrderBy = new []
+ query.OrderBy = new[]
{
("SearchScore", SortOrder.Descending),
(ItemSortBy.SortName, SortOrder.Ascending)
};
}
- var orderBy = query.OrderBy;
- if (orderBy.Length == 0)
+ if (orderBy.Count == 0)
{
return string.Empty;
}
@@ -2913,14 +2913,8 @@ namespace Emby.Server.Implementations.Data
return " ORDER BY " + string.Join(",", orderBy.Select(i =>
{
var columnMap = MapOrderByField(i.Item1, query);
- var columnAscending = i.Item2 == SortOrder.Ascending;
- const bool enableOrderInversion = false;
- if (columnMap.Item2 && enableOrderInversion)
- {
- columnAscending = !columnAscending;
- }
- var sortOrder = columnAscending ? "ASC" : "DESC";
+ var sortOrder = i.Item2 == SortOrder.Ascending ? "ASC" : "DESC";
return columnMap.Item1 + " " + sortOrder;
}));
diff --git a/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs b/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs
index 26ac17bdc..22955850a 100644
--- a/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.IO;
diff --git a/Emby.Server.Implementations/Data/SqliteUserRepository.cs b/Emby.Server.Implementations/Data/SqliteUserRepository.cs
index 26798993b..a042320c9 100644
--- a/Emby.Server.Implementations/Data/SqliteUserRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteUserRepository.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.IO;
diff --git a/Emby.Server.Implementations/Data/TypeMapper.cs b/Emby.Server.Implementations/Data/TypeMapper.cs
index 0e67affbf..7044b1d19 100644
--- a/Emby.Server.Implementations/Data/TypeMapper.cs
+++ b/Emby.Server.Implementations/Data/TypeMapper.cs
@@ -5,25 +5,22 @@ using System.Linq;
namespace Emby.Server.Implementations.Data
{
///
- /// Class TypeMapper
+ /// Class TypeMapper.
///
public class TypeMapper
{
///
- /// This holds all the types in the running assemblies so that we can de-serialize properly when we don't have strong types
+ /// This holds all the types in the running assemblies
+ /// so that we can de-serialize properly when we don't have strong types.
///
private readonly ConcurrentDictionary _typeMap = new ConcurrentDictionary();
- public TypeMapper()
- {
- }
-
///
/// Gets the type.
///
/// Name of the type.
/// Type.
- ///
+ /// typeName is null.
public Type GetType(string typeName)
{
if (string.IsNullOrEmpty(typeName))
diff --git a/Emby.Server.Implementations/Devices/DeviceId.cs b/Emby.Server.Implementations/Devices/DeviceId.cs
index 7344dc72f..f0d43e665 100644
--- a/Emby.Server.Implementations/Devices/DeviceId.cs
+++ b/Emby.Server.Implementations/Devices/DeviceId.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Globalization;
using System.IO;
diff --git a/Emby.Server.Implementations/Devices/DeviceManager.cs b/Emby.Server.Implementations/Devices/DeviceManager.cs
index 36d441851..2393f1f45 100644
--- a/Emby.Server.Implementations/Devices/DeviceManager.cs
+++ b/Emby.Server.Implementations/Devices/DeviceManager.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
diff --git a/Emby.Server.Implementations/Diagnostics/CommonProcess.cs b/Emby.Server.Implementations/Diagnostics/CommonProcess.cs
index 175a8f3ce..bfa49ac5f 100644
--- a/Emby.Server.Implementations/Diagnostics/CommonProcess.cs
+++ b/Emby.Server.Implementations/Diagnostics/CommonProcess.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Diagnostics;
using System.IO;
diff --git a/Emby.Server.Implementations/Diagnostics/ProcessFactory.cs b/Emby.Server.Implementations/Diagnostics/ProcessFactory.cs
index 14aadaaae..02ad3c1a8 100644
--- a/Emby.Server.Implementations/Diagnostics/ProcessFactory.cs
+++ b/Emby.Server.Implementations/Diagnostics/ProcessFactory.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using MediaBrowser.Model.Diagnostics;
namespace Emby.Server.Implementations.Diagnostics
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs
index 6c0e32e05..3d622b3fc 100644
--- a/Emby.Server.Implementations/Dto/DtoService.cs
+++ b/Emby.Server.Implementations/Dto/DtoService.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
index fde4d7059..4b6ba1fab 100644
--- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj
+++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
@@ -15,12 +15,12 @@
-
+
diff --git a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
index 19ea09359..d69b0909d 100644
--- a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
+++ b/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Linq;
using System.Threading;
diff --git a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
index a2619367d..e290c62e1 100644
--- a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
+++ b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Net;
diff --git a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
index 24906220d..5f938e59a 100644
--- a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
diff --git a/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs b/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs
index 0186da9e1..dbb3503c4 100644
--- a/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Linq;
using System.Threading;
diff --git a/Emby.Server.Implementations/EntryPoints/RefreshUsersMetadata.cs b/Emby.Server.Implementations/EntryPoints/RefreshUsersMetadata.cs
index 3a7516dca..f00996b5f 100644
--- a/Emby.Server.Implementations/EntryPoints/RefreshUsersMetadata.cs
+++ b/Emby.Server.Implementations/EntryPoints/RefreshUsersMetadata.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Library;
@@ -12,32 +11,19 @@ using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.EntryPoints
{
///
- /// Class RefreshUsersMetadata
+ /// Class RefreshUsersMetadata.
///
public class RefreshUsersMetadata : IScheduledTask, IConfigurableScheduledTask
{
private readonly ILogger _logger;
+
///
- /// The _user manager
+ /// The user manager.
///
private readonly IUserManager _userManager;
private IFileSystem _fileSystem;
- public string Name => "Refresh Users";
-
- public string Key => "RefreshUsers";
-
- public string Description => "Refresh user infos";
-
- public string Category => "Library";
-
- public bool IsHidden => true;
-
- public bool IsEnabled => true;
-
- public bool IsLogged => true;
-
///
/// Initializes a new instance of the class.
///
@@ -48,6 +34,28 @@ namespace Emby.Server.Implementations.EntryPoints
_fileSystem = fileSystem;
}
+ ///
+ public string Name => "Refresh Users";
+
+ ///
+ public string Key => "RefreshUsers";
+
+ ///
+ public string Description => "Refresh user infos";
+
+ ///
+ public string Category => "Library";
+
+ ///
+ public bool IsHidden => true;
+
+ ///
+ public bool IsEnabled => true;
+
+ ///
+ public bool IsLogged => true;
+
+ ///
public async Task Execute(CancellationToken cancellationToken, IProgress progress)
{
foreach (var user in _userManager.Users)
@@ -58,9 +66,10 @@ namespace Emby.Server.Implementations.EntryPoints
}
}
+ ///
public IEnumerable GetDefaultTriggers()
{
- return new List
+ return new[]
{
new TaskTriggerInfo
{
diff --git a/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs b/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs
index 3ff8d9968..e1dbb663b 100644
--- a/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs
@@ -16,33 +16,46 @@ using MediaBrowser.Model.Tasks;
namespace Emby.Server.Implementations.EntryPoints
{
///
- /// Class WebSocketEvents
+ /// Class WebSocketEvents.
///
public class ServerEventNotifier : IServerEntryPoint
{
///
- /// The _user manager
+ /// The user manager.
///
private readonly IUserManager _userManager;
///
- /// The _installation manager
+ /// The installation manager.
///
private readonly IInstallationManager _installationManager;
///
- /// The _kernel
+ /// The kernel.
///
private readonly IServerApplicationHost _appHost;
///
- /// The _task manager
+ /// The task manager.
///
private readonly ITaskManager _taskManager;
private readonly ISessionManager _sessionManager;
- public ServerEventNotifier(IServerApplicationHost appHost, IUserManager userManager, IInstallationManager installationManager, ITaskManager taskManager, ISessionManager sessionManager)
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The application host.
+ /// The user manager.
+ /// The installation manager.
+ /// The task manager.
+ /// The session manager.
+ public ServerEventNotifier(
+ IServerApplicationHost appHost,
+ IUserManager userManager,
+ IInstallationManager installationManager,
+ ITaskManager taskManager,
+ ISessionManager sessionManager)
{
_userManager = userManager;
_installationManager = installationManager;
@@ -51,47 +64,48 @@ namespace Emby.Server.Implementations.EntryPoints
_sessionManager = sessionManager;
}
+ ///
public Task RunAsync()
{
- _userManager.UserDeleted += userManager_UserDeleted;
- _userManager.UserUpdated += userManager_UserUpdated;
- _userManager.UserPolicyUpdated += _userManager_UserPolicyUpdated;
- _userManager.UserConfigurationUpdated += _userManager_UserConfigurationUpdated;
+ _userManager.UserDeleted += OnUserDeleted;
+ _userManager.UserUpdated += OnUserUpdated;
+ _userManager.UserPolicyUpdated += OnUserPolicyUpdated;
+ _userManager.UserConfigurationUpdated += OnUserConfigurationUpdated;
- _appHost.HasPendingRestartChanged += kernel_HasPendingRestartChanged;
+ _appHost.HasPendingRestartChanged += OnHasPendingRestartChanged;
- _installationManager.PluginUninstalled += InstallationManager_PluginUninstalled;
- _installationManager.PackageInstalling += _installationManager_PackageInstalling;
- _installationManager.PackageInstallationCancelled += _installationManager_PackageInstallationCancelled;
- _installationManager.PackageInstallationCompleted += _installationManager_PackageInstallationCompleted;
- _installationManager.PackageInstallationFailed += _installationManager_PackageInstallationFailed;
+ _installationManager.PluginUninstalled += OnPluginUninstalled;
+ _installationManager.PackageInstalling += OnPackageInstalling;
+ _installationManager.PackageInstallationCancelled += OnPackageInstallationCancelled;
+ _installationManager.PackageInstallationCompleted += OnPackageInstallationCompleted;
+ _installationManager.PackageInstallationFailed += OnPackageInstallationFailed;
- _taskManager.TaskCompleted += _taskManager_TaskCompleted;
+ _taskManager.TaskCompleted += OnTaskCompleted;
return Task.CompletedTask;
}
- void _installationManager_PackageInstalling(object sender, InstallationEventArgs e)
+ private void OnPackageInstalling(object sender, InstallationEventArgs e)
{
SendMessageToAdminSessions("PackageInstalling", e.InstallationInfo);
}
- void _installationManager_PackageInstallationCancelled(object sender, InstallationEventArgs e)
+ private void OnPackageInstallationCancelled(object sender, InstallationEventArgs e)
{
SendMessageToAdminSessions("PackageInstallationCancelled", e.InstallationInfo);
}
- void _installationManager_PackageInstallationCompleted(object sender, InstallationEventArgs e)
+ private void OnPackageInstallationCompleted(object sender, InstallationEventArgs e)
{
SendMessageToAdminSessions("PackageInstallationCompleted", e.InstallationInfo);
}
- void _installationManager_PackageInstallationFailed(object sender, InstallationFailedEventArgs e)
+ private void OnPackageInstallationFailed(object sender, InstallationFailedEventArgs e)
{
SendMessageToAdminSessions("PackageInstallationFailed", e.InstallationInfo);
}
- void _taskManager_TaskCompleted(object sender, TaskCompletionEventArgs e)
+ private void OnTaskCompleted(object sender, TaskCompletionEventArgs e)
{
SendMessageToAdminSessions("ScheduledTaskEnded", e.Result);
}
@@ -101,7 +115,7 @@ namespace Emby.Server.Implementations.EntryPoints
///
/// The sender.
/// The e.
- void InstallationManager_PluginUninstalled(object sender, GenericEventArgs e)
+ private void OnPluginUninstalled(object sender, GenericEventArgs e)
{
SendMessageToAdminSessions("PluginUninstalled", e.Argument.GetPluginInfo());
}
@@ -111,7 +125,7 @@ namespace Emby.Server.Implementations.EntryPoints
///
/// The source of the event.
/// The instance containing the event data.
- void kernel_HasPendingRestartChanged(object sender, EventArgs e)
+ private void OnHasPendingRestartChanged(object sender, EventArgs e)
{
_sessionManager.SendRestartRequiredNotification(CancellationToken.None);
}
@@ -121,7 +135,7 @@ namespace Emby.Server.Implementations.EntryPoints
///
/// The sender.
/// The e.
- void userManager_UserUpdated(object sender, GenericEventArgs e)
+ private void OnUserUpdated(object sender, GenericEventArgs e)
{
var dto = _userManager.GetUserDto(e.Argument);
@@ -133,19 +147,19 @@ namespace Emby.Server.Implementations.EntryPoints
///
/// The sender.
/// The e.
- void userManager_UserDeleted(object sender, GenericEventArgs e)
+ private void OnUserDeleted(object sender, GenericEventArgs e)
{
SendMessageToUserSession(e.Argument, "UserDeleted", e.Argument.Id.ToString("N", CultureInfo.InvariantCulture));
}
- void _userManager_UserPolicyUpdated(object sender, GenericEventArgs e)
+ private void OnUserPolicyUpdated(object sender, GenericEventArgs e)
{
var dto = _userManager.GetUserDto(e.Argument);
SendMessageToUserSession(e.Argument, "UserPolicyUpdated", dto);
}
- void _userManager_UserConfigurationUpdated(object sender, GenericEventArgs e)
+ private void OnUserConfigurationUpdated(object sender, GenericEventArgs e)
{
var dto = _userManager.GetUserDto(e.Argument);
@@ -168,7 +182,11 @@ namespace Emby.Server.Implementations.EntryPoints
{
try
{
- await _sessionManager.SendMessageToUserSessions(new List { user.Id }, name, data, CancellationToken.None);
+ await _sessionManager.SendMessageToUserSessions(
+ new List { user.Id },
+ name,
+ data,
+ CancellationToken.None).ConfigureAwait(false);
}
catch (Exception)
{
@@ -176,12 +194,11 @@ namespace Emby.Server.Implementations.EntryPoints
}
}
- ///
- /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- ///
+ ///
public void Dispose()
{
Dispose(true);
+ GC.SuppressFinalize(this);
}
///
@@ -192,18 +209,20 @@ namespace Emby.Server.Implementations.EntryPoints
{
if (dispose)
{
- _userManager.UserDeleted -= userManager_UserDeleted;
- _userManager.UserUpdated -= userManager_UserUpdated;
- _userManager.UserPolicyUpdated -= _userManager_UserPolicyUpdated;
- _userManager.UserConfigurationUpdated -= _userManager_UserConfigurationUpdated;
+ _userManager.UserDeleted -= OnUserDeleted;
+ _userManager.UserUpdated -= OnUserUpdated;
+ _userManager.UserPolicyUpdated -= OnUserPolicyUpdated;
+ _userManager.UserConfigurationUpdated -= OnUserConfigurationUpdated;
- _installationManager.PluginUninstalled -= InstallationManager_PluginUninstalled;
- _installationManager.PackageInstalling -= _installationManager_PackageInstalling;
- _installationManager.PackageInstallationCancelled -= _installationManager_PackageInstallationCancelled;
- _installationManager.PackageInstallationCompleted -= _installationManager_PackageInstallationCompleted;
- _installationManager.PackageInstallationFailed -= _installationManager_PackageInstallationFailed;
+ _installationManager.PluginUninstalled -= OnPluginUninstalled;
+ _installationManager.PackageInstalling -= OnPackageInstalling;
+ _installationManager.PackageInstallationCancelled -= OnPackageInstallationCancelled;
+ _installationManager.PackageInstallationCompleted -= OnPackageInstallationCompleted;
+ _installationManager.PackageInstallationFailed -= OnPackageInstallationFailed;
- _appHost.HasPendingRestartChanged -= kernel_HasPendingRestartChanged;
+ _appHost.HasPendingRestartChanged -= OnHasPendingRestartChanged;
+
+ _taskManager.TaskCompleted -= OnTaskCompleted;
}
}
}
diff --git a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
index 8be6db87d..161788c63 100644
--- a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
+++ b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
@@ -8,21 +8,28 @@ using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.EntryPoints
{
///
- /// Class StartupWizard
+ /// Class StartupWizard.
///
public class StartupWizard : IServerEntryPoint
{
///
- /// The _app host
+ /// The app host.
///
private readonly IServerApplicationHost _appHost;
+
///
- /// The _user manager
+ /// The user manager.
///
private readonly ILogger _logger;
private IServerConfigurationManager _config;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The application host.
+ /// The logger.
+ /// The configuration manager.
public StartupWizard(IServerApplicationHost appHost, ILogger logger, IServerConfigurationManager config)
{
_appHost = appHost;
@@ -30,9 +37,7 @@ namespace Emby.Server.Implementations.EntryPoints
_config = config;
}
- ///
- /// Runs this instance.
- ///
+ ///
public Task RunAsync()
{
if (!_appHost.CanLaunchWebBrowser)
@@ -57,9 +62,7 @@ namespace Emby.Server.Implementations.EntryPoints
return Task.CompletedTask;
}
- ///
- /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- ///
+ ///
public void Dispose()
{
}
diff --git a/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs
index 5b90dc1fb..9ee219854 100644
--- a/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs
+++ b/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs
@@ -10,30 +10,36 @@ using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.EntryPoints
{
///
- /// Class UdpServerEntryPoint
+ /// Class UdpServerEntryPoint.
///
public class UdpServerEntryPoint : IServerEntryPoint
{
///
- /// Gets or sets the UDP server.
+ /// The port of the UDP server.
///
- /// The UDP server.
- private UdpServer UdpServer { get; set; }
+ public const int PortNumber = 7359;
///
- /// The _logger
+ /// The logger.
///
private readonly ILogger _logger;
private readonly ISocketFactory _socketFactory;
private readonly IServerApplicationHost _appHost;
private readonly IJsonSerializer _json;
- public const int PortNumber = 7359;
+ ///
+ /// The UDP server.
+ ///
+ private UdpServer _udpServer;
///
/// Initializes a new instance of the class.
///
- public UdpServerEntryPoint(ILogger logger, IServerApplicationHost appHost, IJsonSerializer json, ISocketFactory socketFactory)
+ public UdpServerEntryPoint(
+ ILogger logger,
+ IServerApplicationHost appHost,
+ IJsonSerializer json,
+ ISocketFactory socketFactory)
{
_logger = logger;
_appHost = appHost;
@@ -41,9 +47,7 @@ namespace Emby.Server.Implementations.EntryPoints
_socketFactory = socketFactory;
}
- ///
- /// Runs this instance.
- ///
+ ///
public Task RunAsync()
{
var udpServer = new UdpServer(_logger, _appHost, _json, _socketFactory);
@@ -52,7 +56,7 @@ namespace Emby.Server.Implementations.EntryPoints
{
udpServer.Start(PortNumber);
- UdpServer = udpServer;
+ _udpServer = udpServer;
}
catch (Exception ex)
{
@@ -62,12 +66,11 @@ namespace Emby.Server.Implementations.EntryPoints
return Task.CompletedTask;
}
- ///
- /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- ///
+ ///
public void Dispose()
{
Dispose(true);
+ GC.SuppressFinalize(this);
}
///
@@ -78,9 +81,9 @@ namespace Emby.Server.Implementations.EntryPoints
{
if (dispose)
{
- if (UdpServer != null)
+ if (_udpServer != null)
{
- UdpServer.Dispose();
+ _udpServer.Dispose();
}
}
}
diff --git a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
index bae3422ff..e431da148 100644
--- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
diff --git a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
index 2da0191dd..50233ea48 100644
--- a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
+++ b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
@@ -282,6 +282,7 @@ namespace Emby.Server.Implementations.HttpClientManager
};
}
+ ///
public Task Post(HttpRequestOptions options)
=> SendAsync(options, HttpMethod.Post);
diff --git a/Emby.Server.Implementations/HttpServer/FileWriter.cs b/Emby.Server.Implementations/HttpServer/FileWriter.cs
index 2c7e81361..c1c8c3eb3 100644
--- a/Emby.Server.Implementations/HttpServer/FileWriter.cs
+++ b/Emby.Server.Implementations/HttpServer/FileWriter.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
index 6dd016f8a..2aefc9fe5 100644
--- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Diagnostics;
diff --git a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
index b5cfb6b09..a62b4e7af 100644
--- a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -5,12 +7,10 @@ using System.IO;
using System.IO.Compression;
using System.Net;
using System.Runtime.Serialization;
-using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using Emby.Server.Implementations.Services;
-using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization;
@@ -24,12 +24,12 @@ using MimeTypes = MediaBrowser.Model.Net.MimeTypes;
namespace Emby.Server.Implementations.HttpServer
{
///
- /// Class HttpResultFactory
+ /// Class HttpResultFactory.
///
public class HttpResultFactory : IHttpResultFactory
{
///
- /// The _logger
+ /// The logger.
///
private readonly ILogger _logger;
private readonly IFileSystem _fileSystem;
diff --git a/Emby.Server.Implementations/HttpServer/IHttpListener.cs b/Emby.Server.Implementations/HttpServer/IHttpListener.cs
index 005656d2c..501593725 100644
--- a/Emby.Server.Implementations/HttpServer/IHttpListener.cs
+++ b/Emby.Server.Implementations/HttpServer/IHttpListener.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Threading;
using System.Threading.Tasks;
diff --git a/Emby.Server.Implementations/HttpServer/RangeRequestWriter.cs b/Emby.Server.Implementations/HttpServer/RangeRequestWriter.cs
index 320136d11..8b9028f6b 100644
--- a/Emby.Server.Implementations/HttpServer/RangeRequestWriter.cs
+++ b/Emby.Server.Implementations/HttpServer/RangeRequestWriter.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
diff --git a/Emby.Server.Implementations/HttpServer/ResponseFilter.cs b/Emby.Server.Implementations/HttpServer/ResponseFilter.cs
index 3e731366e..5e0466629 100644
--- a/Emby.Server.Implementations/HttpServer/ResponseFilter.cs
+++ b/Emby.Server.Implementations/HttpServer/ResponseFilter.cs
@@ -8,11 +8,17 @@ using Microsoft.Net.Http.Headers;
namespace Emby.Server.Implementations.HttpServer
{
+ ///
+ /// Class ResponseFilter.
+ ///
public class ResponseFilter
{
- private static readonly CultureInfo _usCulture = CultureInfo.ReadOnly(new CultureInfo("en-US"));
private readonly ILogger _logger;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The logger.
public ResponseFilter(ILogger logger)
{
_logger = logger;
@@ -37,7 +43,7 @@ namespace Emby.Server.Implementations.HttpServer
if (!string.IsNullOrEmpty(exception.Message))
{
- var error = exception.Message.Replace(Environment.NewLine, " ");
+ var error = exception.Message.Replace(Environment.NewLine, " ", StringComparison.Ordinal);
error = RemoveControlCharacters(error);
res.Headers.Add("X-Application-Error-Code", error);
@@ -55,7 +61,7 @@ namespace Emby.Server.Implementations.HttpServer
if (hasHeaders.Headers.TryGetValue(HeaderNames.ContentLength, out string contentLength)
&& !string.IsNullOrEmpty(contentLength))
{
- var length = long.Parse(contentLength, _usCulture);
+ var length = long.Parse(contentLength, CultureInfo.InvariantCulture);
if (length > 0)
{
diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs b/Emby.Server.Implementations/HttpServer/Security/AuthService.cs
index 594f46498..58421aaf1 100644
--- a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs
+++ b/Emby.Server.Implementations/HttpServer/Security/AuthService.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Linq;
using Emby.Server.Implementations.SocketSharp;
diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
index 457448604..129faeaab 100644
--- a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
+++ b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/Emby.Server.Implementations/HttpServer/Security/SessionContext.cs b/Emby.Server.Implementations/HttpServer/Security/SessionContext.cs
index 81e11d312..166952c64 100644
--- a/Emby.Server.Implementations/HttpServer/Security/SessionContext.cs
+++ b/Emby.Server.Implementations/HttpServer/Security/SessionContext.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
diff --git a/Emby.Server.Implementations/HttpServer/StreamWriter.cs b/Emby.Server.Implementations/HttpServer/StreamWriter.cs
index 194d04441..5afc51dbc 100644
--- a/Emby.Server.Implementations/HttpServer/StreamWriter.cs
+++ b/Emby.Server.Implementations/HttpServer/StreamWriter.cs
@@ -10,37 +10,20 @@ using Microsoft.Net.Http.Headers;
namespace Emby.Server.Implementations.HttpServer
{
///
- /// Class StreamWriter
+ /// Class StreamWriter.
///
public class StreamWriter : IAsyncStreamWriter, IHasHeaders
{
///
- /// Gets or sets the source stream.
- ///
- /// The source stream.
- private Stream SourceStream { get; set; }
-
- private byte[] SourceBytes { get; set; }
-
- ///
- /// The _options
+ /// The options.
///
private readonly IDictionary _options = new Dictionary();
- ///
- /// Gets the options.
- ///
- /// The options.
- public IDictionary Headers => _options;
-
- public Action OnComplete { get; set; }
- public Action OnError { get; set; }
///
/// Initializes a new instance of the class.
///
/// The source.
/// Type of the content.
- /// The logger.
public StreamWriter(Stream source, string contentType)
{
if (string.IsNullOrEmpty(contentType))
@@ -65,6 +48,7 @@ namespace Emby.Server.Implementations.HttpServer
///
/// The source.
/// Type of the content.
+ /// The content length.
public StreamWriter(byte[] source, string contentType, int contentLength)
{
if (string.IsNullOrEmpty(contentType))
@@ -78,6 +62,31 @@ namespace Emby.Server.Implementations.HttpServer
Headers[HeaderNames.ContentType] = contentType;
}
+ ///
+ /// Gets or sets the source stream.
+ ///
+ /// The source stream.
+ private Stream SourceStream { get; set; }
+
+ private byte[] SourceBytes { get; set; }
+
+ ///
+ /// Gets the options.
+ ///
+ /// The options.
+ public IDictionary Headers => _options;
+
+ ///
+ /// Fires when complete.
+ ///
+ public Action OnComplete { get; set; }
+
+ ///
+ /// Fires when an error occours.
+ ///
+ public Action OnError { get; set; }
+
+ ///
public async Task WriteToAsync(Stream responseStream, CancellationToken cancellationToken)
{
try
@@ -98,19 +107,13 @@ namespace Emby.Server.Implementations.HttpServer
}
catch
{
- if (OnError != null)
- {
- OnError();
- }
+ OnError?.Invoke();
throw;
}
finally
{
- if (OnComplete != null)
- {
- OnComplete();
- }
+ OnComplete?.Invoke();
}
}
}
diff --git a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs
index 54a16040f..2292d86a4 100644
--- a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs
+++ b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs
@@ -7,7 +7,6 @@ using Emby.Server.Implementations.Net;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Model.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using UtfUnknown;
@@ -15,32 +14,74 @@ using UtfUnknown;
namespace Emby.Server.Implementations.HttpServer
{
///
- /// Class WebSocketConnection
+ /// Class WebSocketConnection.
///
public class WebSocketConnection : IWebSocketConnection
{
- public event EventHandler Closed;
-
///
- /// The _socket
- ///
- private readonly IWebSocket _socket;
-
- ///
- /// The _remote end point
- ///
- public string RemoteEndPoint { get; private set; }
-
- ///
- /// The logger
+ /// The logger.
///
private readonly ILogger _logger;
///
- /// The _json serializer
+ /// The json serializer.
///
private readonly IJsonSerializer _jsonSerializer;
+ ///
+ /// The socket.
+ ///
+ private readonly IWebSocket _socket;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The socket.
+ /// The remote end point.
+ /// The json serializer.
+ /// The logger.
+ /// socket
+ public WebSocketConnection(IWebSocket socket, string remoteEndPoint, IJsonSerializer jsonSerializer, ILogger logger)
+ {
+ if (socket == null)
+ {
+ throw new ArgumentNullException(nameof(socket));
+ }
+
+ if (string.IsNullOrEmpty(remoteEndPoint))
+ {
+ throw new ArgumentNullException(nameof(remoteEndPoint));
+ }
+
+ if (jsonSerializer == null)
+ {
+ throw new ArgumentNullException(nameof(jsonSerializer));
+ }
+
+ if (logger == null)
+ {
+ throw new ArgumentNullException(nameof(logger));
+ }
+
+ Id = Guid.NewGuid();
+ _jsonSerializer = jsonSerializer;
+ _socket = socket;
+ _socket.OnReceiveBytes = OnReceiveInternal;
+
+ RemoteEndPoint = remoteEndPoint;
+ _logger = logger;
+
+ socket.Closed += OnSocketClosed;
+ }
+
+ ///
+ public event EventHandler Closed;
+
+ ///
+ /// Gets or sets the remote end point.
+ ///
+ public string RemoteEndPoint { get; private set; }
+
///
/// Gets or sets the receive action.
///
@@ -64,6 +105,7 @@ namespace Emby.Server.Implementations.HttpServer
///
/// The URL.
public string Url { get; set; }
+
///
/// Gets or sets the query string.
///
@@ -71,44 +113,12 @@ namespace Emby.Server.Implementations.HttpServer
public IQueryCollection QueryString { get; set; }
///
- /// Initializes a new instance of the class.
+ /// Gets the state.
///
- /// The socket.
- /// The remote end point.
- /// The json serializer.
- /// The logger.
- /// socket
- public WebSocketConnection(IWebSocket socket, string remoteEndPoint, IJsonSerializer jsonSerializer, ILogger logger)
- {
- if (socket == null)
- {
- throw new ArgumentNullException(nameof(socket));
- }
- if (string.IsNullOrEmpty(remoteEndPoint))
- {
- throw new ArgumentNullException(nameof(remoteEndPoint));
- }
- if (jsonSerializer == null)
- {
- throw new ArgumentNullException(nameof(jsonSerializer));
- }
- if (logger == null)
- {
- throw new ArgumentNullException(nameof(logger));
- }
+ /// The state.
+ public WebSocketState State => _socket.State;
- Id = Guid.NewGuid();
- _jsonSerializer = jsonSerializer;
- _socket = socket;
- _socket.OnReceiveBytes = OnReceiveInternal;
-
- RemoteEndPoint = remoteEndPoint;
- _logger = logger;
-
- socket.Closed += socket_Closed;
- }
-
- void socket_Closed(object sender, EventArgs e)
+ void OnSocketClosed(object sender, EventArgs e)
{
Closed?.Invoke(this, EventArgs.Empty);
}
@@ -210,6 +220,7 @@ namespace Emby.Server.Implementations.HttpServer
return _socket.SendAsync(buffer, true, cancellationToken);
}
+ ///
public Task SendAsync(string text, CancellationToken cancellationToken)
{
if (string.IsNullOrEmpty(text))
@@ -222,18 +233,11 @@ namespace Emby.Server.Implementations.HttpServer
return _socket.SendAsync(text, true, cancellationToken);
}
- ///
- /// Gets the state.
- ///
- /// The state.
- public WebSocketState State => _socket.State;
-
- ///
- /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- ///
+ ///
public void Dispose()
{
Dispose(true);
+ GC.SuppressFinalize(this);
}
///
diff --git a/Emby.Server.Implementations/IO/ExtendedFileSystemInfo.cs b/Emby.Server.Implementations/IO/ExtendedFileSystemInfo.cs
index 48b34a3a0..3150f3367 100644
--- a/Emby.Server.Implementations/IO/ExtendedFileSystemInfo.cs
+++ b/Emby.Server.Implementations/IO/ExtendedFileSystemInfo.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
namespace Emby.Server.Implementations.IO
{
public class ExtendedFileSystemInfo
diff --git a/Emby.Server.Implementations/IO/FileRefresher.cs b/Emby.Server.Implementations/IO/FileRefresher.cs
index 40e8ed5dc..4b5b11f01 100644
--- a/Emby.Server.Implementations/IO/FileRefresher.cs
+++ b/Emby.Server.Implementations/IO/FileRefresher.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.IO;
diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.cs
index aeb541c54..b1fb8cc63 100644
--- a/Emby.Server.Implementations/IO/LibraryMonitor.cs
+++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -16,22 +18,22 @@ namespace Emby.Server.Implementations.IO
public class LibraryMonitor : ILibraryMonitor
{
///
- /// The file system watchers
+ /// The file system watchers.
///
private readonly ConcurrentDictionary _fileSystemWatchers = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase);
///
- /// The affected paths
+ /// The affected paths.
///
private readonly List _activeRefreshers = new List();
///
- /// A dynamic list of paths that should be ignored. Added to during our own file sytem modifications.
+ /// A dynamic list of paths that should be ignored. Added to during our own file system modifications.
///
private readonly ConcurrentDictionary _tempIgnoredPaths = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase);
///
- /// Any file name ending in any of these will be ignored by the watchers
+ /// Any file name ending in any of these will be ignored by the watchers.
///
private static readonly HashSet _alwaysIgnoreFiles = new HashSet(StringComparer.OrdinalIgnoreCase)
{
diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs
index ae8371a32..442fbabd1 100644
--- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs
+++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
diff --git a/Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs b/Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs
index 5e5e91bb3..e6696b8c4 100644
--- a/Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs
+++ b/Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.IO;
using MediaBrowser.Model.IO;
diff --git a/Emby.Server.Implementations/IO/StreamHelper.cs b/Emby.Server.Implementations/IO/StreamHelper.cs
index 7c8c079e3..40b397edc 100644
--- a/Emby.Server.Implementations/IO/StreamHelper.cs
+++ b/Emby.Server.Implementations/IO/StreamHelper.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Buffers;
using System.IO;
diff --git a/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs b/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs
index 6afcf567a..fd50f156a 100644
--- a/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs
+++ b/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
diff --git a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
index 8bdb38784..bc1398332 100644
--- a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
+++ b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
@@ -42,6 +42,10 @@ namespace Emby.Server.Implementations.Library
".grab",
};
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The library manager.
public CoreResolutionIgnoreRule(ILibraryManager libraryManager)
{
_libraryManager = libraryManager;
diff --git a/Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs b/Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs
index c043568d5..94f60ea62 100644
--- a/Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs
+++ b/Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs
@@ -10,10 +10,17 @@ using MediaBrowser.Model.Cryptography;
namespace Emby.Server.Implementations.Library
{
+ ///
+ /// The default authentication provider.
+ ///
public class DefaultAuthenticationProvider : IAuthenticationProvider, IRequiresResolvedUser
{
private readonly ICryptoProvider _cryptographyProvider;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The cryptography provider.
public DefaultAuthenticationProvider(ICryptoProvider cryptographyProvider)
{
_cryptographyProvider = cryptographyProvider;
@@ -38,12 +45,13 @@ namespace Emby.Server.Implementations.Library
// This is the version that we need to use for local users. Because reasons.
public Task Authenticate(string username, string password, User resolvedUser)
{
- bool success = false;
if (resolvedUser == null)
{
throw new ArgumentNullException(nameof(resolvedUser));
}
+ bool success = false;
+
// As long as jellyfin supports passwordless users, we need this little block here to accommodate
if (!HasPassword(resolvedUser) && string.IsNullOrEmpty(password))
{
diff --git a/Emby.Server.Implementations/Library/DefaultPasswordResetProvider.cs b/Emby.Server.Implementations/Library/DefaultPasswordResetProvider.cs
index fa6bbcf91..6c6fbd86f 100644
--- a/Emby.Server.Implementations/Library/DefaultPasswordResetProvider.cs
+++ b/Emby.Server.Implementations/Library/DefaultPasswordResetProvider.cs
@@ -12,6 +12,9 @@ using MediaBrowser.Model.Users;
namespace Emby.Server.Implementations.Library
{
+ ///
+ /// The default password reset provider.
+ ///
public class DefaultPasswordResetProvider : IPasswordResetProvider
{
private const string BaseResetFileName = "passwordreset";
@@ -22,6 +25,12 @@ namespace Emby.Server.Implementations.Library
private readonly string _passwordResetFileBase;
private readonly string _passwordResetFileBaseDir;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The configuration manager.
+ /// The JSON serializer.
+ /// The user manager.
public DefaultPasswordResetProvider(
IServerConfigurationManager configurationManager,
IJsonSerializer jsonSerializer,
@@ -56,8 +65,8 @@ namespace Emby.Server.Implementations.Library
File.Delete(resetfile);
}
else if (string.Equals(
- spr.Pin.Replace("-", string.Empty),
- pin.Replace("-", string.Empty),
+ spr.Pin.Replace("-", string.Empty, StringComparison.Ordinal),
+ pin.Replace("-", string.Empty, StringComparison.Ordinal),
StringComparison.InvariantCultureIgnoreCase))
{
var resetUser = _userManager.GetUserByName(spr.UserName);
diff --git a/Emby.Server.Implementations/Library/ExclusiveLiveStream.cs b/Emby.Server.Implementations/Library/ExclusiveLiveStream.cs
index a3c879f12..9a7186898 100644
--- a/Emby.Server.Implementations/Library/ExclusiveLiveStream.cs
+++ b/Emby.Server.Implementations/Library/ExclusiveLiveStream.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Globalization;
using System.Threading;
diff --git a/Emby.Server.Implementations/Library/InvalidAuthProvider.cs b/Emby.Server.Implementations/Library/InvalidAuthProvider.cs
index 7913df5e4..dc61aacd7 100644
--- a/Emby.Server.Implementations/Library/InvalidAuthProvider.cs
+++ b/Emby.Server.Implementations/Library/InvalidAuthProvider.cs
@@ -4,37 +4,48 @@ using MediaBrowser.Controller.Entities;
namespace Emby.Server.Implementations.Library
{
+ ///
+ /// An invalid authentication provider.
+ ///
public class InvalidAuthProvider : IAuthenticationProvider
{
+ ///
public string Name => "InvalidOrMissingAuthenticationProvider";
+ ///
public bool IsEnabled => true;
+ ///
public Task Authenticate(string username, string password)
{
throw new AuthenticationException("User Account cannot login with this provider. The Normal provider for this user cannot be found");
}
+ ///
public bool HasPassword(User user)
{
return true;
}
+ ///
public Task ChangePassword(User user, string newPassword)
{
return Task.CompletedTask;
}
+ ///
public void ChangeEasyPassword(User user, string newPassword, string newPasswordHash)
{
// Nothing here
}
+ ///
public string GetPasswordHash(User user)
{
return string.Empty;
}
+ ///
public string GetEasyPasswordHash(User user)
{
return string.Empty;
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs
index 8589b1b33..04a190101 100644
--- a/Emby.Server.Implementations/Library/LibraryManager.cs
+++ b/Emby.Server.Implementations/Library/LibraryManager.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -829,7 +831,7 @@ namespace Emby.Server.Implementations.Library
{
Path = path,
IsFolder = isFolder,
- OrderBy = new[] { ItemSortBy.DateCreated }.Select(i => new ValueTuple(i, SortOrder.Descending)).ToArray(),
+ OrderBy = new[] { (ItemSortBy.DateCreated, SortOrder.Descending) },
Limit = 1,
DtoOptions = new DtoOptions(true)
};
@@ -1257,7 +1259,7 @@ namespace Emby.Server.Implementations.Library
public List GetItemList(InternalItemsQuery query, bool allowExternalContent)
{
- if (query.Recursive && !query.ParentId.Equals(Guid.Empty))
+ if (query.Recursive && query.ParentId != Guid.Empty)
{
var parent = GetItemById(query.ParentId);
if (parent != null)
diff --git a/Emby.Server.Implementations/Library/LiveStreamHelper.cs b/Emby.Server.Implementations/Library/LiveStreamHelper.cs
index 33e6f2434..ed7d8aa40 100644
--- a/Emby.Server.Implementations/Library/LiveStreamHelper.cs
+++ b/Emby.Server.Implementations/Library/LiveStreamHelper.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs
index 7a26e0c37..22193c997 100644
--- a/Emby.Server.Implementations/Library/MediaSourceManager.cs
+++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
diff --git a/Emby.Server.Implementations/Library/MediaStreamSelector.cs b/Emby.Server.Implementations/Library/MediaStreamSelector.cs
index 0a6c8845d..6b9f4d052 100644
--- a/Emby.Server.Implementations/Library/MediaStreamSelector.cs
+++ b/Emby.Server.Implementations/Library/MediaStreamSelector.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/Emby.Server.Implementations/Library/MusicManager.cs b/Emby.Server.Implementations/Library/MusicManager.cs
index 10602fea7..1ec578371 100644
--- a/Emby.Server.Implementations/Library/MusicManager.cs
+++ b/Emby.Server.Implementations/Library/MusicManager.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Linq;
@@ -89,10 +91,9 @@ namespace Emby.Server.Implementations.Library
Limit = 200,
- OrderBy = new[] { new ValueTuple(ItemSortBy.Random, SortOrder.Ascending) },
+ OrderBy = new[] { (ItemSortBy.Random, SortOrder.Ascending) },
DtoOptions = dtoOptions
-
});
}
diff --git a/Emby.Server.Implementations/Library/PathExtensions.cs b/Emby.Server.Implementations/Library/PathExtensions.cs
index d3a81f622..4fdf73b77 100644
--- a/Emby.Server.Implementations/Library/PathExtensions.cs
+++ b/Emby.Server.Implementations/Library/PathExtensions.cs
@@ -3,6 +3,9 @@ using System.Text.RegularExpressions;
namespace Emby.Server.Implementations.Library
{
+ ///
+ /// Class providing extension methods for working with paths.
+ ///
public static class PathExtensions
{
///
@@ -32,6 +35,7 @@ namespace Emby.Server.Implementations.Library
int end = str.IndexOf(']', start);
return str.Substring(start, end - start);
}
+
// for imdbid we also accept pattern matching
if (string.Equals(attrib, "imdbid", StringComparison.OrdinalIgnoreCase))
{
diff --git a/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs
index e39192d28..9d4bd9e59 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.IO;
@@ -13,7 +15,7 @@ using MediaBrowser.Model.IO;
namespace Emby.Server.Implementations.Library.Resolvers.Audio
{
///
- /// Class AudioResolver
+ /// Class AudioResolver.
///
public class AudioResolver : ItemResolver, IMultiItemResolver
{
diff --git a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
index 3ce1da81a..4a2d210d5 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
@@ -13,7 +13,7 @@ using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library.Resolvers.Audio
{
///
- /// Class MusicAlbumResolver
+ /// Class MusicAlbumResolver.
///
public class MusicAlbumResolver : ItemResolver
{
@@ -21,6 +21,12 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
private readonly IFileSystem _fileSystem;
private readonly ILibraryManager _libraryManager;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The logger.
+ /// The file system.
+ /// The library manager.
public MusicAlbumResolver(ILogger logger, IFileSystem fileSystem, ILibraryManager libraryManager)
{
_logger = logger;
@@ -50,16 +56,25 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
return null;
}
- if (!args.IsDirectory) return null;
+ if (!args.IsDirectory)
+ {
+ return null;
+ }
// Avoid mis-identifying top folders
- if (args.HasParent()) return null;
- if (args.Parent.IsRoot) return null;
+ if (args.HasParent())
+ {
+ return null;
+ }
+
+ if (args.Parent.IsRoot)
+ {
+ return null;
+ }
return IsMusicAlbum(args) ? new MusicAlbum() : null;
}
-
///
/// Determine if the supplied file data points to a music album
///
@@ -78,8 +93,11 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
// Args points to an album if parent is an Artist folder or it directly contains music
if (args.IsDirectory)
{
- //if (args.Parent is MusicArtist) return true; //saves us from testing children twice
- if (ContainsMusic(args.FileSystemChildren, true, args.DirectoryService, _logger, _fileSystem, args.GetLibraryOptions(), _libraryManager)) return true;
+ // if (args.Parent is MusicArtist) return true; //saves us from testing children twice
+ if (ContainsMusic(args.FileSystemChildren, true, args.DirectoryService, _logger, _fileSystem, args.GetLibraryOptions(), _libraryManager))
+ {
+ return true;
+ }
}
return false;
@@ -88,7 +106,8 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
///
/// Determine if the supplied list contains what we should consider music
///
- private bool ContainsMusic(IEnumerable list,
+ private bool ContainsMusic(
+ IEnumerable list,
bool allowSubfolders,
IDirectoryService directoryService,
ILogger logger,
diff --git a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
index 74e9b8304..ee7e84929 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
@@ -11,7 +11,7 @@ using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library.Resolvers.Audio
{
///
- /// Class MusicArtistResolver
+ /// Class MusicArtistResolver.
///
public class MusicArtistResolver : ItemResolver
{
@@ -20,6 +20,13 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
private readonly ILibraryManager _libraryManager;
private readonly IServerConfigurationManager _config;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The logger.
+ /// The file system.
+ /// The library manager.
+ /// The configuration manager.
public MusicArtistResolver(ILogger logger, IFileSystem fileSystem, ILibraryManager libraryManager, IServerConfigurationManager config)
{
_logger = logger;
@@ -41,7 +48,10 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
/// MusicArtist.
protected override MusicArtist Resolve(ItemResolveArgs args)
{
- if (!args.IsDirectory) return null;
+ if (!args.IsDirectory)
+ {
+ return null;
+ }
// Don't allow nested artists
if (args.HasParent() || args.HasParent())
@@ -79,6 +89,5 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
// If we contain an album assume we are an artist folder
return args.FileSystemChildren.Where(i => i.IsDirectory).Any(i => albumResolver.IsMusicAlbum(i.FullName, directoryService, args.GetLibraryOptions())) ? new MusicArtist() : null;
}
-
}
}
diff --git a/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs b/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs
index 541b13cbe..c4bb861b8 100644
--- a/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.IO;
using System.Linq;
@@ -10,7 +12,7 @@ using MediaBrowser.Model.Entities;
namespace Emby.Server.Implementations.Library.Resolvers
{
///
- /// Resolves a Path into a Video or Video subclass
+ /// Resolves a Path into a Video or Video subclass.
///
///
public abstract class BaseVideoResolver : MediaBrowser.Controller.Resolvers.ItemResolver
diff --git a/Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs
index f22554ee5..0b93ebeb8 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.IO;
using System.Linq;
@@ -7,18 +9,10 @@ using MediaBrowser.Model.Entities;
namespace Emby.Server.Implementations.Library.Resolvers.Books
{
- ///
- ///
- ///
public class BookResolver : MediaBrowser.Controller.Resolvers.ItemResolver
{
private readonly string[] _validExtensions = { ".pdf", ".epub", ".mobi", ".cbr", ".cbz", ".azw3" };
- ///
- ///
- ///
- ///
- ///
protected override Book Resolve(ItemResolveArgs args)
{
var collectionType = args.GetCollectionType();
@@ -47,11 +41,6 @@ namespace Emby.Server.Implementations.Library.Resolvers.Books
return null;
}
- ///
- ///
- ///
- ///
- ///
private Book GetBook(ItemResolveArgs args)
{
var bookFiles = args.FileSystemChildren.Where(f =>
diff --git a/Emby.Server.Implementations/Library/Resolvers/FolderResolver.cs b/Emby.Server.Implementations/Library/Resolvers/FolderResolver.cs
index e48b6c967..7dbce7a6e 100644
--- a/Emby.Server.Implementations/Library/Resolvers/FolderResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/FolderResolver.cs
@@ -5,7 +5,7 @@ using MediaBrowser.Controller.Resolvers;
namespace Emby.Server.Implementations.Library.Resolvers
{
///
- /// Class FolderResolver
+ /// Class FolderResolver.
///
public class FolderResolver : FolderResolver
{
@@ -32,7 +32,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
}
///
- /// Class FolderResolver
+ /// Class FolderResolver.
///
/// The type of the T item type.
public abstract class FolderResolver : ItemResolver
diff --git a/Emby.Server.Implementations/Library/Resolvers/ItemResolver.cs b/Emby.Server.Implementations/Library/Resolvers/ItemResolver.cs
index a6db40714..32ccc7fdd 100644
--- a/Emby.Server.Implementations/Library/Resolvers/ItemResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/ItemResolver.cs
@@ -5,7 +5,7 @@ using MediaBrowser.Controller.Resolvers;
namespace Emby.Server.Implementations.Library.Resolvers
{
///
- /// Class ItemResolver
+ /// Class ItemResolver.
///
///
public abstract class ItemResolver : IItemResolver
diff --git a/Emby.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs
index 922bd4bbb..e4bc4a469 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs
@@ -4,12 +4,11 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Extensions;
namespace Emby.Server.Implementations.Library.Resolvers.Movies
{
///
- /// Class BoxSetResolver
+ /// Class BoxSetResolver.
///
public class BoxSetResolver : FolderResolver
{
@@ -63,7 +62,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
/// The item.
private static void SetProviderIdFromPath(BaseItem item)
{
- //we need to only look at the name of this actual item (not parents)
+ // we need to only look at the name of this actual item (not parents)
var justName = Path.GetFileName(item.Path);
var id = justName.GetAttributeValue("tmdbid");
diff --git a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
index 1b63b00a3..6c7690055 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
@@ -17,7 +17,7 @@ using MediaBrowser.Model.IO;
namespace Emby.Server.Implementations.Library.Resolvers.Movies
{
///
- /// Class MovieResolver
+ /// Class MovieResolver.
///
public class MovieResolver : BaseVideoResolver
/// The library manager.
+ /// The logger.
+ /// The item repository.
public ArtistsPostScanTask(ILibraryManager libraryManager, ILogger logger, IItemRepository itemRepo)
{
_libraryManager = libraryManager;
diff --git a/Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs b/Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs
index d06cda177..1497f4a3a 100644
--- a/Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs
+++ b/Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs
@@ -12,17 +12,17 @@ using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library.Validators
{
///
- /// Class ArtistsValidator
+ /// Class ArtistsValidator.
///
public class ArtistsValidator
{
///
- /// The _library manager
+ /// The library manager.
///
private readonly ILibraryManager _libraryManager;
///
- /// The _logger
+ /// The logger.
///
private readonly ILogger _logger;
private readonly IItemRepository _itemRepo;
diff --git a/Emby.Server.Implementations/Library/Validators/GenresPostScanTask.cs b/Emby.Server.Implementations/Library/Validators/GenresPostScanTask.cs
index 3bc5c2fb2..06d1dd89d 100644
--- a/Emby.Server.Implementations/Library/Validators/GenresPostScanTask.cs
+++ b/Emby.Server.Implementations/Library/Validators/GenresPostScanTask.cs
@@ -7,6 +7,9 @@ using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library.Validators
{
+ ///
+ /// Class GenresPostScanTask.
+ ///
public class GenresPostScanTask : ILibraryPostScanTask
{
///
diff --git a/Emby.Server.Implementations/Library/Validators/GenresValidator.cs b/Emby.Server.Implementations/Library/Validators/GenresValidator.cs
index f8459c61f..b0cd5f87a 100644
--- a/Emby.Server.Implementations/Library/Validators/GenresValidator.cs
+++ b/Emby.Server.Implementations/Library/Validators/GenresValidator.cs
@@ -7,19 +7,28 @@ using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library.Validators
{
- class GenresValidator
+ ///
+ /// Class GenresValidator.
+ ///
+ public class GenresValidator
{
///
- /// The _library manager
+ /// The library manager.
///
private readonly ILibraryManager _libraryManager;
private readonly IItemRepository _itemRepo;
///
- /// The _logger
+ /// The logger.
///
private readonly ILogger _logger;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The library manager.
+ /// The logger.
+ /// The item repository.
public GenresValidator(ILibraryManager libraryManager, ILogger logger, IItemRepository itemRepo)
{
_libraryManager = libraryManager;
diff --git a/Emby.Server.Implementations/Library/Validators/MusicGenresPostScanTask.cs b/Emby.Server.Implementations/Library/Validators/MusicGenresPostScanTask.cs
index 9ac4bf761..58549e9d7 100644
--- a/Emby.Server.Implementations/Library/Validators/MusicGenresPostScanTask.cs
+++ b/Emby.Server.Implementations/Library/Validators/MusicGenresPostScanTask.cs
@@ -8,12 +8,12 @@ using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library.Validators
{
///
- /// Class MusicGenresPostScanTask
+ /// Class MusicGenresPostScanTask.
///
public class MusicGenresPostScanTask : ILibraryPostScanTask
{
///
- /// The _library manager
+ /// The library manager.
///
private readonly ILibraryManager _libraryManager;
private readonly ILogger _logger;
diff --git a/Emby.Server.Implementations/Library/Validators/MusicGenresValidator.cs b/Emby.Server.Implementations/Library/Validators/MusicGenresValidator.cs
index 710e5d043..5ee4ca72e 100644
--- a/Emby.Server.Implementations/Library/Validators/MusicGenresValidator.cs
+++ b/Emby.Server.Implementations/Library/Validators/MusicGenresValidator.cs
@@ -7,19 +7,28 @@ using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library.Validators
{
- class MusicGenresValidator
+ ///
+ /// Class MusicGenresValidator.
+ ///
+ public class MusicGenresValidator
{
///
- /// The _library manager
+ /// The library manager.
///
private readonly ILibraryManager _libraryManager;
///
- /// The _logger
+ /// The logger.
///
private readonly ILogger _logger;
private readonly IItemRepository _itemRepo;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The library manager.
+ /// The logger.
+ /// The item repository.
public MusicGenresValidator(ILibraryManager libraryManager, ILogger logger, IItemRepository itemRepo)
{
_libraryManager = libraryManager;
diff --git a/Emby.Server.Implementations/Library/Validators/PeopleValidator.cs b/Emby.Server.Implementations/Library/Validators/PeopleValidator.cs
index 137a010ec..8275c873a 100644
--- a/Emby.Server.Implementations/Library/Validators/PeopleValidator.cs
+++ b/Emby.Server.Implementations/Library/Validators/PeopleValidator.cs
@@ -32,6 +32,7 @@ namespace Emby.Server.Implementations.Library.Validators
///
/// The library manager.
/// The logger.
+ /// The file system.
public PeopleValidator(ILibraryManager libraryManager, ILogger logger, IFileSystem fileSystem)
{
_libraryManager = libraryManager;
diff --git a/Emby.Server.Implementations/Library/Validators/StudiosPostScanTask.cs b/Emby.Server.Implementations/Library/Validators/StudiosPostScanTask.cs
index 2efae0fe4..00899c336 100644
--- a/Emby.Server.Implementations/Library/Validators/StudiosPostScanTask.cs
+++ b/Emby.Server.Implementations/Library/Validators/StudiosPostScanTask.cs
@@ -8,12 +8,12 @@ using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library.Validators
{
///
- /// Class MusicGenresPostScanTask
+ /// Class MusicGenresPostScanTask.
///
public class StudiosPostScanTask : ILibraryPostScanTask
{
///
- /// The _library manager
+ /// The _library manager.
///
private readonly ILibraryManager _libraryManager;
@@ -25,7 +25,7 @@ namespace Emby.Server.Implementations.Library.Validators
///
/// The library manager.
/// The logger.
- /// Th item repository.
+ /// The item repository.
public StudiosPostScanTask(ILibraryManager libraryManager, ILogger logger, IItemRepository itemRepo)
{
_libraryManager = libraryManager;
diff --git a/Emby.Server.Implementations/Library/Validators/StudiosValidator.cs b/Emby.Server.Implementations/Library/Validators/StudiosValidator.cs
index 93ded9e7b..15e7a0dbb 100644
--- a/Emby.Server.Implementations/Library/Validators/StudiosValidator.cs
+++ b/Emby.Server.Implementations/Library/Validators/StudiosValidator.cs
@@ -9,19 +9,29 @@ using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library.Validators
{
- class StudiosValidator
+ ///
+ /// Class StudiosValidator.
+ ///
+ public class StudiosValidator
{
///
- /// The _library manager
+ /// The library manager.
///
private readonly ILibraryManager _libraryManager;
private readonly IItemRepository _itemRepo;
+
///
- /// The _logger
+ /// The logger.
///
private readonly ILogger _logger;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The library manager.
+ /// The logger.
+ /// The item repository.
public StudiosValidator(ILibraryManager libraryManager, ILogger logger, IItemRepository itemRepo)
{
_libraryManager = libraryManager;
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index ef5928e48..3b6bfce6a 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -1582,15 +1582,15 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
return;
}
- var episodesToDelete = (librarySeries.GetItemList(new InternalItemsQuery
+ var episodesToDelete = librarySeries.GetItemList(new InternalItemsQuery
{
- OrderBy = new[] { new ValueTuple(ItemSortBy.DateCreated, SortOrder.Descending) },
+ OrderBy = new[] { (ItemSortBy.DateCreated, SortOrder.Descending) },
IsVirtualItem = false,
IsFolder = false,
Recursive = true,
DtoOptions = new DtoOptions(true)
- }))
+ })
.Where(i => i.IsFileProtocol && File.Exists(i.Path))
.Skip(seriesTimer.KeepUpTo - 1)
.ToList();
@@ -2260,7 +2260,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
},
MinStartDate = startDateUtc.AddMinutes(-3),
MaxStartDate = startDateUtc.AddMinutes(3),
- OrderBy = new[] { new ValueTuple(ItemSortBy.StartDate, SortOrder.Ascending) }
+ OrderBy = new[] { (ItemSortBy.StartDate, SortOrder.Ascending) }
};
if (!string.IsNullOrWhiteSpace(channelId))
diff --git a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
index 88693f22a..1f38de2d8 100644
--- a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
+++ b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
@@ -7,8 +7,8 @@ using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
-using Emby.XmlTv.Classes;
-using Emby.XmlTv.Entities;
+using Jellyfin.XmlTv;
+using Jellyfin.XmlTv.Entities;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
index d4bd598e3..ee7db1413 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -209,16 +209,16 @@ namespace Emby.Server.Implementations.LiveTv
var orderBy = internalQuery.OrderBy.ToList();
- orderBy.AddRange(query.SortBy.Select(i => new ValueTuple(i, query.SortOrder ?? SortOrder.Ascending)));
+ orderBy.AddRange(query.SortBy.Select(i => (i, query.SortOrder ?? SortOrder.Ascending)));
if (query.EnableFavoriteSorting)
{
- orderBy.Insert(0, new ValueTuple(ItemSortBy.IsFavoriteOrLiked, SortOrder.Descending));
+ orderBy.Insert(0, (ItemSortBy.IsFavoriteOrLiked, SortOrder.Descending));
}
if (!internalQuery.OrderBy.Any(i => string.Equals(i.Item1, ItemSortBy.SortName, StringComparison.OrdinalIgnoreCase)))
{
- orderBy.Add(new ValueTuple(ItemSortBy.SortName, SortOrder.Ascending));
+ orderBy.Add((ItemSortBy.SortName, SortOrder.Ascending));
}
internalQuery.OrderBy = orderBy.ToArray();
@@ -304,9 +304,12 @@ namespace Emby.Server.Implementations.LiveTv
}
private ILiveTvService GetService(string name)
- {
- return _services.FirstOrDefault(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase));
- }
+ => Array.Find(_services, x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase))
+ ?? throw new KeyNotFoundException(
+ string.Format(
+ CultureInfo.InvariantCulture,
+ "No service with the name '{0}' can be found.",
+ name));
private static void Normalize(MediaSourceInfo mediaSource, ILiveTvService service, bool isVideo)
{
@@ -772,22 +775,22 @@ namespace Emby.Server.Implementations.LiveTv
var topFolder = GetInternalLiveTvFolder(cancellationToken);
- if (query.OrderBy.Length == 0)
+ if (query.OrderBy.Count == 0)
{
if (query.IsAiring ?? false)
{
// Unless something else was specified, order by start date to take advantage of a specialized index
- query.OrderBy = new ValueTuple[]
+ query.OrderBy = new[]
{
- new ValueTuple(ItemSortBy.StartDate, SortOrder.Ascending)
+ (ItemSortBy.StartDate, SortOrder.Ascending)
};
}
else
{
// Unless something else was specified, order by start date to take advantage of a specialized index
- query.OrderBy = new ValueTuple[]
+ query.OrderBy = new[]
{
- new ValueTuple(ItemSortBy.StartDate, SortOrder.Ascending)
+ (ItemSortBy.StartDate, SortOrder.Ascending)
};
}
}
@@ -871,7 +874,7 @@ namespace Emby.Server.Implementations.LiveTv
IsSports = query.IsSports,
IsKids = query.IsKids,
EnableTotalRecordCount = query.EnableTotalRecordCount,
- OrderBy = new[] { new ValueTuple(ItemSortBy.StartDate, SortOrder.Ascending) },
+ OrderBy = new[] { (ItemSortBy.StartDate, SortOrder.Ascending) },
TopParentIds = new[] { topFolder.Id },
DtoOptions = options,
GenreIds = query.GenreIds
@@ -1396,7 +1399,7 @@ namespace Emby.Server.Implementations.LiveTv
IsVirtualItem = false,
Limit = limit,
StartIndex = query.StartIndex,
- OrderBy = new[] { new ValueTuple(ItemSortBy.DateCreated, SortOrder.Descending) },
+ OrderBy = new[] { (ItemSortBy.DateCreated, SortOrder.Descending) },
EnableTotalRecordCount = query.EnableTotalRecordCount,
IncludeItemTypes = includeItemTypes.ToArray(),
ExcludeItemTypes = excludeItemTypes.ToArray(),
@@ -1894,7 +1897,7 @@ namespace Emby.Server.Implementations.LiveTv
MaxStartDate = now,
MinEndDate = now,
Limit = channelIds.Length,
- OrderBy = new[] { new ValueTuple(ItemSortBy.StartDate, SortOrder.Ascending) },
+ OrderBy = new[] { (ItemSortBy.StartDate, SortOrder.Ascending) },
TopParentIds = new[] { GetInternalLiveTvFolder(CancellationToken.None).Id },
DtoOptions = options
diff --git a/Emby.Server.Implementations/Localization/Core/bg-BG.json b/Emby.Server.Implementations/Localization/Core/bg-BG.json
index bfe32a6c2..46c10d912 100644
--- a/Emby.Server.Implementations/Localization/Core/bg-BG.json
+++ b/Emby.Server.Implementations/Localization/Core/bg-BG.json
@@ -5,13 +5,13 @@
"Artists": "Изпълнители",
"AuthenticationSucceededWithUserName": "{0} се удостовери успешно",
"Books": "Книги",
- "CameraImageUploadedFrom": "",
+ "CameraImageUploadedFrom": "Нова снимка от камера беше качена от {0}",
"Channels": "Канали",
"ChapterNameValue": "Глава {0}",
"Collections": "Колекции",
"DeviceOfflineWithName": "{0} се разкачи",
"DeviceOnlineWithName": "{0} е свързан",
- "FailedLoginAttemptWithUserName": "",
+ "FailedLoginAttemptWithUserName": "Неуспешен опит за влизане от {0}",
"Favorites": "Любими",
"Folders": "Папки",
"Genres": "Жанрове",
diff --git a/Emby.Server.Implementations/Localization/Core/el.json b/Emby.Server.Implementations/Localization/Core/el.json
index 3589a4893..580b42330 100644
--- a/Emby.Server.Implementations/Localization/Core/el.json
+++ b/Emby.Server.Implementations/Localization/Core/el.json
@@ -3,7 +3,7 @@
"AppDeviceValues": "Εφαρμογή: {0}, Συσκευή: {1}",
"Application": "Εφαρμογή",
"Artists": "Καλλιτέχνες",
- "AuthenticationSucceededWithUserName": "Ο χρήστης {0} επαληθεύτηκε με επιτυχία",
+ "AuthenticationSucceededWithUserName": "Ο χρήστης {0} επαληθεύτηκε επιτυχώς",
"Books": "Βιβλία",
"CameraImageUploadedFrom": "Μια νέα εικόνα κάμερας έχει αποσταλεί από {0}",
"Channels": "Κανάλια",
diff --git a/Emby.Server.Implementations/Localization/Core/is.json b/Emby.Server.Implementations/Localization/Core/is.json
index 0967ef424..c3b5211b8 100644
--- a/Emby.Server.Implementations/Localization/Core/is.json
+++ b/Emby.Server.Implementations/Localization/Core/is.json
@@ -1 +1,78 @@
-{}
+{
+ "LabelIpAddressValue": "IP tala: {0}",
+ "ItemRemovedWithName": "{0} var fjarlægt úr safninu",
+ "ItemAddedWithName": "{0} var bætt í safnið",
+ "Inherit": "Erfa",
+ "HomeVideos": "Myndbönd að heiman",
+ "HeaderRecordingGroups": "Upptökuhópar",
+ "HeaderNextUp": "Næst á dagskrá",
+ "HeaderLiveTV": "Sjónvarp í beinni útsendingu",
+ "HeaderFavoriteSongs": "Uppáhalds Lög",
+ "HeaderFavoriteShows": "Uppáhalds Sjónvarpsþættir",
+ "HeaderFavoriteEpisodes": "Uppáhalds Þættir",
+ "HeaderFavoriteArtists": "Uppáhalds Listamenn",
+ "HeaderFavoriteAlbums": "Uppáhalds Plötur",
+ "HeaderContinueWatching": "Halda áfram að horfa",
+ "HeaderCameraUploads": "Myndavéla upphal",
+ "HeaderAlbumArtists": "Höfundur plötu",
+ "Genres": "Tegundir",
+ "Folders": "Möppur",
+ "Favorites": "Uppáhalds",
+ "FailedLoginAttemptWithUserName": "{0} reyndi að auðkenna sig",
+ "DeviceOnlineWithName": "{0} hefur tengst",
+ "DeviceOfflineWithName": "{0} hefur aftengst",
+ "Collections": "Söfn",
+ "ChapterNameValue": "Kafli {0}",
+ "Channels": "Stöðvar",
+ "CameraImageUploadedFrom": "Ný ljósmynd frá myndavél hefur verið hlaðið upp frá {0}",
+ "Books": "Bækur",
+ "AuthenticationSucceededWithUserName": "{0} náði að auðkennast",
+ "Artists": "Listamaður",
+ "Application": "Forrit",
+ "AppDeviceValues": "Snjallforrit: {0}, Tæki: {1}",
+ "Albums": "Plötur",
+ "Plugin": "Viðbót",
+ "Photos": "Myndir",
+ "NotificationOptionVideoPlaybackStopped": "Myndbandafspilun stöðvuð",
+ "NotificationOptionVideoPlayback": "Myndbandafspilun hafin",
+ "NotificationOptionUserLockedOut": "Notandi læstur úti",
+ "NotificationOptionServerRestartRequired": "Endurræsing miðlara nauðsynileg",
+ "NotificationOptionPluginUpdateInstalled": "Viðbótar uppfærsla uppsett",
+ "NotificationOptionPluginUninstalled": "Viðbót fjarlægð",
+ "NotificationOptionPluginInstalled": "Viðbót settur upp",
+ "NotificationOptionPluginError": "Bilun í viðbót",
+ "NotificationOptionInstallationFailed": "Uppsetning tókst ekki",
+ "NotificationOptionCameraImageUploaded": "Myndavélarmynd hlaðið upp",
+ "NotificationOptionAudioPlaybackStopped": "Hljóðafspilun stöðvuð",
+ "NotificationOptionAudioPlayback": "Hljóðafspilun hafin",
+ "NotificationOptionApplicationUpdateInstalled": "Uppfærsla uppsett",
+ "NotificationOptionApplicationUpdateAvailable": "Uppfærsla í boði",
+ "NameSeasonUnknown": "Sería óþekkt",
+ "NameSeasonNumber": "Sería {0}",
+ "MixedContent": "Blandað efni",
+ "MessageServerConfigurationUpdated": "Stillingar miðlarans hefur verið uppfærð",
+ "MessageApplicationUpdatedTo": "Jellyfin Server hefur verið uppfærður í {0}",
+ "MessageApplicationUpdated": "Jellyfin Server hefur verið uppfærður",
+ "Latest": "Nýjasta",
+ "LabelRunningTimeValue": "Keyrslutími kerfis: {0}",
+ "User": "Notandi",
+ "System": "Kerfi",
+ "NotificationOptionNewLibraryContent": "Nýju efni bætt við",
+ "NewVersionIsAvailable": "Ný útgáfa af Jellyfin Server er fáanleg til niðurhals.",
+ "NameInstallFailed": "{0} uppsetning mistókst",
+ "MusicVideos": "Tónlistarmyndbönd",
+ "Music": "Tónlist",
+ "Movies": "Kvikmyndir",
+ "UserDeletedWithName": "Notanda {0} hefur verið eytt",
+ "UserCreatedWithName": "Notandi {0} hefur verið stofnaður",
+ "TvShows": "Þættir",
+ "Sync": "Samstilla",
+ "Songs": "Lög",
+ "ServerNameNeedsToBeRestarted": "{0} þarf að endurræsa",
+ "ScheduledTaskStartedWithName": "{0} hafin",
+ "ScheduledTaskFailedWithName": "{0} mistókst",
+ "PluginUpdatedWithName": "{0} var uppfært",
+ "PluginUninstalledWithName": "{0} var fjarlægt",
+ "PluginInstalledWithName": "{0} var sett upp",
+ "NotificationOptionTaskFailed": "Tímasett verkefni mistókst"
+}
diff --git a/Emby.Server.Implementations/Localization/Core/ko.json b/Emby.Server.Implementations/Localization/Core/ko.json
index 3d2350c07..0320a0a1b 100644
--- a/Emby.Server.Implementations/Localization/Core/ko.json
+++ b/Emby.Server.Implementations/Localization/Core/ko.json
@@ -5,13 +5,13 @@
"Artists": "아티스트",
"AuthenticationSucceededWithUserName": "{0}이 성공적으로 인증됨",
"Books": "도서",
- "CameraImageUploadedFrom": "{0}에서 새로운 카메라 이미지가 업로드되었습니다",
+ "CameraImageUploadedFrom": "{0}에서 새로운 카메라 이미지가 업로드됨",
"Channels": "채널",
"ChapterNameValue": "챕터 {0}",
"Collections": "컬렉션",
- "DeviceOfflineWithName": "{0} 연결 끊김",
- "DeviceOnlineWithName": "{0} 연결됨",
- "FailedLoginAttemptWithUserName": "{0} 로그인 실패",
+ "DeviceOfflineWithName": "{0}의 연결 끊김",
+ "DeviceOnlineWithName": "{0}이 연결됨",
+ "FailedLoginAttemptWithUserName": "{0}에서 로그인 실패",
"Favorites": "즐겨찾기",
"Folders": "폴더",
"Genres": "장르",
diff --git a/Emby.Server.Implementations/Localization/Core/nl.json b/Emby.Server.Implementations/Localization/Core/nl.json
index 637e514ed..4423b7f98 100644
--- a/Emby.Server.Implementations/Localization/Core/nl.json
+++ b/Emby.Server.Implementations/Localization/Core/nl.json
@@ -5,10 +5,10 @@
"Artists": "Artiesten",
"AuthenticationSucceededWithUserName": "{0} is succesvol geverifieerd",
"Books": "Boeken",
- "CameraImageUploadedFrom": "Er is een nieuwe foto toegevoegd via {0}",
+ "CameraImageUploadedFrom": "Er is een nieuwe foto toegevoegd van {0}",
"Channels": "Kanalen",
"ChapterNameValue": "Hoofdstuk {0}",
- "Collections": "Collecties",
+ "Collections": "Verzamelingen",
"DeviceOfflineWithName": "{0} heeft de verbinding verbroken",
"DeviceOnlineWithName": "{0} is verbonden",
"FailedLoginAttemptWithUserName": "Mislukte aanmeld poging van {0}",
@@ -58,7 +58,7 @@
"NotificationOptionPluginUpdateInstalled": "Plug-in-update geïnstalleerd",
"NotificationOptionServerRestartRequired": "Server herstart nodig",
"NotificationOptionTaskFailed": "Geplande taak mislukt",
- "NotificationOptionUserLockedOut": "Gebruikersaccount vergrendeld",
+ "NotificationOptionUserLockedOut": "Gebruiker is vergrendeld",
"NotificationOptionVideoPlayback": "Video gestart",
"NotificationOptionVideoPlaybackStopped": "Video gestopt",
"Photos": "Foto's",
diff --git a/Emby.Server.Implementations/Localization/Core/pt-BR.json b/Emby.Server.Implementations/Localization/Core/pt-BR.json
index faa8499b8..41a389e3b 100644
--- a/Emby.Server.Implementations/Localization/Core/pt-BR.json
+++ b/Emby.Server.Implementations/Localization/Core/pt-BR.json
@@ -1,7 +1,7 @@
{
"Albums": "Álbuns",
"AppDeviceValues": "App: {0}, Dispositivo: {1}",
- "Application": "Inscrição",
+ "Application": "Aplicativo",
"Artists": "Artistas",
"AuthenticationSucceededWithUserName": "{0} autenticado com sucesso",
"Books": "Livros",
@@ -10,7 +10,7 @@
"ChapterNameValue": "Capítulo {0}",
"Collections": "Coletâneas",
"DeviceOfflineWithName": "{0} se desconectou",
- "DeviceOnlineWithName": "{0} está conectado",
+ "DeviceOnlineWithName": "{0} se conectou",
"FailedLoginAttemptWithUserName": "Falha na tentativa de login de {0}",
"Favorites": "Favoritos",
"Folders": "Pastas",
@@ -24,7 +24,7 @@
"HeaderFavoriteShows": "Séries Favoritas",
"HeaderFavoriteSongs": "Músicas Favoritas",
"HeaderLiveTV": "TV ao Vivo",
- "HeaderNextUp": "Próximos",
+ "HeaderNextUp": "A Seguir",
"HeaderRecordingGroups": "Grupos de Gravação",
"HomeVideos": "Vídeos caseiros",
"Inherit": "Herdar",
@@ -40,16 +40,16 @@
"MixedContent": "Conteúdo misto",
"Movies": "Filmes",
"Music": "Música",
- "MusicVideos": "Clipes",
+ "MusicVideos": "Videoclipes",
"NameInstallFailed": "A instalação de {0} falhou",
"NameSeasonNumber": "Temporada {0}",
"NameSeasonUnknown": "Temporada Desconhecida",
"NewVersionIsAvailable": "Uma nova versão do Servidor Jellyfin está disponível para download.",
- "NotificationOptionApplicationUpdateAvailable": "Atualização de aplicativo disponível",
- "NotificationOptionApplicationUpdateInstalled": "Atualização de aplicativo instalada",
+ "NotificationOptionApplicationUpdateAvailable": "Atualização do aplicativo disponível",
+ "NotificationOptionApplicationUpdateInstalled": "Atualização do aplicativo instalada",
"NotificationOptionAudioPlayback": "Reprodução de áudio iniciada",
"NotificationOptionAudioPlaybackStopped": "Reprodução de áudio parada",
- "NotificationOptionCameraImageUploaded": "Imagem de câmera enviada",
+ "NotificationOptionCameraImageUploaded": "Imagem da câmera enviada",
"NotificationOptionInstallationFailed": "Falha na instalação",
"NotificationOptionNewLibraryContent": "Novo conteúdo adicionado",
"NotificationOptionPluginError": "Falha de plugin",
@@ -73,7 +73,7 @@
"ServerNameNeedsToBeRestarted": "O servidor {0} precisa ser reiniciado",
"Shows": "Séries",
"Songs": "Músicas",
- "StartupEmbyServerIsLoading": "O Servidor Jellyfin está carregando. Por favor tente novamente em breve.",
+ "StartupEmbyServerIsLoading": "O Servidor Jellyfin está carregando. Por favor, tente novamente mais tarde.",
"SubtitleDownloadFailureForItem": "Download de legendas falhou para {0}",
"SubtitleDownloadFailureFromForItem": "Houve um problema ao baixar as legendas de {0} para {1}",
"SubtitlesDownloadedForItem": "Legendas baixadas para {0}",
@@ -86,12 +86,12 @@
"UserDownloadingItemWithValues": "{0} está baixando {1}",
"UserLockedOutWithName": "Usuário {0} foi bloqueado",
"UserOfflineFromDevice": "{0} se desconectou de {1}",
- "UserOnlineFromDevice": "{0} está ativo em {1}",
+ "UserOnlineFromDevice": "{0} está online em {1}",
"UserPasswordChangedWithName": "A senha foi alterada para o usuário {0}",
"UserPolicyUpdatedWithName": "A política de usuário foi atualizada para {0}",
- "UserStartedPlayingItemWithValues": "{0} iniciou a reprodução de {1}",
- "UserStoppedPlayingItemWithValues": "{0} parou de reproduzir {1}",
- "ValueHasBeenAddedToLibrary": "{0} foi adicionado a sua biblioteca",
+ "UserStartedPlayingItemWithValues": "{0} está reproduzindo {1} em {2}",
+ "UserStoppedPlayingItemWithValues": "{0} parou de reproduzir {1} em {2}",
+ "ValueHasBeenAddedToLibrary": "{0} foi adicionado à sua biblioteca de mídia",
"ValueSpecialEpisodeName": "Especial - {0}",
"VersionNumber": "Versão {0}"
}
diff --git a/Emby.Server.Implementations/Localization/Core/ru.json b/Emby.Server.Implementations/Localization/Core/ru.json
index 0ad4b37aa..7cf957a94 100644
--- a/Emby.Server.Implementations/Localization/Core/ru.json
+++ b/Emby.Server.Implementations/Localization/Core/ru.json
@@ -1,11 +1,11 @@
{
"Albums": "Альбомы",
- "AppDeviceValues": "Прил.: {0}, Устр.: {1}",
+ "AppDeviceValues": "Приложение.: {0}, Устройство.: {1}",
"Application": "Приложение",
"Artists": "Исполнители",
"AuthenticationSucceededWithUserName": "{0} - авторизация успешна",
- "Books": "Литература",
- "CameraImageUploadedFrom": "Новое фото было выложено с камеры {0}",
+ "Books": "Книги",
+ "CameraImageUploadedFrom": "Новое фото загружено с камеры {0}",
"Channels": "Каналы",
"ChapterNameValue": "Сцена {0}",
"Collections": "Коллекции",
diff --git a/Emby.Server.Implementations/Localization/Core/sk.json b/Emby.Server.Implementations/Localization/Core/sk.json
index 75eecbe3e..9bac305a2 100644
--- a/Emby.Server.Implementations/Localization/Core/sk.json
+++ b/Emby.Server.Implementations/Localization/Core/sk.json
@@ -1,6 +1,6 @@
{
"Albums": "Albumy",
- "AppDeviceValues": "Apka: {0}, Zariadenie: {1}",
+ "AppDeviceValues": "Aplikácia: {0}, Zariadenie: {1}",
"Application": "Aplikácia",
"Artists": "Umelci",
"AuthenticationSucceededWithUserName": "{0} úspešne overený",
@@ -8,7 +8,7 @@
"CameraImageUploadedFrom": "Z {0} bola nahraná nová fotografia",
"Channels": "Kanály",
"ChapterNameValue": "Kapitola {0}",
- "Collections": "Zbierky",
+ "Collections": "Kolekcie",
"DeviceOfflineWithName": "{0} sa odpojil",
"DeviceOnlineWithName": "{0} je pripojený",
"FailedLoginAttemptWithUserName": "Neúspešný pokus o prihlásenie z {0}",
@@ -22,7 +22,7 @@
"HeaderFavoriteArtists": "Obľúbení umelci",
"HeaderFavoriteEpisodes": "Obľúbené epizódy",
"HeaderFavoriteShows": "Obľúbené seriály",
- "HeaderFavoriteSongs": "Obľúbené pesničky",
+ "HeaderFavoriteSongs": "Obľúbené piesne",
"HeaderLiveTV": "Živá TV",
"HeaderNextUp": "Nasleduje",
"HeaderRecordingGroups": "Skupiny nahrávok",
@@ -34,7 +34,7 @@
"LabelRunningTimeValue": "Dĺžka: {0}",
"Latest": "Najnovšie",
"MessageApplicationUpdated": "Jellyfin Server bol aktualizovaný",
- "MessageApplicationUpdatedTo": "Jellyfin Server bol aktualizový na {0}",
+ "MessageApplicationUpdatedTo": "Jellyfin Server bol aktualizový na verziu {0}",
"MessageNamedServerConfigurationUpdatedWithValue": "Sekcia {0} konfigurácie servera bola aktualizovaná",
"MessageServerConfigurationUpdated": "Konfigurácia servera bola aktualizovaná",
"MixedContent": "Zmiešaný obsah",
@@ -42,23 +42,23 @@
"Music": "Hudba",
"MusicVideos": "Hudobné videá",
"NameInstallFailed": "Inštalácia {0} zlyhala",
- "NameSeasonNumber": "Sezóna {0}",
- "NameSeasonUnknown": "Neznáma sezóna",
- "NewVersionIsAvailable": "Nová verzia Jellyfin Server je dostupná na stiahnutie.",
- "NotificationOptionApplicationUpdateAvailable": "Je dostupná aktualizácia aplikácie",
+ "NameSeasonNumber": "Séria {0}",
+ "NameSeasonUnknown": "Neznáma séria",
+ "NewVersionIsAvailable": "Nová verzia Jellyfin Serveru je dostupná na stiahnutie.",
+ "NotificationOptionApplicationUpdateAvailable": "Aktualizácia aplikácie je dostupná",
"NotificationOptionApplicationUpdateInstalled": "Aktualizácia aplikácie nainštalovaná",
- "NotificationOptionAudioPlayback": "Spustené prehrávanie audia",
- "NotificationOptionAudioPlaybackStopped": "Zastavené prehrávanie audia",
- "NotificationOptionCameraImageUploaded": "Nahraný obrázok z fotoaparátu",
+ "NotificationOptionAudioPlayback": "Prehrávanie audia bolo spustené",
+ "NotificationOptionAudioPlaybackStopped": "Prehrávanie audia bolo zastavené",
+ "NotificationOptionCameraImageUploaded": "Obrázok z fotoaparátu bol nahraný",
"NotificationOptionInstallationFailed": "Chyba inštalácie",
- "NotificationOptionNewLibraryContent": "Pridaný nový obsah",
+ "NotificationOptionNewLibraryContent": "Nový obsah bol pridaný",
"NotificationOptionPluginError": "Chyba rozšírenia",
"NotificationOptionPluginInstalled": "Rozšírenie nainštalované",
"NotificationOptionPluginUninstalled": "Rozšírenie odinštalované",
"NotificationOptionPluginUpdateInstalled": "Aktualizácia rozšírenia nainštalovaná",
"NotificationOptionServerRestartRequired": "Vyžaduje sa reštart servera",
"NotificationOptionTaskFailed": "Naplánovaná úloha zlyhala",
- "NotificationOptionUserLockedOut": "User locked out",
+ "NotificationOptionUserLockedOut": "Používateľ je uzamknutý",
"NotificationOptionVideoPlayback": "Spustené prehrávanie videa",
"NotificationOptionVideoPlaybackStopped": "Zastavené prehrávanie videa",
"Photos": "Fotky",
@@ -69,9 +69,9 @@
"PluginUpdatedWithName": "{0} bol aktualizovaný",
"ProviderValue": "Poskytovateľ: {0}",
"ScheduledTaskFailedWithName": "{0} zlyhalo",
- "ScheduledTaskStartedWithName": "{0} started",
+ "ScheduledTaskStartedWithName": "{0} zahájených",
"ServerNameNeedsToBeRestarted": "{0} vyžaduje reštart",
- "Shows": "Series",
+ "Shows": "Seriály",
"Songs": "Skladby",
"StartupEmbyServerIsLoading": "Jellyfin Server sa spúšťa. Skúste to prosím o chvíľu znova.",
"SubtitleDownloadFailureForItem": "Sťahovanie titulkov pre {0} zlyhalo",
@@ -84,11 +84,11 @@
"UserCreatedWithName": "Používateľ {0} bol vytvorený",
"UserDeletedWithName": "Používateľ {0} bol vymazaný",
"UserDownloadingItemWithValues": "{0} sťahuje {1}",
- "UserLockedOutWithName": "User {0} has been locked out",
+ "UserLockedOutWithName": "Používateľ {0} bol vymknutý",
"UserOfflineFromDevice": "{0} sa odpojil od {1}",
"UserOnlineFromDevice": "{0} je online z {1}",
"UserPasswordChangedWithName": "Heslo používateľa {0} zmenené",
- "UserPolicyUpdatedWithName": "User policy has been updated for {0}",
+ "UserPolicyUpdatedWithName": "Používateľské zásady pre {0} boli aktualizované",
"UserStartedPlayingItemWithValues": "{0} spustil prehrávanie {1}",
"UserStoppedPlayingItemWithValues": "{0} zastavil prehrávanie {1}",
"ValueHasBeenAddedToLibrary": "{0} bolo pridané do vašej knižnice médií",
diff --git a/Emby.Server.Implementations/Localization/Core/sv.json b/Emby.Server.Implementations/Localization/Core/sv.json
index fb2761a7d..744b0e2d3 100644
--- a/Emby.Server.Implementations/Localization/Core/sv.json
+++ b/Emby.Server.Implementations/Localization/Core/sv.json
@@ -5,7 +5,7 @@
"Artists": "Artister",
"AuthenticationSucceededWithUserName": "{0} har autentiserats",
"Books": "Böcker",
- "CameraImageUploadedFrom": "A new camera image has been uploaded from {0}",
+ "CameraImageUploadedFrom": "En ny kamerabild har laddats upp från {0}",
"Channels": "Kanaler",
"ChapterNameValue": "Kapitel {0}",
"Collections": "Samlingar",
@@ -16,7 +16,7 @@
"Folders": "Mappar",
"Genres": "Genrer",
"HeaderAlbumArtists": "Albumartister",
- "HeaderCameraUploads": "Camera Uploads",
+ "HeaderCameraUploads": "Kamera Uppladdningar",
"HeaderContinueWatching": "Fortsätt kolla på",
"HeaderFavoriteAlbums": "Favoritalbum",
"HeaderFavoriteArtists": "Favoritartister",
@@ -34,17 +34,17 @@
"LabelRunningTimeValue": "Speltid: {0}",
"Latest": "Senaste",
"MessageApplicationUpdated": "Jellyfin Server har uppdaterats",
- "MessageApplicationUpdatedTo": "Jellyfin Server has been updated to {0}",
+ "MessageApplicationUpdatedTo": "Jellyfin Server har uppgraderats till {0}",
"MessageNamedServerConfigurationUpdatedWithValue": "Serverinställningarna {0} har uppdaterats",
"MessageServerConfigurationUpdated": "Server konfigurationen har uppdaterats",
"MixedContent": "Blandat innehåll",
"Movies": "Filmer",
"Music": "Musik",
"MusicVideos": "Musikvideos",
- "NameInstallFailed": "{0} installation failed",
+ "NameInstallFailed": "{0} installationen misslyckades",
"NameSeasonNumber": "Säsong {0}",
"NameSeasonUnknown": "Okänd säsong",
- "NewVersionIsAvailable": "A new version of Jellyfin Server is available for download.",
+ "NewVersionIsAvailable": "En ny version av Jellyfin Server är klar för nedladdning.",
"NotificationOptionApplicationUpdateAvailable": "Ny programversion tillgänglig",
"NotificationOptionApplicationUpdateInstalled": "Programuppdatering installerad",
"NotificationOptionAudioPlayback": "Ljuduppspelning har påbörjats",
@@ -70,12 +70,12 @@
"ProviderValue": "Källa: {0}",
"ScheduledTaskFailedWithName": "{0} misslyckades",
"ScheduledTaskStartedWithName": "{0} startad",
- "ServerNameNeedsToBeRestarted": "{0} needs to be restarted",
+ "ServerNameNeedsToBeRestarted": "{0} behöver startas om",
"Shows": "Serier",
"Songs": "Låtar",
"StartupEmbyServerIsLoading": "Jellyfin server arbetar. Pröva igen inom kort.",
"SubtitleDownloadFailureForItem": "Nerladdning av undertexter för {0} misslyckades",
- "SubtitleDownloadFailureFromForItem": "Subtitles failed to download from {0} for {1}",
+ "SubtitleDownloadFailureFromForItem": "Undertexter misslyckades att ladda ner {0} för {1}",
"SubtitlesDownloadedForItem": "Undertexter har laddats ner till {0}",
"Sync": "Synk",
"System": "System",
@@ -91,7 +91,7 @@
"UserPolicyUpdatedWithName": "Användarpolicyn har uppdaterats för {0}",
"UserStartedPlayingItemWithValues": "{0} har börjat spela upp {1}",
"UserStoppedPlayingItemWithValues": "{0} har avslutat uppspelningen av {1}",
- "ValueHasBeenAddedToLibrary": "{0} has been added to your media library",
+ "ValueHasBeenAddedToLibrary": "{0} har blivit tillagd till ditt mediabibliotek",
"ValueSpecialEpisodeName": "Specialavsnitt - {0}",
"VersionNumber": "Version {0}"
}
diff --git a/Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs b/Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs
index cad66a80f..2dfe59088 100644
--- a/Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs
+++ b/Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs
@@ -62,7 +62,6 @@ namespace Emby.Server.Implementations.Playlists
return null;
})
.Where(i => i != null)
- .OrderBy(i => Guid.NewGuid())
.GroupBy(x => x.Id)
.Select(x => x.First())
.ToList();
@@ -84,7 +83,7 @@ namespace Emby.Server.Implementations.Playlists
{
Genres = new[] { item.Name },
IncludeItemTypes = new[] { typeof(MusicAlbum).Name, typeof(MusicVideo).Name, typeof(Audio).Name },
- OrderBy = new[] { new ValueTuple(ItemSortBy.Random, SortOrder.Ascending) },
+ OrderBy = new[] { (ItemSortBy.Random, SortOrder.Ascending) },
Limit = 4,
Recursive = true,
ImageTypes = new[] { ImageType.Primary },
@@ -108,7 +107,7 @@ namespace Emby.Server.Implementations.Playlists
{
Genres = new[] { item.Name },
IncludeItemTypes = new[] { typeof(Series).Name, typeof(Movie).Name },
- OrderBy = new[] { new ValueTuple(ItemSortBy.Random, SortOrder.Ascending) },
+ OrderBy = new[] { (ItemSortBy.Random, SortOrder.Ascending) },
Limit = 4,
Recursive = true,
ImageTypes = new[] { ImageType.Primary },
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteTranscodeFileTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteTranscodeFileTask.cs
index 72b524df0..f197734d4 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteTranscodeFileTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteTranscodeFileTask.cs
@@ -31,13 +31,13 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
}
///
- /// Creates the triggers that define when the task will run
+ /// Creates the triggers that define when the task will run.
///
/// IEnumerable{BaseTaskTrigger}.
public IEnumerable GetDefaultTriggers() => new List();
///
- /// Returns the task to be executed
+ /// Returns the task to be executed.
///
/// The cancellation token.
/// The progress.
@@ -52,9 +52,8 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
return Task.CompletedTask;
}
-
///
- /// Deletes the transcoded temp files from directory with a last write time less than a given date
+ /// Deletes the transcoded temp files from directory with a last write time less than a given date.
///
/// The task cancellation token.
/// The directory.
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs
index d1392e162..b1d513dd4 100644
--- a/Emby.Server.Implementations/Session/SessionManager.cs
+++ b/Emby.Server.Implementations/Session/SessionManager.cs
@@ -667,12 +667,9 @@ namespace Emby.Server.Implementations.Session
data.PlayCount++;
data.LastPlayedDate = DateTime.UtcNow;
- if (item.SupportsPlayedStatus)
+ if (item.SupportsPlayedStatus && !item.SupportsPositionTicksResume)
{
- if (!(item is Video))
- {
- data.Played = true;
- }
+ data.Played = true;
}
else
{
@@ -769,7 +766,6 @@ namespace Emby.Server.Implementations.Session
{
_userDataManager.SaveUserData(user, item, data, UserDataSaveReason.PlaybackProgress, CancellationToken.None);
}
-
}
private static bool UpdatePlaybackSettings(User user, PlaybackProgressInfo info, UserItemData data)
@@ -1061,7 +1057,7 @@ namespace Emby.Server.Implementations.Session
var session = GetSessionToRemoteControl(sessionId);
- var user = !session.UserId.Equals(Guid.Empty) ? _userManager.GetUserById(session.UserId) : null;
+ var user = session.UserId == Guid.Empty ? null : _userManager.GetUserById(session.UserId);
List items;
@@ -1086,7 +1082,7 @@ namespace Emby.Server.Implementations.Session
if (command.PlayCommand == PlayCommand.PlayShuffle)
{
- items = items.OrderBy(i => Guid.NewGuid()).ToList();
+ items.Shuffle();
command.PlayCommand = PlayCommand.PlayNow;
}
@@ -1100,28 +1096,27 @@ namespace Emby.Server.Implementations.Session
}
}
- if (user != null && command.ItemIds.Length == 1 && user.Configuration.EnableNextEpisodeAutoPlay)
+ if (user != null
+ && command.ItemIds.Length == 1
+ && user.Configuration.EnableNextEpisodeAutoPlay
+ && _libraryManager.GetItemById(command.ItemIds[0]) is Episode episode)
{
- var episode = _libraryManager.GetItemById(command.ItemIds[0]) as Episode;
- if (episode != null)
+ var series = episode.Series;
+ if (series != null)
{
- var series = episode.Series;
- if (series != null)
- {
- var episodes = series.GetEpisodes(
- user,
- new DtoOptions(false)
- {
- EnableImages = false
- })
- .Where(i => !i.IsVirtualItem)
- .SkipWhile(i => i.Id != episode.Id)
- .ToList();
+ var episodes = series.GetEpisodes(
+ user,
+ new DtoOptions(false)
+ {
+ EnableImages = false
+ })
+ .Where(i => !i.IsVirtualItem)
+ .SkipWhile(i => i.Id != episode.Id)
+ .ToList();
- if (episodes.Count > 0)
- {
- command.ItemIds = episodes.Select(i => i.Id).ToArray();
- }
+ if (episodes.Count > 0)
+ {
+ command.ItemIds = episodes.Select(i => i.Id).ToArray();
}
}
}
@@ -1146,7 +1141,7 @@ namespace Emby.Server.Implementations.Session
if (item == null)
{
_logger.LogError("A non-existant item Id {0} was passed into TranslateItemForPlayback", id);
- return new List();
+ return Array.Empty();
}
if (item is IItemByName byName)
@@ -1164,7 +1159,7 @@ namespace Emby.Server.Implementations.Session
}
},
IsVirtualItem = false,
- OrderBy = new ValueTuple[] { new ValueTuple(ItemSortBy.SortName, SortOrder.Ascending) }
+ OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) }
});
}
@@ -1185,12 +1180,11 @@ namespace Emby.Server.Implementations.Session
}
},
IsVirtualItem = false,
- OrderBy = new ValueTuple[] { new ValueTuple(ItemSortBy.SortName, SortOrder.Ascending) }
-
+ OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) }
});
}
- return new List { item };
+ return new[] { item };
}
private IEnumerable TranslateItemForInstantMix(Guid id, User user)
@@ -1395,6 +1389,12 @@ namespace Emby.Server.Implementations.Session
}
}
+ if (user == null)
+ {
+ AuthenticationFailed?.Invoke(this, new GenericEventArgs(request));
+ throw new SecurityException("Invalid user or password entered.");
+ }
+
if (enforcePassword)
{
user = await _userManager.AuthenticateUser(
@@ -1405,13 +1405,6 @@ namespace Emby.Server.Implementations.Session
true).ConfigureAwait(false);
}
- if (user == null)
- {
- AuthenticationFailed?.Invoke(this, new GenericEventArgs(request));
-
- throw new SecurityException("Invalid user or password entered.");
- }
-
var token = GetAuthorizationToken(user, request.DeviceId, request.App, request.AppVersion, request.DeviceName);
var session = LogSessionActivity(
diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs
index 09a5a0dca..2705e0628 100644
--- a/Emby.Server.Implementations/Updates/InstallationManager.cs
+++ b/Emby.Server.Implementations/Updates/InstallationManager.cs
@@ -141,8 +141,7 @@ namespace Emby.Server.Implementations.Updates
if (guid != Guid.Empty)
{
- var strGuid = guid.ToString("N", CultureInfo.InvariantCulture);
- availablePackages = availablePackages.Where(x => x.guid.Equals(strGuid, StringComparison.OrdinalIgnoreCase));
+ availablePackages = availablePackages.Where(x => Guid.Parse(x.guid) == guid);
}
return availablePackages;
diff --git a/Emby.Server.Implementations/UserViews/DynamicImageProvider.cs b/Emby.Server.Implementations/UserViews/DynamicImageProvider.cs
index f48520443..78ac95f85 100644
--- a/Emby.Server.Implementations/UserViews/DynamicImageProvider.cs
+++ b/Emby.Server.Implementations/UserViews/DynamicImageProvider.cs
@@ -86,20 +86,17 @@ namespace Emby.Server.Implementations.UserViews
{
return items
.Where(i => i.HasImage(ImageType.Primary) || i.HasImage(ImageType.Thumb))
- .OrderBy(i => Guid.NewGuid())
.ToList();
}
return items
.Where(i => i.HasImage(ImageType.Primary))
- .OrderBy(i => Guid.NewGuid())
.ToList();
}
protected override bool Supports(BaseItem item)
{
- var view = item as UserView;
- if (view != null)
+ if (item is UserView view)
{
return IsUsingCollectionStrip(view);
}
diff --git a/Emby.XmlTv/.gitattributes b/Emby.XmlTv/.gitattributes
deleted file mode 100644
index 1ff0c4230..000000000
--- a/Emby.XmlTv/.gitattributes
+++ /dev/null
@@ -1,63 +0,0 @@
-###############################################################################
-# Set default behavior to automatically normalize line endings.
-###############################################################################
-* text=auto
-
-###############################################################################
-# Set default behavior for command prompt diff.
-#
-# This is need for earlier builds of msysgit that does not have it on by
-# default for csharp files.
-# Note: This is only used by command line
-###############################################################################
-#*.cs diff=csharp
-
-###############################################################################
-# Set the merge driver for project and solution files
-#
-# Merging from the command prompt will add diff markers to the files if there
-# are conflicts (Merging from VS is not affected by the settings below, in VS
-# the diff markers are never inserted). Diff markers may cause the following
-# file extensions to fail to load in VS. An alternative would be to treat
-# these files as binary and thus will always conflict and require user
-# intervention with every merge. To do so, just uncomment the entries below
-###############################################################################
-#*.sln merge=binary
-#*.csproj merge=binary
-#*.vbproj merge=binary
-#*.vcxproj merge=binary
-#*.vcproj merge=binary
-#*.dbproj merge=binary
-#*.fsproj merge=binary
-#*.lsproj merge=binary
-#*.wixproj merge=binary
-#*.modelproj merge=binary
-#*.sqlproj merge=binary
-#*.wwaproj merge=binary
-
-###############################################################################
-# behavior for image files
-#
-# image files are treated as binary by default.
-###############################################################################
-#*.jpg binary
-#*.png binary
-#*.gif binary
-
-###############################################################################
-# diff behavior for common document formats
-#
-# Convert binary document formats to text before diffing them. This feature
-# is only available from the command line. Turn it on by uncommenting the
-# entries below.
-###############################################################################
-#*.doc diff=astextplain
-#*.DOC diff=astextplain
-#*.docx diff=astextplain
-#*.DOCX diff=astextplain
-#*.dot diff=astextplain
-#*.DOT diff=astextplain
-#*.pdf diff=astextplain
-#*.PDF diff=astextplain
-#*.rtf diff=astextplain
-#*.RTF diff=astextplain
diff --git a/Emby.XmlTv/.gitignore b/Emby.XmlTv/.gitignore
deleted file mode 100644
index b06e864a3..000000000
--- a/Emby.XmlTv/.gitignore
+++ /dev/null
@@ -1,212 +0,0 @@
-## Ignore Visual Studio temporary files, build results, and
-## files generated by popular Visual Studio add-ons.
-
-# User-specific files
-*.suo
-*.user
-*.userosscache
-*.sln.docstates
-
-# User-specific files (MonoDevelop/Xamarin Studio)
-*.userprefs
-
-# Build results
-[Dd]ebug/
-[Dd]ebugPublic/
-[Rr]elease/
-[Rr]eleases/
-x64/
-x86/
-build/
-bld/
-[Bb]in/
-[Oo]bj/
-
-# Visual Studio 2015 cache/options directory
-.vs/
-
-# MSTest test Results
-[Tt]est[Rr]esult*/
-[Bb]uild[Ll]og.*
-
-# NUNIT
-*.VisualState.xml
-TestResult.xml
-
-# Build Results of an ATL Project
-[Dd]ebugPS/
-[Rr]eleasePS/
-dlldata.c
-
-# DNX
-project.lock.json
-artifacts/
-
-*_i.c
-*_p.c
-*_i.h
-*.ilk
-*.meta
-*.obj
-*.pch
-*.pdb
-*.pgc
-*.pgd
-*.rsp
-*.sbr
-*.tlb
-*.tli
-*.tlh
-*.tmp
-*.tmp_proj
-*.log
-*.vspscc
-*.vssscc
-.builds
-*.pidb
-*.svclog
-*.scc
-
-# Chutzpah Test files
-_Chutzpah*
-
-# Visual C++ cache files
-ipch/
-*.aps
-*.ncb
-*.opensdf
-*.sdf
-*.cachefile
-
-# Visual Studio profiler
-*.psess
-*.vsp
-*.vspx
-
-# TFS 2012 Local Workspace
-$tf/
-
-# Guidance Automation Toolkit
-*.gpState
-
-# ReSharper is a .NET coding add-in
-_ReSharper*/
-*.[Rr]e[Ss]harper
-*.DotSettings.user
-
-# JustCode is a .NET coding add-in
-.JustCode
-
-# TeamCity is a build add-in
-_TeamCity*
-
-# DotCover is a Code Coverage Tool
-*.dotCover
-
-# NCrunch
-_NCrunch_*
-.*crunch*.local.xml
-
-# MightyMoose
-*.mm.*
-AutoTest.Net/
-
-# Web workbench (sass)
-.sass-cache/
-
-# Installshield output folder
-[Ee]xpress/
-
-# DocProject is a documentation generator add-in
-DocProject/buildhelp/
-DocProject/Help/*.HxT
-DocProject/Help/*.HxC
-DocProject/Help/*.hhc
-DocProject/Help/*.hhk
-DocProject/Help/*.hhp
-DocProject/Help/Html2
-DocProject/Help/html
-
-# Click-Once directory
-publish/
-
-# Publish Web Output
-*.[Pp]ublish.xml
-*.azurePubxml
-## TODO: Comment the next line if you want to checkin your
-## web deploy settings but do note that will include unencrypted
-## passwords
-#*.pubxml
-
-*.publishproj
-
-# NuGet Packages
-*.nupkg
-# The packages folder can be ignored because of Package Restore
-**/packages/*
-# except build/, which is used as an MSBuild target.
-!**/packages/build/
-# Uncomment if necessary however generally it will be regenerated when needed
-#!**/packages/repositories.config
-
-# Windows Azure Build Output
-csx/
-*.build.csdef
-
-# Windows Store app package directory
-AppPackages/
-
-# Visual Studio cache files
-# files ending in .cache can be ignored
-*.[Cc]ache
-# but keep track of directories ending in .cache
-!*.[Cc]ache/
-
-# Others
-ClientBin/
-[Ss]tyle[Cc]op.*
-~$*
-*~
-*.dbmdl
-*.dbproj.schemaview
-*.pfx
-*.publishsettings
-node_modules/
-orleans.codegen.cs
-
-# RIA/Silverlight projects
-Generated_Code/
-
-# Backup & report files from converting an old project file
-# to a newer Visual Studio version. Backup files are not needed,
-# because we have git ;-)
-_UpgradeReport_Files/
-Backup*/
-UpgradeLog*.XML
-UpgradeLog*.htm
-
-# SQL Server files
-*.mdf
-*.ldf
-
-# Business Intelligence projects
-*.rdl.data
-*.bim.layout
-*.bim_*.settings
-
-# Microsoft Fakes
-FakesAssemblies/
-
-# Node.js Tools for Visual Studio
-.ntvs_analysis.dat
-
-# Visual Studio 6 build log
-*.plg
-
-# Visual Studio 6 workspace options file
-*.opt
-
-# LightSwitch generated files
-GeneratedArtifacts/
-_Pvt_Extensions/
-ModelManifest.xml
diff --git a/Emby.XmlTv/Emby.XmlTv.Console/App.config b/Emby.XmlTv/Emby.XmlTv.Console/App.config
deleted file mode 100644
index 2d2a12d81..000000000
--- a/Emby.XmlTv/Emby.XmlTv.Console/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/Emby.XmlTv/Emby.XmlTv.Console/Classes/EntityExtensions.cs b/Emby.XmlTv/Emby.XmlTv.Console/Classes/EntityExtensions.cs
deleted file mode 100644
index 96e508f12..000000000
--- a/Emby.XmlTv/Emby.XmlTv.Console/Classes/EntityExtensions.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System;
-using System.Linq;
-using System.Text;
-
-using Emby.XmlTv.Entities;
-
-namespace Emby.XmlTv.Console.Classes
-{
- public static class EntityExtensions
- {
- public static string GetHeader(this string text)
- {
- var channelHeaderString = " " + text;
-
- var builder = new StringBuilder();
- builder.AppendLine("".PadRight(5 + channelHeaderString.Length + 5, Char.Parse("*")));
- builder.AppendLine("".PadRight(5, Char.Parse("*")) + channelHeaderString + "".PadRight(5, Char.Parse("*")));
- builder.AppendLine("".PadRight(5 + channelHeaderString.Length + 5, Char.Parse("*")));
-
- return builder.ToString();
- }
-
- public static string GetChannelDetail(this XmlTvChannel channel)
- {
- var builder = new StringBuilder();
- builder.AppendFormat("Id: {0}\r\n", channel.Id);
- builder.AppendFormat("Display-Name: {0}\r\n", channel.DisplayName);
- builder.AppendFormat("Url: {0}\r\n", channel.Url);
- builder.AppendFormat("Icon: {0}\r\n", channel.Icon != null ? channel.Icon.ToString() : string.Empty);
- builder.AppendLine("-------------------------------------------------------");
-
- return builder.ToString();
- }
-
- public static string GetProgrammeDetail(this XmlTvProgram programme, XmlTvChannel channel)
- {
- var builder = new StringBuilder();
- builder.AppendFormat("Channel: {0} - {1}\r\n", channel.Id, channel.DisplayName);
- builder.AppendFormat("Start Date: {0:G}\r\n", programme.StartDate);
- builder.AppendFormat("End Date: {0:G}\r\n", programme.EndDate);
- builder.AppendFormat("Name: {0}\r\n", programme.Title);
- builder.AppendFormat("Episode Detail: {0}\r\n", programme.Episode);
- builder.AppendFormat("Episode Title: {0}\r\n", programme.Episode.Title);
- builder.AppendFormat("Description: {0}\r\n", programme.Description);
- builder.AppendFormat("Categories: {0}\r\n", string.Join(", ", programme.Categories));
- builder.AppendFormat("Countries: {0}\r\n", string.Join(", ", programme.Countries));
- builder.AppendFormat("Credits: {0}\r\n", string.Join(", ", programme.Credits));
- builder.AppendFormat("Rating: {0}\r\n", programme.Rating);
- builder.AppendFormat("Star Rating: {0}\r\n", programme.StarRating.HasValue ? programme.StarRating.Value.ToString() : string.Empty);
- builder.AppendFormat("Previously Shown: {0:G}\r\n", programme.PreviouslyShown);
- builder.AppendFormat("Copyright Date: {0:G}\r\n", programme.CopyrightDate);
- builder.AppendFormat("Is Repeat: {0}\r\n", programme.IsPreviouslyShown);
- builder.AppendFormat("Icon: {0}\r\n", programme.Icon != null ? programme.Icon.ToString() : string.Empty);
- builder.AppendLine("-------------------------------------------------------");
- return builder.ToString();
- }
- }
-}
diff --git a/Emby.XmlTv/Emby.XmlTv.Console/Emby.XmlTv.Console.csproj b/Emby.XmlTv/Emby.XmlTv.Console/Emby.XmlTv.Console.csproj
deleted file mode 100644
index c10b28e82..000000000
--- a/Emby.XmlTv/Emby.XmlTv.Console/Emby.XmlTv.Console.csproj
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- {0d023565-5942-4d79-9098-a1b4b6665a40}
- Emby.XmlTv
-
-
-
- netcoreapp2.1
- false
-
-
-
diff --git a/Emby.XmlTv/Emby.XmlTv.Console/Program.cs b/Emby.XmlTv/Emby.XmlTv.Console/Program.cs
deleted file mode 100644
index 3e0c7d125..000000000
--- a/Emby.XmlTv/Emby.XmlTv.Console/Program.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-
-using Emby.XmlTv.Classes;
-using Emby.XmlTv.Console.Classes;
-using Emby.XmlTv.Entities;
-
-namespace Emby.XmlTv.Console
-{
- public class Program
- {
- static void Main(string[] args)
- {
- var filename = @"C:\Temp\QLD.GoldCoast.xml";
-
- if (args.Length == 1 && File.Exists(args[0]))
- {
- filename = args[0];
- }
-
- var timer = Stopwatch.StartNew();
- System.Console.WriteLine("Running XMLTv Parsing");
-
- var resultsFile = String.Format("C:\\Temp\\{0}_Results_{1:HHmmss}.txt",
- Path.GetFileNameWithoutExtension(filename),
- DateTimeOffset.UtcNow);
-
- System.Console.Write("Enter the language required: ");
- var lang = System.Console.ReadLine();
-
- ReadSourceXmlTvFile(filename, resultsFile, lang).Wait();
-
- System.Console.WriteLine("Completed in {0:g} - press any key to open the file...", timer.Elapsed);
- System.Console.ReadKey();
-
- Process.Start(resultsFile);
- }
-
- public static async Task ReadSourceXmlTvFile(string filename, string resultsFile, string lang)
- {
- System.Console.WriteLine("Writing to file: {0}", resultsFile);
-
- using (var resultsFileStream = new StreamWriter(resultsFile) { AutoFlush = true })
- {
- var reader = new XmlTvReader(filename, lang);
- await ReadOutChannels(reader, resultsFileStream);
-
- resultsFileStream.Close();
- }
- }
-
- public static async Task ReadOutChannels(XmlTvReader reader, StreamWriter resultsFileStream)
- {
- var channels = reader.GetChannels().Distinct().ToList();
-
- resultsFileStream.Write(EntityExtensions.GetHeader("Channels"));
-
- foreach (var channel in channels)
- {
- System.Console.WriteLine("Retrieved Channel: {0} - {1}", channel.Id, channel.DisplayName);
- resultsFileStream.Write(channel.GetChannelDetail());
- }
-
- var totalProgrammeCount = 0;
-
- resultsFileStream.Write("\r\n");
- foreach (var channel in channels)
- {
- System.Console.WriteLine("Processing Channel: {0}", channel.DisplayName);
-
- resultsFileStream.Write(EntityExtensions.GetHeader("Programs for " + channel.DisplayName));
- var channelProgrammeCount = await ReadOutChannelProgrammes(reader, channel, resultsFileStream);
-
- totalProgrammeCount += channelProgrammeCount;
- await resultsFileStream.WriteLineAsync(String.Format("Total Programmes for {1}: {0}", channelProgrammeCount, channel.DisplayName));
- }
-
- await resultsFileStream.WriteLineAsync(String.Format("Total Programmes: {0}", totalProgrammeCount));
- }
-
- private static async Task ReadOutChannelProgrammes(XmlTvReader reader, XmlTvChannel channel, StreamWriter resultsFileStream)
- {
- //var startDate = new DateTime(2015, 11, 28);
- //var endDate = new DateTime(2015, 11, 29);
- var startDate = DateTimeOffset.MinValue;
- var endDate = DateTimeOffset.MaxValue;
-
- var count = 0;
-
- foreach (var programme in reader.GetProgrammes(channel.Id, startDate, endDate, new CancellationToken()).Distinct())
- {
- count++;
- await resultsFileStream.WriteLineAsync(programme.GetProgrammeDetail(channel));
- }
-
- return count;
- }
- }
-}
diff --git a/Emby.XmlTv/Emby.XmlTv.Console/Properties/AssemblyInfo.cs b/Emby.XmlTv/Emby.XmlTv.Console/Properties/AssemblyInfo.cs
deleted file mode 100644
index ff59f890f..000000000
--- a/Emby.XmlTv/Emby.XmlTv.Console/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Emby.XmlTv.Console")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Emby.XmlTv.Console")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("add1d993-6d74-480a-b1fc-7fd9fd05a769")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Emby.XmlTv/Emby.XmlTv.Test/Emby.XmlTv.Test.csproj b/Emby.XmlTv/Emby.XmlTv.Test/Emby.XmlTv.Test.csproj
deleted file mode 100644
index d7c4ad0b7..000000000
--- a/Emby.XmlTv/Emby.XmlTv.Test/Emby.XmlTv.Test.csproj
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
- Debug
- AnyCPU
- {C8298223-2468-466C-9B06-FBF61926CECB}
- Library
- Properties
- Emby.XmlTv.Test
- Emby.XmlTv.Test
- 512
- {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 10.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
- $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
- False
- UnitTest
-
- ..\
- true
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- False
-
-
-
-
-
-
-
-
-
-
-
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
- Designer
-
-
-
-
- {0D023565-5942-4D79-9098-A1B4B6665A40}
- Emby.XmlTv
-
-
-
-
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
-
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
- netstandard2.0
- false
-
-
diff --git a/Emby.XmlTv/Emby.XmlTv.Test/Properties/AssemblyInfo.cs b/Emby.XmlTv/Emby.XmlTv.Test/Properties/AssemblyInfo.cs
deleted file mode 100644
index 902860363..000000000
--- a/Emby.XmlTv/Emby.XmlTv.Test/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Emby.XmlTv.Test")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Emby.XmlTv.Test")]
-[assembly: AssemblyCopyright("Copyright © 2016")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("c8298223-2468-466c-9b06-fbf61926cecb")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderDateTimeTests.cs b/Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderDateTimeTests.cs
deleted file mode 100644
index 857cc339c..000000000
--- a/Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderDateTimeTests.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-using System;
-using System.IO;
-
-using Emby.XmlTv.Classes;
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Emby.XmlTv.Test
-{
- [TestClass]
- public class XmlTvReaderDateTimeTests
- {
- [TestMethod]
- [DeploymentItem("Xml Files\\MultilanguageData.xml")]
- public void Should_HandlePartDates()
- {
- var testFile = Path.GetFullPath(@"MultilanguageData.xml");
- var reader = new XmlTvReader(testFile, "es");
-
- Assert.AreEqual(Parse("01 Jan 2016 00:00:00"), reader.ParseDate("2016"));
- Assert.AreEqual(Parse("01 Jan 2016 00:00:00"), reader.ParseDate("201601"));
- Assert.AreEqual(Parse("01 Jan 2016 00:00:00"), reader.ParseDate("20160101"));
- Assert.AreEqual(Parse("01 Jan 2016 12:00:00"), reader.ParseDate("2016010112"));
- Assert.AreEqual(Parse("01 Jan 2016 12:34:00"), reader.ParseDate("201601011234"));
- Assert.AreEqual(Parse("01 Jan 2016 12:34:56"), reader.ParseDate("20160101123456"));
- }
- [TestMethod]
- [DeploymentItem("Xml Files\\MultilanguageData.xml")]
- public void Should_HandleDateWithOffset()
- {
- var testFile = Path.GetFullPath(@"MultilanguageData.xml");
- var reader = new XmlTvReader(testFile, "es");
-
- // parse variations on 1:00AM
- Assert.AreEqual(Parse("01 Jan 2016 12:00:00"), reader.ParseDate("20160101120000 +0000"));
- Assert.AreEqual(Parse("01 Jan 2016 02:00:00"), reader.ParseDate("20160101120000 +1000"));
- Assert.AreEqual(Parse("01 Jan 2016 11:00:00"), reader.ParseDate("20160101120000 +0100"));
- Assert.AreEqual(Parse("01 Jan 2016 11:50:00"), reader.ParseDate("20160101120000 +0010"));
- Assert.AreEqual(Parse("01 Jan 2016 11:59:00"), reader.ParseDate("20160101120000 +0001"));
-
- Assert.AreEqual(Parse("01 Jan 2016 22:00:00"), reader.ParseDate("20160101120000 -1000"));
- Assert.AreEqual(Parse("01 Jan 2016 13:00:00"), reader.ParseDate("20160101120000 -0100"));
- Assert.AreEqual(Parse("01 Jan 2016 12:10:00"), reader.ParseDate("20160101120000 -0010"));
- Assert.AreEqual(Parse("01 Jan 2016 12:01:00"), reader.ParseDate("20160101120000 -0001"));
- }
-
- [TestMethod]
- [DeploymentItem("Xml Files\\MultilanguageData.xml")]
- public void Should_HandlePartDatesWithOffset()
- {
- var testFile = Path.GetFullPath(@"MultilanguageData.xml");
- var reader = new XmlTvReader(testFile, "es");
-
- Assert.AreEqual(Parse("01 Jan 2016 01:00:00"), reader.ParseDate("2016 -0100"));
- Assert.AreEqual(Parse("01 Jan 2016 01:00:00"), reader.ParseDate("201601 -0100"));
- Assert.AreEqual(Parse("01 Jan 2016 01:00:00"), reader.ParseDate("20160101 -0100"));
- Assert.AreEqual(Parse("01 Jan 2016 13:00:00"), reader.ParseDate("2016010112 -0100"));
- Assert.AreEqual(Parse("01 Jan 2016 13:00:00"), reader.ParseDate("201601011200 -0100"));
- Assert.AreEqual(Parse("01 Jan 2016 13:00:00"), reader.ParseDate("20160101120000 -0100"));
- }
-
- [TestMethod]
- [DeploymentItem("Xml Files\\MultilanguageData.xml")]
- public void Should_HandleSpaces()
- {
- var testFile = Path.GetFullPath(@"MultilanguageData.xml");
- var reader = new XmlTvReader(testFile, "es");
-
- // parse variations on 1:00AM
- Assert.AreEqual(Parse("01 Jan 2016 12:00:00"), reader.ParseDate("20160101120000 +000"));
- Assert.AreEqual(Parse("01 Jan 2016 12:00:00"), reader.ParseDate("20160101120000 +00"));
- Assert.AreEqual(Parse("01 Jan 2016 12:00:00"), reader.ParseDate("20160101120000 +0"));
- }
-
- [TestMethod]
- [DeploymentItem("Xml Files\\MultilanguageData.xml")]
- public void Should_HandleSpaces2()
- {
- var testFile = Path.GetFullPath(@"MultilanguageData.xml");
- var reader = new XmlTvReader(testFile, "es");
-
- // parse variations on 1:00AM
- Assert.AreEqual(Parse("01 Jan 2016 12:00:00"), reader.ParseDate("20160101120000 0"));
- }
-
- private DateTimeOffset Parse(string value)
- {
- return new DateTimeOffset(DateTimeOffset.Parse(value).Ticks, TimeSpan.Zero);
- }
- }
-}
diff --git a/Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderLanguageTests.cs b/Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderLanguageTests.cs
deleted file mode 100644
index 32a0431d2..000000000
--- a/Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderLanguageTests.cs
+++ /dev/null
@@ -1,181 +0,0 @@
-using System;
-using System.IO;
-using System.Linq;
-using System.Threading;
-
-using Emby.XmlTv.Classes;
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Emby.XmlTv.Test
-{
- [TestClass]
- public class XmlTvReaderLanguageTests
- {
- /* Homes Under the Hammer - Spanish
- * Homes Under the Hammer - Spanish 2
- * Homes Under the Hammer - English
- * Homes Under the Hammer - English 2
- * Homes Under the Hammer - Empty Language
- * Homes Under the Hammer - Empty Language 2
- * Homes Under the Hammer - No Language
- * Homes Under the Hammer - No Language 2
- */
-
- /* Expected Behaviour:
- * - Language = Null Homes Under the Hammer - No Language
- * - Language = "" Homes Under the Hammer - No Language
- * - Language = es Homes Under the Hammer - Spanish
- * - Language = en Homes Under the Hammer - English
- */
-
- [TestMethod]
- [DeploymentItem("Xml Files\\MultilanguageData.xml")]
- public void Should_Return_The_First_Matching_Language_ES()
- {
- var testFile = Path.GetFullPath(@"MultilanguageData.xml");
- var reader = new XmlTvReader(testFile, "es");
- var channel = reader.GetChannels().FirstOrDefault();
- Assert.IsNotNull(channel);
-
- var startDate = new DateTime(2015, 11, 26);
- var cancellationToken = new CancellationToken();
- var programme = reader.GetProgrammes(channel.Id, startDate, startDate.AddDays(1), cancellationToken).FirstOrDefault();
-
- Assert.IsNotNull(programme);
- Assert.AreEqual("Homes Under the Hammer - Spanish", programme.Title);
- Assert.AreEqual(1, programme.Categories.Count);
- Assert.AreEqual("Property - Spanish", programme.Categories[0]);
- }
-
- [TestMethod]
- [DeploymentItem("Xml Files\\MultilanguageData.xml")]
- public void Should_Return_The_First_Matching_Language_EN()
- {
- var testFile = Path.GetFullPath(@"MultilanguageData.xml");
- var reader = new XmlTvReader(testFile, "en");
-
- var channel = reader.GetChannels().FirstOrDefault();
- Assert.IsNotNull(channel);
-
- var startDate = new DateTime(2015, 11, 26);
- var cancellationToken = new CancellationToken();
- var programme = reader.GetProgrammes(channel.Id, startDate, startDate.AddDays(1), cancellationToken).FirstOrDefault();
-
- Assert.IsNotNull(programme);
- Assert.AreEqual("Homes Under the Hammer - English", programme.Title);
- Assert.AreEqual(1, programme.Categories.Count);
- Assert.AreEqual("Property - English", programme.Categories[0]);
- }
-
- [TestMethod]
- [DeploymentItem("Xml Files\\MultilanguageData.xml")]
- public void Should_Return_The_First_Matching_With_No_Language()
- {
- var testFile = Path.GetFullPath(@"MultilanguageData.xml");
- var reader = new XmlTvReader(testFile, null);
-
- var channel = reader.GetChannels().FirstOrDefault();
- Assert.IsNotNull(channel);
-
- var startDate = new DateTime(2015, 11, 26);
- var cancellationToken = new CancellationToken();
- var programme = reader.GetProgrammes(channel.Id, startDate, startDate.AddDays(1), cancellationToken).FirstOrDefault();
-
- Assert.IsNotNull(programme);
- Assert.AreEqual("Homes Under the Hammer - No Language", programme.Title);
- Assert.AreEqual(1, programme.Categories.Count);
- Assert.AreEqual("Property - No Language", programme.Categories[0]);
- }
-
- [TestMethod]
- [DeploymentItem("Xml Files\\MultilanguageData.xml")]
- public void Should_Return_The_First_Matching_With_Empty_Language()
- {
- var testFile = Path.GetFullPath(@"MultilanguageData.xml");
- var reader = new XmlTvReader(testFile, String.Empty);
-
- var channel = reader.GetChannels().FirstOrDefault();
- Assert.IsNotNull(channel);
-
- var startDate = new DateTime(2015, 11, 26);
- var cancellationToken = new CancellationToken();
- var programme = reader.GetProgrammes(channel.Id, startDate, startDate.AddDays(1), cancellationToken).FirstOrDefault();
-
- Assert.IsNotNull(programme);
- Assert.AreEqual("Homes Under the Hammer - Empty Language", programme.Title);
- Assert.AreEqual(1, programme.Categories.Count);
- Assert.AreEqual("Property - Empty Language", programme.Categories[0]);
- }
-
- [TestMethod]
- [DeploymentItem("Xml Files\\MultilanguageData.xml")]
- public void Should_Return_The_First_When_NoMatchFound()
- {
- var testFile = Path.GetFullPath(@"MultilanguageData.xml");
- var reader = new XmlTvReader(testFile, "es"); // There are no titles or categories for spanish
-
- var channel = reader.GetChannels().FirstOrDefault();
- Assert.IsNotNull(channel);
-
- var startDate = new DateTime(2015, 11, 26);
- var cancellationToken = new CancellationToken();
- var programme = reader.GetProgrammes(channel.Id, startDate, startDate.AddDays(1), cancellationToken).Skip(1).FirstOrDefault();
-
- Assert.IsNotNull(programme);
- Assert.AreEqual("Homes Under the Hammer - English", programme.Title);
-
- // Should return all categories
- Assert.AreEqual(2, programme.Categories.Count);
- Assert.IsTrue(programme.Categories.Contains("Property - English"));
- Assert.IsTrue(programme.Categories.Contains("Property - Empty Language"));
- }
-
- [TestMethod]
- [DeploymentItem("Xml Files\\MultilanguageData.xml")]
- public void Should_Return_The_First_When_NoLanguage()
- {
- var testFile = Path.GetFullPath(@"MultilanguageData.xml");
- var reader = new XmlTvReader(testFile, null);
-
- var channel = reader.GetChannels().FirstOrDefault();
- Assert.IsNotNull(channel);
-
- var startDate = new DateTime(2015, 11, 26);
- var cancellationToken = new CancellationToken();
- var programme = reader.GetProgrammes(channel.Id, startDate, startDate.AddDays(1), cancellationToken).Skip(1).FirstOrDefault();
-
- Assert.IsNotNull(programme);
- Assert.AreEqual("Homes Under the Hammer - English", programme.Title); // Should return the first in the list
-
- // Should return all categories
- Assert.AreEqual(2, programme.Categories.Count);
- Assert.IsTrue(programme.Categories.Contains("Property - English"));
- Assert.IsTrue(programme.Categories.Contains("Property - Empty Language"));
- }
-
- [TestMethod]
- [DeploymentItem("Xml Files\\MultilanguageData.xml")]
- public void Should_Return_All_Languages()
- {
- var testFile = Path.GetFullPath(@"MultilanguageData.xml");
- var reader = new XmlTvReader(testFile);
- var cancellationToken = new CancellationToken();
-
- var results = reader.GetLanguages(cancellationToken);
- Assert.IsNotNull(results);
-
- foreach (var result in results)
- {
- Console.WriteLine("{0} - {1}", result.Name, result.Relevance);
- }
-
- Assert.AreEqual(2, results.Count);
- Assert.AreEqual("en", results[0].Name);
- Assert.AreEqual(11, results[0].Relevance);
- Assert.AreEqual("es", results[1].Name);
- Assert.AreEqual(3, results[1].Relevance);
- }
-
- }
-}
diff --git a/Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderTests.cs b/Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderTests.cs
deleted file mode 100644
index b1dffc59c..000000000
--- a/Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderTests.cs
+++ /dev/null
@@ -1,219 +0,0 @@
-using System;
-using System.IO;
-using System.Linq;
-using System.Threading;
-
-using Emby.XmlTv.Classes;
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Emby.XmlTv.Test
-{
- [TestClass]
- public class XmlTvReaderTests
- {
- [TestMethod]
- [DeploymentItem("Xml Files\\UK_Data.xml")]
- public void UK_DataTest_ChannelsTest()
- {
- var testFile = Path.GetFullPath(@"UK_Data.xml");
- var reader = new XmlTvReader(testFile);
-
- var channels = reader.GetChannels().ToList();
- Assert.AreEqual(5, channels.Count);
-
- // Check each channel
- var channel = channels.SingleOrDefault(c => c.Id == "UK_RT_2667");
- Assert.IsNotNull(channel);
- Assert.AreEqual("BBC1 HD", channel.DisplayName);
- Assert.AreEqual("7.1", channel.Number);
- Assert.IsNotNull(channel.Icon);
- Assert.AreEqual("Logo_UK_RT_2667", channel.Icon.Source);
- Assert.AreEqual(100, channel.Icon.Width);
- Assert.AreEqual(200, channel.Icon.Height);
-
- channel = channels.SingleOrDefault(c => c.Id == "UK_RT_105");
- Assert.IsNotNull(channel);
- Assert.AreEqual("BBC2", channel.DisplayName);
- Assert.IsNotNull(channel.Icon);
- Assert.AreEqual("Logo_UK_RT_105", channel.Icon.Source);
- Assert.IsFalse(channel.Icon.Width.HasValue);
- Assert.IsFalse(channel.Icon.Height.HasValue);
-
- channel = channels.SingleOrDefault(c => c.Id == "UK_RT_2118");
- Assert.IsNotNull(channel);
- Assert.AreEqual("ITV1 HD", channel.DisplayName);
- Assert.IsNotNull(channel.Icon);
- Assert.AreEqual("Logo_UK_RT_2118", channel.Icon.Source);
- Assert.AreEqual(100, channel.Icon.Width);
- Assert.IsFalse(channel.Icon.Height.HasValue);
-
- channel = channels.SingleOrDefault(c => c.Id == "UK_RT_2056");
- Assert.IsNotNull(channel);
- Assert.AreEqual("Channel 4 HD", channel.DisplayName);
- Assert.IsNotNull(channel.Icon);
- Assert.AreEqual("Logo_UK_RT_2056", channel.Icon.Source);
- Assert.IsFalse(channel.Icon.Width.HasValue);
- Assert.AreEqual(200, channel.Icon.Height);
-
- channel = channels.SingleOrDefault(c => c.Id == "UK_RT_134");
- Assert.IsNotNull(channel);
- Assert.AreEqual("Channel 5", channel.DisplayName);
- Assert.IsNull(channel.Icon);
- }
-
- [TestMethod]
- [DeploymentItem("Xml Files\\UK_Data.xml")]
- public void UK_DataTest_GeneralTest()
- {
- var testFile = Path.GetFullPath(@"UK_Data.xml");
- var reader = new XmlTvReader(testFile, null);
-
- var channels = reader.GetChannels().ToList();
- Assert.AreEqual(5, channels.Count);
-
- // Pick a channel to check the data for
- var channel = channels.SingleOrDefault(c => c.Id == "UK_RT_2056");
- Assert.IsNotNull(channel);
-
- var startDate = new DateTime(2015, 11, 26);
- var cancellationToken = new CancellationToken();
- var programmes = reader.GetProgrammes(channel.Id, startDate, startDate.AddDays(1), cancellationToken).ToList();
-
- Assert.AreEqual(27, programmes.Count);
- var programme = programmes.SingleOrDefault(p => p.Title == "The Secret Life of");
-
- Assert.IsNotNull(programme);
- Assert.AreEqual(new DateTime(2015, 11, 26, 20, 0, 0), programme.StartDate);
- Assert.AreEqual(new DateTime(2015, 11, 26, 21, 0, 0), programme.EndDate);
- Assert.AreEqual("Cameras follow the youngsters' development after two weeks apart and time has made the heart grow fonder for Alfie and Emily, who are clearly happy to be back together. And although Alfie struggled to empathise with the rest of his peers before, a painting competition proves to be a turning point for him. George takes the children's rejection of his family recipe to heart, but goes on to triumph elsewhere, and romance is in the air when newcomer Sienna captures Arthur's heart.", programme.Description);
- Assert.AreEqual("Documentary", programme.Categories.Single());
- Assert.IsNotNull(programme.Episode);
- Assert.AreEqual("The Secret Life of 5 Year Olds", programme.Episode.Title);
- Assert.AreEqual(1, programme.Episode.Series);
- Assert.IsNull(programme.Episode.SeriesCount);
- Assert.AreEqual(4, programme.Episode.Episode);
- Assert.AreEqual(6, programme.Episode.EpisodeCount);
- Assert.IsNotNull(programme.Premiere);
- //Assert.AreEqual("First showing on national terrestrial TV", programme.Premiere.Details);
- Assert.IsTrue(programme.IsNew);
- }
-
- [TestMethod]
- [DeploymentItem("Xml Files\\UK_Data.xml")]
- public void UK_DataTest_MultipleTitles_SameLanguage_Should_ReturnFirstValue()
- {
- var testFile = Path.GetFullPath(@"UK_Data.xml");
- var reader = new XmlTvReader(testFile, null);
-
- /*
- Homes Under the Hammer - Title 1
- Homes Under the Hammer - Title 2
- Homes Under the Hammer - Title 3
- */
-
- var startDate = new DateTime(2015, 11, 26);
- var cancellationToken = new CancellationToken();
- var programmes = reader.GetProgrammes("UK_RT_2667", startDate, startDate.AddDays(1), cancellationToken).ToList();
- var programme = programmes.SingleOrDefault(p => p.Title == "Homes Under the Hammer - Title 1");
-
- Assert.IsNotNull(programme);
- }
-
- [TestMethod]
- [DeploymentItem("Xml Files\\UK_Data.xml")]
- public void UK_DataTest_MultipleTitles_NoLanguage_Should_ReturnFirstValue()
- {
- var testFile = Path.GetFullPath(@"UK_Data.xml");
- var reader = new XmlTvReader(testFile, null);
-
- /*
- Oxford Street Revealed - Title 1
- Oxford Street Revealed - Title 2
- Oxford Street Revealed - Title 3
- */
-
- var startDate = new DateTime(2015, 11, 26);
- var cancellationToken = new CancellationToken();
- var programmes = reader.GetProgrammes("UK_RT_2667", startDate, startDate.AddDays(1), cancellationToken).ToList();
- var programme = programmes.SingleOrDefault(p => p.Title == "Oxford Street Revealed - Title 1");
-
- Assert.IsNotNull(programme);
- }
-
- [TestMethod]
- [DeploymentItem("Xml Files\\ES_MultiLanguageData.xml")]
- public void ES_MultiLanguageDataTest()
- {
- var testFile = Path.GetFullPath(@"ES_MultiLanguageData.xml");
- var reader = new XmlTvReader(testFile, "es"); // Specify the spanish language explicitly
-
- var channels = reader.GetChannels().ToList();
- Assert.AreEqual(141, channels.Count);
-
- // Pick a channel to check the data for
- var channel = channels.SingleOrDefault(c => c.Id == "Canal + HD" && c.DisplayName == "Canal + HD");
- Assert.IsNotNull(channel);
-
- var startDate = new DateTime(2016, 02, 18);
- var cancellationToken = new CancellationToken();
- var programmes = reader.GetProgrammes(channel.Id, startDate, startDate.AddDays(1), cancellationToken).ToList();
-
- Assert.AreEqual(22, programmes.Count);
- var programme = programmes.SingleOrDefault(p => p.Title == "This is Comedy. Judd Apatow & Co.");
-
- /*
-
- This is Comedy. Judd Apatow & Co.
- This is Comedy
- El resurgir creativo de la comedia estadounidense en los últimos 15 años ha tenido un nombre indiscutible, Judd Apatow, y unos colaboradores indispensables, sus amigos (actores, cómicos, escritores) Jonah Hill, Steve Carrell, Paul Rudd, Seth Rogen, Lena Dunham... A través de extractos de sus filmes y de entrevistas a algunos los miembros de su 'banda' (Adam Sandler, Lena Dunham o Jason Segel), este documental muestra la carrera de un productor y director excepcional que ha sido capaz de llevar la risa a su máxima expresión
-
- Jacky Goldberg
-
- 2014
- Documentales
- Sociedad
-
- Francia
-
- TV-G
-
-
- 3/5
-
-
- */
-
- Assert.IsNotNull(programme);
- Assert.AreEqual(new DateTime(2016, 02, 18, 4, 51, 0), programme.StartDate);
- Assert.AreEqual(new DateTime(2016, 02, 18, 5, 54, 0), programme.EndDate);
- Assert.AreEqual("El resurgir creativo de la comedia estadounidense en los últimos 15 años ha tenido un nombre indiscutible, Judd Apatow, y unos colaboradores indispensables, sus amigos (actores, cómicos, escritores) Jonah Hill, Steve Carrell, Paul Rudd, Seth Rogen, Lena Dunham... A través de extractos de sus filmes y de entrevistas a algunos los miembros de su 'banda' (Adam Sandler, Lena Dunham o Jason Segel), este documental muestra la carrera de un productor y director excepcional que ha sido capaz de llevar la risa a su máxima expresión", programme.Description);
- Assert.AreEqual(2, programme.Categories.Count);
- Assert.AreEqual("Documentales", programme.Categories[0]);
- Assert.AreEqual("Sociedad", programme.Categories[1]);
- Assert.IsNotNull(programme.Episode);
- Assert.IsNull(programme.Episode.Episode);
- Assert.IsNull(programme.Episode.EpisodeCount);
- Assert.IsNull(programme.Episode.Part);
- Assert.IsNull(programme.Episode.PartCount);
- Assert.IsNull(programme.Episode.Series);
- Assert.IsNull(programme.Episode.SeriesCount);
- Assert.IsNull(programme.Episode.Title);
- }
-
- [TestMethod]
- [DeploymentItem("Xml Files\\honeybee.xml")]
- public void HoneybeeTest()
- {
- var testFile = Path.GetFullPath(@"honeybee.xml");
- var reader = new XmlTvReader(testFile, null);
-
- var channels = reader.GetChannels().ToList();
- Assert.AreEqual(16, channels.Count);
-
- var programs = reader.GetProgrammes("2013.honeybee.it", DateTime.UtcNow.AddYears(-1),
- DateTime.UtcNow.AddYears(1), CancellationToken.None).ToList();
- Assert.AreEqual(297, programs.Count);
- }
- }
-}
diff --git a/Emby.XmlTv/Emby.XmlTv.sln b/Emby.XmlTv/Emby.XmlTv.sln
deleted file mode 100644
index 8243d4b72..000000000
--- a/Emby.XmlTv/Emby.XmlTv.sln
+++ /dev/null
@@ -1,44 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.24720.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emby.XmlTv.Console", "Emby.XmlTv.Console\Emby.XmlTv.Console.csproj", "{ADD1D993-6D74-480A-B1FC-7FD9FD05A769}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emby.XmlTv", "Emby.XmlTv\Emby.XmlTv.csproj", "{0D023565-5942-4D79-9098-A1B4B6665A40}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{BB0FD191-A9D0-4CC9-A79E-ECBCF1275268}"
- ProjectSection(SolutionItems) = preProject
- .nuget\NuGet.Config = .nuget\NuGet.Config
- .nuget\NuGet.exe = .nuget\NuGet.exe
- .nuget\NuGet.targets = .nuget\NuGet.targets
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution Files", "{E9F625D5-979E-48E8-9987-F4BCADD79A41}"
- ProjectSection(SolutionItems) = preProject
- Nuget\Emby.XmlTv.nuspec = Nuget\Emby.XmlTv.nuspec
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {ADD1D993-6D74-480A-B1FC-7FD9FD05A769}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {ADD1D993-6D74-480A-B1FC-7FD9FD05A769}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {ADD1D993-6D74-480A-B1FC-7FD9FD05A769}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {ADD1D993-6D74-480A-B1FC-7FD9FD05A769}.Release|Any CPU.Build.0 = Release|Any CPU
- {0D023565-5942-4D79-9098-A1B4B6665A40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0D023565-5942-4D79-9098-A1B4B6665A40}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0D023565-5942-4D79-9098-A1B4B6665A40}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0D023565-5942-4D79-9098-A1B4B6665A40}.Release|Any CPU.Build.0 = Release|Any CPU
- {C8298223-2468-466C-9B06-FBF61926CECB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C8298223-2468-466C-9B06-FBF61926CECB}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C8298223-2468-466C-9B06-FBF61926CECB}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C8298223-2468-466C-9B06-FBF61926CECB}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/Emby.XmlTv/Emby.XmlTv/Classes/XmlTvReader.cs b/Emby.XmlTv/Emby.XmlTv/Classes/XmlTvReader.cs
deleted file mode 100644
index 46bf6cc21..000000000
--- a/Emby.XmlTv/Emby.XmlTv/Classes/XmlTvReader.cs
+++ /dev/null
@@ -1,1107 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Text.RegularExpressions;
-using System.Threading;
-using System.Xml;
-using Emby.XmlTv.Entities;
-
-namespace Emby.XmlTv.Classes
-{
- // Reads an XmlTv file
- public class XmlTvReader
- {
- private readonly string _fileName;
- private readonly string _language;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Name of the file.
- /// The specific language to return.
- public XmlTvReader(string fileName, string language = null)
- {
- _fileName = fileName;
-
- // Normalize null/string.empty
- if (string.IsNullOrWhiteSpace(language))
- {
- language = null;
- }
- _language = language;
- }
-
- private static XmlReader CreateXmlTextReader(string path)
- {
- var settings = new XmlReaderSettings();
-
- // https://msdn.microsoft.com/en-us/library/system.xml.xmlreadersettings.xmlresolver(v=vs.110).aspx
- // Looks like we don't need this anyway?
- // Starting with the .NET Framework 4.5.2, this setting has a default value of null.
- //settings.XmlResolver = null;
-
- settings.DtdProcessing = DtdProcessing.Ignore;
-
- settings.CheckCharacters = false;
- settings.IgnoreProcessingInstructions = true;
- settings.IgnoreComments = true;
- //settings.ValidationType = ValidationType.None;
-
- return XmlReader.Create(path, settings);
- }
-
- ///
- /// Gets the list of channels present in the XML
- ///
- ///
- public IEnumerable GetChannels()
- {
- var list = new List();
-
- using (var reader = CreateXmlTextReader(_fileName))
- {
- if (reader.ReadToDescendant("tv"))
- {
- if (reader.ReadToDescendant("channel"))
- {
- do
- {
- var channel = GetChannel(reader);
- if (channel != null)
- {
- list.Add(channel);
- }
- }
- while (reader.ReadToFollowing("channel"));
- }
- }
- }
-
- return list;
- }
-
- private XmlTvChannel GetChannel(XmlReader reader)
- {
- var id = reader.GetAttribute("id");
-
- if (string.IsNullOrEmpty(id))
- {
- // LogError("No id found for channel row");
- // Log.Error(" channel#{0} doesnt contain an id", iChannel);
- return null;
- }
-
- var result = new XmlTvChannel() { Id = id };
-
- using (var xmlChannel = reader.ReadSubtree())
- {
- xmlChannel.MoveToContent();
- xmlChannel.Read();
-
- // Read out the data for each node and process individually
- while (!xmlChannel.EOF && xmlChannel.ReadState == ReadState.Interactive)
- {
- if (xmlChannel.NodeType == XmlNodeType.Element)
- {
- switch (xmlChannel.Name)
- {
- case "display-name":
- ProcessNode(xmlChannel, s => result.DisplayName = s, _language, s => SetChannelNumber(result, s));
- break;
- case "url":
- result.Url = xmlChannel.ReadElementContentAsString();
- break;
- case "icon":
- result.Icon = ProcessIconNode(xmlChannel);
- xmlChannel.Skip();
- break;
- default:
- xmlChannel.Skip(); // unknown, skip entire node
- break;
- }
- }
- else
- {
- xmlChannel.Read();
- }
- }
- }
-
- if (string.IsNullOrEmpty(result.DisplayName))
- {
- // LogError("No display-name found for channel {0}", id);
- return null;
- }
-
- return result;
- }
-
- private void SetChannelNumber(XmlTvChannel channel, string value)
- {
- value = value.Replace("-", ".");
- if (double.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var number))
- {
- channel.Number = value;
- }
- }
-
- ///
- /// Gets the programmes for a specified channel
- ///
- /// The channel id.
- /// The UTC start date.
- /// The UTC end date.
- /// A cancellation token.
- ///
- public IEnumerable GetProgrammes(
- string channelId,
- DateTimeOffset startDateUtc,
- DateTimeOffset endDateUtc,
- CancellationToken cancellationToken)
- {
- var list = new List();
-
- using (var reader = CreateXmlTextReader(_fileName))
- {
- if (reader.ReadToDescendant("tv"))
- {
- if (reader.ReadToDescendant("programme"))
- {
- do
- {
- if (cancellationToken.IsCancellationRequested)
- {
- continue; // Break out
- }
-
- var programme = GetProgramme(reader, channelId, startDateUtc, endDateUtc);
- if (programme != null)
- {
- list.Add(programme);
- }
- }
- while (reader.ReadToFollowing("programme"));
- }
- }
- }
-
- return list;
- }
-
- public XmlTvProgram GetProgramme(XmlReader reader, string channelId, DateTimeOffset startDateUtc, DateTimeOffset endDateUtc)
- {
- var result = new XmlTvProgram();
-
- PopulateHeader(reader, result);
-
- using (var xmlProg = reader.ReadSubtree())
- {
- // First up, validate that this is the correct channel, and programme is within the time we are expecting
- if (!string.Equals(result.ChannelId, channelId, StringComparison.OrdinalIgnoreCase))
- {
- return null;
- }
-
- if (result.EndDate < startDateUtc || result.StartDate >= endDateUtc)
- {
- return null;
- }
-
- xmlProg.MoveToContent();
- xmlProg.Read();
-
- // Loop through each element
- while (!xmlProg.EOF && xmlProg.ReadState == ReadState.Interactive)
- {
- if (xmlProg.NodeType == XmlNodeType.Element)
- {
- switch (xmlProg.Name)
- {
- case "title":
- ProcessTitleNode(xmlProg, result);
- break;
- case "category":
- ProcessCategory(xmlProg, result);
- break;
- case "country":
- ProcessCountry(xmlProg, result);
- break;
- case "desc":
- ProcessDescription(xmlProg, result);
- break;
- case "sub-title":
- ProcessSubTitle(xmlProg, result);
- break;
- case "new":
- ProcessNew(xmlProg, result);
- break;
- case "previously-shown":
- ProcessPreviouslyShown(xmlProg, result);
- break;
- case "quality":
- ProcessQuality(xmlProg, result);
- break;
- case "episode-num":
- ProcessEpisodeNum(xmlProg, result);
- break;
- case "date": // Copyright date
- ProcessCopyrightDate(xmlProg, result);
- break;
- case "star-rating": // Community Rating
- ProcessStarRating(xmlProg, result);
- break;
- case "rating": // Certification Rating
- ProcessRating(xmlProg, result);
- break;
- case "credits":
- if (xmlProg.IsEmptyElement)
- {
- xmlProg.Skip();
- }
- else
- {
- using (var subtree = xmlProg.ReadSubtree())
- {
- ProcessCredits(subtree, result);
- }
- }
- break;
- case "icon":
- result.Icon = ProcessIconNode(xmlProg);
- xmlProg.Skip();
- break;
- case "premiere":
- result.Premiere = new XmlTvPremiere();
- // This was causing data after the premiere node to not be read. Reactivate this and debug if the premiere details are ever needed.
- //ProcessPremiereNode(xmlProg, result);
- xmlProg.Skip();
- break;
- default:
- // unknown, skip entire node
- xmlProg.Skip();
- break;
- }
- }
- else
- {
- xmlProg.Read();
- }
- }
- }
- return result;
- }
-
- ///
- /// Gets the list of supported languages in the XML
- ///
- ///
- public List GetLanguages(CancellationToken cancellationToken)
- {
- var results = new Dictionary();
-
- //Loop through and parse out all elements and then lang= attributes
- //logger.LogInformation("Loading file {0}", _fileName);
- using (var reader = CreateXmlTextReader(_fileName))
- {
- while (reader.Read())
- {
- if (cancellationToken.IsCancellationRequested)
- {
- continue; // Break out
- }
-
- if (reader.NodeType == XmlNodeType.Element)
- {
- var language = reader.GetAttribute("lang");
- if (!string.IsNullOrEmpty(language))
- {
- if (!results.ContainsKey(language))
- {
- results[language] = 0;
- }
- results[language]++;
- }
- }
- }
- }
-
- return
- results.Keys.Select(k => new XmlTvLanguage() { Name = k, Relevance = results[k] })
- .OrderByDescending(l => l.Relevance)
- .ToList();
- }
-
- private void ProcessCopyrightDate(XmlReader xmlProg, XmlTvProgram result)
- {
- var startValue = xmlProg.ReadElementContentAsString();
- if (string.IsNullOrEmpty(startValue))
- {
- // Log.Error(" programme#{0} doesnt contain a start date", iChannel);
- result.CopyrightDate = null;
- }
- else
- {
- var copyrightDate = ParseDate(startValue);
- if (copyrightDate != null)
- {
- result.CopyrightDate = copyrightDate;
- }
- }
- }
-
- public void ProcessCredits(XmlReader creditsXml, XmlTvProgram result)
- {
- creditsXml.MoveToContent();
- creditsXml.Read();
-
- // Loop through each element
- while (!creditsXml.EOF && creditsXml.ReadState == ReadState.Interactive)
- {
- if (creditsXml.NodeType == XmlNodeType.Element)
- {
- XmlTvCredit credit = null;
- switch (creditsXml.Name)
- {
- case "director":
- credit = new XmlTvCredit() { Type = XmlTvCreditType.Director };
- break;
- case "actor":
- credit = new XmlTvCredit() { Type = XmlTvCreditType.Actor };
- break;
- case "writer":
- credit = new XmlTvCredit() { Type = XmlTvCreditType.Writer };
- break;
- case "adapter":
- credit = new XmlTvCredit() { Type = XmlTvCreditType.Adapter };
- break;
- case "producer":
- credit = new XmlTvCredit() { Type = XmlTvCreditType.Producer };
- break;
- case "composer":
- credit = new XmlTvCredit() { Type = XmlTvCreditType.Composer };
- break;
- case "editor":
- credit = new XmlTvCredit() { Type = XmlTvCreditType.Editor };
- break;
- case "presenter":
- credit = new XmlTvCredit() { Type = XmlTvCreditType.Presenter };
- break;
- case "commentator":
- credit = new XmlTvCredit() { Type = XmlTvCreditType.Commentator };
- break;
- case "guest":
- credit = new XmlTvCredit() { Type = XmlTvCreditType.Guest };
- break;
- }
-
- if (credit != null)
- {
- credit.Name = creditsXml.ReadElementContentAsString();
- result.Credits.Add(credit);
- }
- else
- {
- creditsXml.Skip();
- }
- }
- else
- creditsXml.Read();
- }
- }
-
- public void ProcessStarRating(XmlReader reader, XmlTvProgram result)
- {
- /*
-
- 3/3
-
- */
-
- reader.ReadToDescendant("value");
- if (reader.Name == "value")
- {
- var textValue = reader.ReadElementContentAsString();
- if (textValue.Contains("/"))
- {
- var components = textValue.Split('/');
- if (float.TryParse(components[0], out var value))
- {
- result.StarRating = value;
- }
- }
- }
- else
- {
- reader.Skip();
- }
- }
-
- public void ProcessRating(XmlReader reader, XmlTvProgram result)
- {
- /*
-
- TV-G
-
- */
-
- var system = reader.GetAttribute("system");
-
- reader.ReadToDescendant("value");
- if (reader.Name == "value")
- {
- result.Rating = new XmlTvRating()
- {
- System = system,
- Value = reader.ReadElementContentAsString()
- };
- }
- else
- {
- reader.Skip();
- }
- }
-
- public void ProcessEpisodeNum(XmlReader reader, XmlTvProgram result)
- {
- /*
- EP00003026.0666
- 2706
- .26/0.
- */
-
- var episodeSystem = reader.GetAttribute("system");
- switch (episodeSystem)
- {
- case "dd_progid":
- ParseEpisodeDataForProgramId(reader, result);
- break;
- case "icetv":
- result.ProviderIds["icetv"] = reader.ReadElementContentAsString();
- break;
- case "xmltv_ns":
- ParseEpisodeDataForXmlTvNs(reader, result);
- break;
- case "onscreen":
- ParseEpisodeDataForOnScreen(reader, result);
- break;
- case "thetvdb.com":
- ParseTvdbSystem(reader, result);
- break;
- case "imdb.com":
- ParseImdbSystem(reader, result);
- break;
- case "themoviedb.org":
- ParseMovieDbSystem(reader, result);
- break;
- case "SxxExx":
- ParseSxxExxSystem(reader, result);
- break;
- default: // Handles empty string and nulls
- reader.Skip();
- break;
- }
- }
-
- public void ParseSxxExxSystem(XmlReader reader, XmlTvProgram result)
- {
- // S012E32
-
- var value = reader.ReadElementContentAsString();
- var res = Regex.Match(value, "s([0-9]+)e([0-9]+)", RegexOptions.IgnoreCase);
-
- if (res.Success)
- {
- int parsedInt;
-
- if (int.TryParse(res.Groups[1].Value, out parsedInt))
- {
- result.Episode.Series = parsedInt;
- }
-
- if (int.TryParse(res.Groups[2].Value, out parsedInt))
- {
- result.Episode.Episode = parsedInt;
- }
- }
- }
-
- public void ParseMovieDbSystem(XmlReader reader, XmlTvProgram result)
- {
- // series/248841
- // episode/4749206
-
- var value = reader.ReadElementContentAsString();
- var parts = value.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
-
- if (string.Equals(parts[0], "series", StringComparison.OrdinalIgnoreCase))
- {
- result.SeriesProviderIds["tmdb"] = parts[1];
- }
-
- else if (parts.Length == 1 || string.Equals(parts[0], "episode", StringComparison.OrdinalIgnoreCase))
- {
- result.ProviderIds["tmdb"] = parts.Last();
- }
- }
-
- public void ParseImdbSystem(XmlReader reader, XmlTvProgram result)
- {
- // series/tt1837576
- // episode/tt3288596
-
- var value = reader.ReadElementContentAsString();
- if (string.IsNullOrWhiteSpace(value))
- {
- return;
- }
- var parts = value.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
-
- if (parts.Length != 2)
- {
- return;
- }
-
- if (string.Equals(parts[0], "series", StringComparison.OrdinalIgnoreCase))
- {
- result.SeriesProviderIds["imdb"] = parts[1];
- }
-
- else if (string.Equals(parts[0], "episode", StringComparison.OrdinalIgnoreCase))
- {
- result.ProviderIds["imdb"] = parts[1];
- }
- }
-
- public void ParseTvdbSystem(XmlReader reader, XmlTvProgram result)
- {
- // series/248841
- // episode/4749206
-
- var value = reader.ReadElementContentAsString();
- var parts = value.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
-
- if (parts.Length != 2)
- {
- return;
- }
-
- if (string.Equals(parts[0], "series", StringComparison.OrdinalIgnoreCase))
- {
- result.SeriesProviderIds["tvdb"] = parts[1];
- }
-
- else if (string.Equals(parts[0], "episode", StringComparison.OrdinalIgnoreCase))
- {
- result.ProviderIds["tvdb"] = parts[1];
- }
- }
-
- public void ParseEpisodeDataForOnScreen(XmlReader reader, XmlTvProgram result)
- {
- //// example: 'Episode #FFEE'
- //serEpNum = ConvertHTMLToAnsi(nodeEpisodeNum);
- //int num1 = serEpNum.IndexOf("#", 0);
- //if (num1 < 0) num1 = 0;
- //episodeNum = CorrectEpisodeNum(serEpNum.Substring(num1, serEpNum.Length - num1), 0);
-
- var value = reader.ReadElementContentAsString();
- // value = HttpUtility.HtmlDecode(value);
- value = value.Replace(" ", "");
-
- var hashIndex = value.IndexOf("#", StringComparison.Ordinal);
- if (hashIndex > -1)
- {
- // Take everything from the hash to the end.
- //TODO: This could be textual - how do we populate an Int32
- // result.EpisodeNumber
- }
- }
-
- public void ParseEpisodeDataForProgramId(XmlReader reader, XmlTvProgram result)
- {
- var value = reader.ReadElementContentAsString();
- if (!string.IsNullOrWhiteSpace(value))
- {
- result.ProgramId = value;
- }
- }
-
- public void ParseEpisodeDataForXmlTvNs(XmlReader reader, XmlTvProgram result)
- {
- var value = reader.ReadElementContentAsString();
-
- value = value.Replace(" ", "");
-
- // Episode details
- var components = value.Split(new[] { "." }, StringSplitOptions.None);
-
- int parsedInt;
-
- if (!string.IsNullOrEmpty(components[0]))
- {
- // Handle either "5/12" or "5"
- var seriesComponents = components[0].Split(new[] { "/" }, StringSplitOptions.None);
-
- // handle the zero basing!
- if (int.TryParse(seriesComponents[0], out parsedInt))
- {
- result.Episode.Series = parsedInt + 1;
- if (seriesComponents.Length == 2)
- {
- if (int.TryParse(seriesComponents[1], out parsedInt))
- {
- result.Episode.SeriesCount = parsedInt;
- }
- }
- }
- }
-
- if (components.Length >= 2)
- {
- if (!string.IsNullOrEmpty(components[1]))
- {
- // Handle either "5/12" or "5"
- var episodeComponents = components[1].Split(new[] { "/" }, StringSplitOptions.None);
-
- // handle the zero basing!
- if (int.TryParse(episodeComponents[0], out parsedInt))
- {
- result.Episode.Episode = parsedInt + 1;
- if (episodeComponents.Count() == 2)
- {
- if (int.TryParse(episodeComponents[1], out parsedInt))
- {
- result.Episode.EpisodeCount = parsedInt;
- }
- }
- }
- }
- }
-
- if (components.Length >= 3)
- {
- if (!string.IsNullOrEmpty(components[2]))
- {
- // Handle either "5/12" or "5"
- var partComponents = components[2].Split(new[] { "/" }, StringSplitOptions.None);
-
- // handle the zero basing!
- if (int.TryParse(partComponents[0], out parsedInt))
- {
- result.Episode.Part = parsedInt + 1;
- if (partComponents.Count() == 2)
- {
- if (int.TryParse(partComponents[1], out parsedInt))
- {
- result.Episode.PartCount = parsedInt;
- }
- }
- }
- }
- }
- }
-
- public void ProcessQuality(XmlReader reader, XmlTvProgram result)
- {
- result.Quality = reader.ReadElementContentAsString();
- }
-
- public void ProcessPreviouslyShown(XmlReader reader, XmlTvProgram result)
- {
- //
- var value = reader.GetAttribute("start");
- if (!string.IsNullOrEmpty(value))
- {
- // TODO: this may not be correct = validate it
- result.PreviouslyShown = ParseDate(value);
- if (result.PreviouslyShown != result.StartDate)
- {
- result.IsPreviouslyShown = true;
- }
- }
- else
- {
- result.IsPreviouslyShown = true;
- }
-
- reader.Skip(); // Move on
- }
-
- public void ProcessNew(XmlReader reader, XmlTvProgram result)
- {
- result.IsNew = true;
- reader.Skip(); // Move on
- }
-
- public void ProcessCategory(XmlReader reader, XmlTvProgram result)
- {
- /*
- News
- */
-
- result.Categories = result.Categories ?? new List();
- ProcessMultipleNodes(reader, s => result.Categories.Add(s), _language);
-
- //result.Categories.Add(reader.ReadElementContentAsString());
- }
- public void ProcessCountry(XmlReader reader, XmlTvProgram result)
- {
- /*
- Canadá
- EE.UU
- */
-
- result.Countries = result.Countries ?? new List();
- ProcessNode(reader, s => result.Countries.Add(s), _language);
- }
-
- public void ProcessSubTitle(XmlReader reader, XmlTvProgram result)
- {
- /*
- Gino's Italian Escape - Islands in the Sun: Southern Sardinia Celebrate the Sea
- 8782
- */
- ProcessNode(reader, s => result.Episode.Title = s, _language);
- }
-
- public void ProcessDescription(XmlReader reader, XmlTvProgram result)
- {
- ProcessNode(reader, s => result.Description = s, _language);
- }
-
- public void ProcessTitleNode(XmlReader reader, XmlTvProgram result)
- {
- // Gino's Italian Escape
- ProcessNode(reader, s => result.Title = s, _language);
- }
-
- public void ProcessPremiereNode(XmlReader reader, XmlTvProgram result)
- {
- // Gino's Italian Escape
- ProcessNode(reader,
- s =>
- {
- if (result.Premiere == null)
- {
- result.Premiere = new XmlTvPremiere() { Details = s };
- }
- else
- {
- result.Premiere.Details = s;
- }
- }, _language);
- }
-
- public XmlTvIcon ProcessIconNode(XmlReader reader)
- {
- var result = new XmlTvIcon();
- var isPopulated = false;
-
- var source = reader.GetAttribute("src");
- if (!string.IsNullOrEmpty(source))
- {
- result.Source = source;
- isPopulated = true;
- }
-
- var widthString = reader.GetAttribute("width");
- var width = 0;
- if (!string.IsNullOrEmpty(widthString) && int.TryParse(widthString, out width))
- {
- result.Width = width;
- isPopulated = true;
- }
-
- var heightString = reader.GetAttribute("height");
- var height = 0;
- if (!string.IsNullOrEmpty(heightString) && int.TryParse(heightString, out height))
- {
- result.Height = height;
- isPopulated = true;
- }
-
- return isPopulated ? result : null;
- }
-
-
- //public void ProcessNodeWithLanguage(XmlReader reader, Action setter)
- //{
- // var currentElementName = reader.Name;
- // var result = string.Empty;
- // var resultCandidate = reader.ReadElementContentAsString();
- // var exactMatchFound = false;
-
- // while (reader.Name == currentElementName)
- // {
- // var language = reader.GetAttribute("lang");
- // resultCandidate = reader.ReadElementContentAsString();
-
- // if (language == _language && !exactMatchFound)
- // {
- // result = resultCandidate;
- // }
-
- // reader.Skip();
- // }
-
- // result = String.IsNullOrEmpty(result) ? resultCandidate : result;
- // setter(result);
- //}
-
- public void ProcessNode(XmlReader reader, Action setter, string languageRequired = null, Action allOccurrencesSetter = null)
- {
- /* Homes Under the Hammer - Spanish
- * Homes Under the Hammer - Spanish 2
- * Homes Under the Hammer - English
- * Homes Under the Hammer - English 2
- * Homes Under the Hammer - Empty Language
- * Homes Under the Hammer - Empty Language 2
- * Homes Under the Hammer - No Language
- * Homes Under the Hammer - No Language 2
- */
-
- /* Expected Behaviour:
- * - Language = Null Homes Under the Hammer - No Language
- * - Language = "" Homes Under the Hammer - No Language
- * - Language = es Homes Under the Hammer - Spanish
- * - Language = en Homes Under the Hammer - English
- */
-
- var results = new List>();
-
- // We will always use the first value - so that if there are no matches we can return something
- var currentElementName = reader.Name;
-
- var lang = reader.HasAttributes ? reader.GetAttribute("lang") : null;
- var currentValue = reader.ReadElementContentAsString();
- results.Add(new Tuple(currentValue, lang));
-
- if (allOccurrencesSetter != null)
- {
- allOccurrencesSetter(currentValue);
- }
-
- while (!reader.EOF && reader.ReadState == ReadState.Interactive)
- {
- if (reader.NodeType == XmlNodeType.Element)
- {
- if (reader.Name == currentElementName)
- {
- lang = reader.HasAttributes ? reader.GetAttribute("lang") : null;
- currentValue = reader.ReadElementContentAsString();
-
- if (allOccurrencesSetter != null)
- {
- allOccurrencesSetter(currentValue);
- }
-
- results.Add(new Tuple(currentValue, lang));
- }
- else
- {
- break;
- }
- }
- else
- {
- reader.Read();
- }
- }
-
- if (languageRequired != null)
- {
- foreach (var result in results)
- {
- if (string.Equals(languageRequired, result.Item2, StringComparison.OrdinalIgnoreCase))
- {
- setter(result.Item1);
- return;
- }
- }
- }
-
- foreach (var result in results)
- {
- if (string.IsNullOrWhiteSpace(result.Item2))
- {
- setter(result.Item1);
- return;
- }
- }
-
- foreach (var result in results)
- {
- setter(result.Item1);
- return;
- }
- }
-
- public void ProcessMultipleNodes(XmlReader reader, Action setter, string languageRequired = null)
- {
- /* Property - English
- * Property - English 2
- * Property - Spanish
- * Property - Spanish 2
- * Property - Empty Language
- * Property - Empty Language 2
- * Property - No Language
- * Property - No Language 2
- */
-
- /* Expected Behaviour:
- * - Language = Null Property - No Language / Property - No Language 2
- * - Language = "" Property - Empty Language / Property - Empty Language 2
- * - Language = es Property - Spanish / Property - Spanish 2
- * - Language = en Property - English / Property - English 2
- */
-
- var currentElementName = reader.Name;
- var values = new[] { new { Language = reader.GetAttribute("lang"), Value = reader.ReadElementContentAsString() } }.ToList();
-
- while (reader.Read())
- {
- if (reader.NodeType == XmlNodeType.Element && reader.Name != currentElementName)
- {
- break;
- }
-
- if (reader.NodeType == XmlNodeType.Element && reader.Name == currentElementName)
- {
- values.Add(new { Language = reader.GetAttribute("lang"), Value = reader.ReadElementContentAsString() });
- }
- }
-
- if (values.Count(v => v.Language == languageRequired) > 0)
- {
- values.RemoveAll(v => v.Language != languageRequired);
- }
-
- // ENumerate and return all the matches
- foreach (var result in values)
- {
- setter(result.Value);
- }
- }
-
- public void ProcessMultipleNodesWithLanguage(XmlReader reader, Action setter)
- {
- var currentElementName = reader.Name;
- while (reader.Name == currentElementName)
- {
- var language = reader.GetAttribute("lang");
- if (string.IsNullOrEmpty(_language) || string.IsNullOrEmpty(language) || language == _language)
- {
- setter(reader.ReadElementContentAsString());
- }
- reader.Skip();
- }
- }
-
- private void PopulateHeader(XmlReader reader, XmlTvProgram result)
- {
- result.ChannelId = reader.GetAttribute("channel");
-
- var startValue = reader.GetAttribute("start");
- if (string.IsNullOrEmpty(startValue))
- {
- // Log.Error(" programme#{0} doesnt contain a start date", iChannel);
- result.StartDate = DateTimeOffset.MinValue;
- }
- else
- {
- result.StartDate = ParseDate(startValue).GetValueOrDefault();
- }
-
-
- var endValue = reader.GetAttribute("stop");
- if (string.IsNullOrEmpty(endValue))
- {
- // Log.Error(" programme#{0} doesnt contain an end date", iChannel);
- result.EndDate = DateTimeOffset.MinValue;
- }
- else
- {
- result.EndDate = ParseDate(endValue).GetValueOrDefault();
- }
- }
-
- public const string _regDateWithOffset = @"^(?[0-9]{4,14})(\s(?[+-]*[0-9]{1,4}))?$";
-
- public DateTimeOffset? ParseDate(string dateValue)
- {
- /*
- All dates and times in this DTD follow the same format, loosely based
- on ISO 8601. They can be 'YYYYMMDDhhmmss' or some initial
- substring, for example if you only know the year and month you can
- have 'YYYYMM'. You can also append a timezone to the end; if no
- explicit timezone is given, UTC is assumed. Examples:
- '200007281733 BST', '200209', '19880523083000 +0300'. (BST == +0100.)
- */
-
- if (string.IsNullOrEmpty(dateValue))
- {
- return null;
- }
-
- var completeDate = "20000101000000";
- var dateComponent = string.Empty;
- var dateOffset = "+00:00";
- var match = Regex.Match(dateValue, _regDateWithOffset);
- if (match.Success)
- {
- dateComponent = match.Groups["dateDigits"].Value;
- if (!string.IsNullOrEmpty(match.Groups["dateOffset"].Value))
- {
- dateOffset = match.Groups["dateOffset"].Value; // Add in the colon to ease parsing later
- if (dateOffset.Length == 5)
- {
- dateOffset = dateOffset.Insert(3, ":"); // Add in the colon to ease parsing later
- }
- else
- {
- dateOffset = "+00:00";
- }
- }
- }
-
- // Pad out the date component part to 14 characaters so 2016061509 becomes 20160615090000
- if (dateComponent.Length < 14)
- {
- dateComponent = dateComponent + completeDate.Substring(dateComponent.Length, completeDate.Length - dateComponent.Length);
- }
-
- var standardDate = string.Format("{0} {1}", dateComponent, dateOffset);
- if (DateTimeOffset.TryParseExact(standardDate, "yyyyMMddHHmmss zzz", CultureInfo.CurrentCulture, DateTimeStyles.None, out DateTimeOffset parsedDateTime))
- {
- return parsedDateTime.ToUniversalTime();
- }
-
- // Logger.LogWarning("Unable to parse the date {0} from standardised form {1}", dateValue, standardDate);
-
- return null;
- }
-
- public string StandardiseDate(string value)
- {
- var completeDate = "20000101000000";
- var dateComponent = string.Empty;
- var dateOffset = "+0000";
-
- var match = Regex.Match(value, _regDateWithOffset);
- if (match.Success)
- {
- dateComponent = match.Groups["dateDigits"].Value;
- dateOffset = match.Groups["dateOffset"].Value;
- }
-
- // Pad out the date component part to 14 characaters so 2016061509 becomes 20160615090000
- if (dateComponent.Length < 14)
- {
- dateComponent = dateComponent + completeDate.Substring(dateComponent.Length, completeDate.Length - dateComponent.Length);
- }
-
- return string.Format("{0} {1}", dateComponent, dateOffset);
- }
- }
-}
diff --git a/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj b/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj
deleted file mode 100644
index 04f558173..000000000
--- a/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
- netstandard2.0
- false
- true
-
-
-
-
-
-
-
diff --git a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvChannel.cs b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvChannel.cs
deleted file mode 100644
index 2673d711c..000000000
--- a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvChannel.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using System;
-using System.Text;
-
-namespace Emby.XmlTv.Entities
-{
- public class XmlTvChannel : IEquatable
- {
- public string Id { get; set; }
- public string DisplayName { get; set; }
- public string Number { get; set; }
- public string Url { get; set; }
- public XmlTvIcon Icon { get; set; }
-
- public bool Equals(XmlTvChannel other)
- {
- // If both are null, or both are same instance, return true.
- if (ReferenceEquals(this, other))
- {
- return true;
- }
-
- // If the other is null then return false
- if (other == null)
- {
- return false;
- }
-
- // Return true if the fields match:
- return Id == other.Id;
- }
-
- public override int GetHashCode()
- {
- return (Id.GetHashCode() * 17);
- }
-
- public override string ToString()
- {
- var builder = new StringBuilder();
- builder.AppendFormat("{0} - {1} ", Id, DisplayName);
-
- if (!string.IsNullOrEmpty(Url))
- {
- builder.AppendFormat(" ({0})", Url);
- }
-
- return builder.ToString();
- }
- }
-}
diff --git a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvCredit.cs b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvCredit.cs
deleted file mode 100644
index d959ce76f..000000000
--- a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvCredit.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace Emby.XmlTv.Entities
-{
- public class XmlTvCredit
- {
- public XmlTvCreditType Type { get; set; }
- public string Name { get; set; }
-
- public override string ToString()
- {
- return string.Format("{0} - ({1})", Name, Type);
- }
- }
-}
diff --git a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvCreditType.cs b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvCreditType.cs
deleted file mode 100644
index 31c7f5e44..000000000
--- a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvCreditType.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace Emby.XmlTv.Entities
-{
- public enum XmlTvCreditType
- {
- NotSpecified = 0,
- Director,
- Actor,
- Writer,
- Adapter,
- Producer,
- Composer,
- Editor,
- Presenter,
- Commentator,
- Guest
- }
-}
diff --git a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvEpisode.cs b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvEpisode.cs
deleted file mode 100644
index 47525b57c..000000000
--- a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvEpisode.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using System.Text;
-
-namespace Emby.XmlTv.Entities
-{
- public class XmlTvEpisode
- {
- public int? Series { get; set; }
- public int? SeriesCount { get; set; }
- public int? Episode { get; set; }
- public int? EpisodeCount { get; set; }
- public string Title { get; set; }
- public int? Part { get; set; }
- public int? PartCount { get; set; }
-
- public override string ToString()
- {
- var builder = new StringBuilder();
- if (Series.HasValue || SeriesCount.HasValue)
- {
- builder.AppendFormat("Series {0}", Series.HasValue ? Series.Value.ToString() : "?");
- if (SeriesCount.HasValue)
- {
- builder.AppendFormat(" of {0}", SeriesCount);
- }
- }
-
- if (Episode.HasValue || EpisodeCount.HasValue)
- {
- builder.Append(builder.Length > 0 ? ", " : string.Empty);
- builder.AppendFormat("Episode {0}", Episode.HasValue ? Episode.Value.ToString() : "?");
- if (EpisodeCount.HasValue)
- {
- builder.AppendFormat(" of {0}", EpisodeCount);
- }
- }
-
- if (Part.HasValue || PartCount.HasValue)
- {
- builder.Append(builder.Length > 0 ? ", " : string.Empty);
- builder.AppendFormat("Part {0}", Part.HasValue ? Part.Value.ToString() : "?");
- if (PartCount.HasValue)
- {
- builder.AppendFormat(" of {0}", PartCount);
- }
- }
-
- return builder.ToString();
- }
- }
-
-
-}
diff --git a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvIcon.cs b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvIcon.cs
deleted file mode 100644
index 77ef8d5fd..000000000
--- a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvIcon.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System.Text;
-
-namespace Emby.XmlTv.Entities
-{
- public class XmlTvIcon
- {
- public string Source { get; set; }
- public int? Width { get; set; }
- public int? Height { get; set; }
-
- public override string ToString()
- {
- var builder = new StringBuilder();
- builder.AppendFormat("Source: {0}", Source);
- if (Width.HasValue)
- {
- builder.AppendFormat(", Width: {0}", Width);
- }
- if (Height.HasValue)
- {
- builder.AppendFormat(", Height: {0}", Height);
- }
-
- return builder.ToString();
- }
- }
-}
diff --git a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvLanguage.cs b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvLanguage.cs
deleted file mode 100644
index 0fd5573cd..000000000
--- a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvLanguage.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace Emby.XmlTv.Entities
-{
- public class XmlTvLanguage
- {
- ///
- /// The name.
- ///
- public string Name { get; set; }
-
- ///
- /// The relevance (number of occurances) of the language, can be used to order (desc)
- ///
- public int Relevance { get; set; }
- }
-}
diff --git a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvPremiere.cs b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvPremiere.cs
deleted file mode 100644
index a1920bc77..000000000
--- a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvPremiere.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace Emby.XmlTv.Entities
-{
- public class XmlTvPremiere
- {
- /*
-
- First showing on national terrestrial TV
-
- */
-
- public string Details { get; set; }
- }
-}
diff --git a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvProgram.cs b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvProgram.cs
deleted file mode 100644
index 1725e17d7..000000000
--- a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvProgram.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Emby.XmlTv.Entities
-{
- public class XmlTvProgram : IEquatable
- {
- public string ChannelId { get; set; }
-
- public DateTimeOffset StartDate { get; set; }
-
- public DateTimeOffset EndDate { get; set; }
-
- public string Title { get; set; }
-
- public string Description { get; set; }
- public string ProgramId { get; set; }
- public string Quality { get; set; }
-
- public List Categories { get; set; }
-
- public List Countries { get; set; }
-
- public DateTimeOffset? PreviouslyShown { get; set; }
-
- public bool IsPreviouslyShown { get; set; }
- public bool IsNew { get; set; }
-
- public DateTimeOffset? CopyrightDate { get; set; }
-
- public XmlTvEpisode Episode { get; set; }
-
- public List Credits { get; set; }
-
- public XmlTvRating Rating { get; set; }
-
- public float? StarRating { get; set; }
-
- public XmlTvIcon Icon { get; set; }
-
- public XmlTvPremiere Premiere { get; set; }
-
- public Dictionary ProviderIds { get; set; }
- public Dictionary SeriesProviderIds { get; set; }
-
- public XmlTvProgram()
- {
- Credits = new List();
- Categories = new List();
- Countries = new List();
- Episode = new XmlTvEpisode();
-
- ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase);
- SeriesProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase);
- }
-
- public bool Equals(XmlTvProgram other)
- {
- // If both are null, or both are same instance, return true.
- if (ReferenceEquals(this, other))
- {
- return true;
- }
-
- // If the other is null then return false
- if (other == null)
- {
- return false;
- }
-
- // Return true if the fields match:
- return ChannelId == other.ChannelId &&
- StartDate == other.StartDate &&
- EndDate == other.EndDate;
- }
-
- public override int GetHashCode()
- {
- return (ChannelId.GetHashCode() * 17) + (StartDate.GetHashCode() * 17) + (EndDate.GetHashCode() * 17);
- }
-
- public override string ToString()
- {
- var builder = new StringBuilder();
- builder.AppendFormat("ChannelId: \t\t{0}\r\n", ChannelId);
- builder.AppendFormat("Title: \t\t{0}\r\n", Title);
- builder.AppendFormat("StartDate: \t\t{0}\r\n", StartDate);
- builder.AppendFormat("EndDate: \t\t{0}\r\n", EndDate);
- return builder.ToString();
- }
- }
-}
diff --git a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvRating.cs b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvRating.cs
deleted file mode 100644
index e37113d7a..000000000
--- a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvRating.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System.Text;
-
-namespace Emby.XmlTv.Entities
-{
- ///
- /// Describes the rating (certification) applied to a program
- ///
- /// Example XML:
- ///
- public class XmlTvRating
- {
- ///
- /// The literal name of the rating system
- ///
- /// MPAA
- public string System { get; set; }
-
- ///
- /// Describes the rating using the system specificed
- ///
- /// TV-14
- public string Value { get; set; }
-
- public override string ToString()
- {
- var builder = new StringBuilder();
- if (!string.IsNullOrEmpty(Value))
- {
- builder.Append(Value);
- }
-
- if (!string.IsNullOrEmpty(System))
- {
- builder.AppendFormat(" ({0})", System);
- }
-
- return builder.ToString();
- }
- }
-}
diff --git a/Emby.XmlTv/Emby.XmlTv/Properties/AssemblyInfo.cs b/Emby.XmlTv/Emby.XmlTv/Properties/AssemblyInfo.cs
deleted file mode 100644
index 7beec09cb..000000000
--- a/Emby.XmlTv/Emby.XmlTv/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("XmlTv")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Jellyfin Project")]
-[assembly: AssemblyProduct("Jellyfin Server")]
-[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-[assembly: NeutralResourcesLanguage("en")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
diff --git a/Emby.XmlTv/Emby.XmlTv/XmlTvSchema.dtd b/Emby.XmlTv/Emby.XmlTv/XmlTvSchema.dtd
deleted file mode 100644
index 889939224..000000000
--- a/Emby.XmlTv/Emby.XmlTv/XmlTvSchema.dtd
+++ /dev/null
@@ -1,575 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Emby.XmlTv/License.txt b/Emby.XmlTv/License.txt
deleted file mode 100644
index 3c4f73ddb..000000000
--- a/Emby.XmlTv/License.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2016 Alex Stevens
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/Emby.XmlTv/Nuget/Emby.XmlTv.nuspec b/Emby.XmlTv/Nuget/Emby.XmlTv.nuspec
deleted file mode 100644
index 087ce1e6e..000000000
--- a/Emby.XmlTv/Nuget/Emby.XmlTv.nuspec
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- Emby.XmlTv
- 1.0.19
- Emby.XmlTv
- Emby Team
- ebr,Luke,scottisafool
- https://github.com/MediaBrowser/Emby.XmlTv
- http://www.mb3admin.com/images/mb3icons1-1.png
- false
- An XmlTv parsing library.
- Copyright © Emby 2013
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Emby.XmlTv/README.md b/Emby.XmlTv/README.md
deleted file mode 100644
index 86e777bb2..000000000
--- a/Emby.XmlTv/README.md
+++ /dev/null
@@ -1 +0,0 @@
-# Emby.XmlTv
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs
index 0542807af..1a3657c92 100644
--- a/MediaBrowser.Api/ApiEntryPoint.cs
+++ b/MediaBrowser.Api/ApiEntryPoint.cs
@@ -10,11 +10,9 @@ using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
-using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Session;
-using MediaBrowser.Model.Diagnostics;
-using MediaBrowser.Model.Dto;
+using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Session;
using Microsoft.Extensions.Logging;
@@ -22,26 +20,24 @@ using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api
{
///
- /// Class ServerEntryPoint
+ /// Class ServerEntryPoint.
///
public class ApiEntryPoint : IServerEntryPoint
{
///
- /// The instance
+ /// The instance.
///
public static ApiEntryPoint Instance;
///
- /// Gets or sets the logger.
+ /// The logger.
///
- /// The logger.
- internal ILogger Logger { get; private set; }
- internal IHttpResultFactory ResultFactory { get; private set; }
+ private ILogger _logger;
///
- /// Gets the configuration manager.
+ /// The configuration manager.
///
- internal IServerConfigurationManager ConfigurationManager { get; }
+ private IServerConfigurationManager _serverConfigurationManager;
private readonly ISessionManager _sessionManager;
private readonly IFileSystem _fileSystem;
@@ -70,18 +66,16 @@ namespace MediaBrowser.Api
ISessionManager sessionManager,
IServerConfigurationManager config,
IFileSystem fileSystem,
- IMediaSourceManager mediaSourceManager,
- IHttpResultFactory resultFactory)
+ IMediaSourceManager mediaSourceManager)
{
- Logger = logger;
+ _logger = logger;
_sessionManager = sessionManager;
- ConfigurationManager = config;
+ _serverConfigurationManager = config;
_fileSystem = fileSystem;
_mediaSourceManager = mediaSourceManager;
- ResultFactory = resultFactory;
- _sessionManager.PlaybackProgress += _sessionManager_PlaybackProgress;
- _sessionManager.PlaybackStart += _sessionManager_PlaybackStart;
+ _sessionManager.PlaybackProgress += OnPlaybackProgress;
+ _sessionManager.PlaybackStart += OnPlaybackStart;
Instance = this;
}
@@ -115,7 +109,7 @@ namespace MediaBrowser.Api
}
}
- private void _sessionManager_PlaybackStart(object sender, PlaybackProgressEventArgs e)
+ private void OnPlaybackStart(object sender, PlaybackProgressEventArgs e)
{
if (!string.IsNullOrWhiteSpace(e.PlaySessionId))
{
@@ -123,7 +117,7 @@ namespace MediaBrowser.Api
}
}
- void _sessionManager_PlaybackProgress(object sender, PlaybackProgressEventArgs e)
+ private void OnPlaybackProgress(object sender, PlaybackProgressEventArgs e)
{
if (!string.IsNullOrWhiteSpace(e.PlaySessionId))
{
@@ -140,17 +134,9 @@ namespace MediaBrowser.Api
{
DeleteEncodedMediaCache();
}
- catch (FileNotFoundException)
- {
- // Don't clutter the log
- }
- catch (IOException)
- {
- // Don't clutter the log
- }
catch (Exception ex)
{
- Logger.LogError(ex, "Error deleting encoded media cache");
+ _logger.LogError(ex, "Error deleting encoded media cache");
}
return Task.CompletedTask;
@@ -161,8 +147,7 @@ namespace MediaBrowser.Api
///
private void DeleteEncodedMediaCache()
{
- var path = ConfigurationManager.GetTranscodePath();
-
+ var path = _serverConfigurationManager.GetTranscodePath();
if (!Directory.Exists(path))
{
return;
@@ -174,9 +159,7 @@ namespace MediaBrowser.Api
}
}
- ///
- /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- ///
+ ///
public void Dispose()
{
Dispose(true);
@@ -219,8 +202,8 @@ namespace MediaBrowser.Api
_activeTranscodingJobs.Clear();
_transcodingLocks.Clear();
- _sessionManager.PlaybackProgress -= _sessionManager_PlaybackProgress;
- _sessionManager.PlaybackStart -= _sessionManager_PlaybackStart;
+ _sessionManager.PlaybackProgress -= OnPlaybackProgress;
+ _sessionManager.PlaybackStart -= OnPlaybackStart;
_disposed = true;
}
@@ -252,7 +235,7 @@ namespace MediaBrowser.Api
{
lock (_activeTranscodingJobs)
{
- var job = new TranscodingJob(Logger)
+ var job = new TranscodingJob(_logger)
{
Type = type,
Path = path,
@@ -406,12 +389,13 @@ namespace MediaBrowser.Api
public void OnTranscodeEndRequest(TranscodingJob job)
{
job.ActiveRequestCount--;
- Logger.LogDebug("OnTranscodeEndRequest job.ActiveRequestCount={0}", job.ActiveRequestCount);
+ _logger.LogDebug("OnTranscodeEndRequest job.ActiveRequestCount={0}", job.ActiveRequestCount);
if (job.ActiveRequestCount <= 0)
{
PingTimer(job, false);
}
}
+
internal void PingTranscodingJob(string playSessionId, bool? isUserPaused)
{
if (string.IsNullOrEmpty(playSessionId))
@@ -419,7 +403,7 @@ namespace MediaBrowser.Api
throw new ArgumentNullException(nameof(playSessionId));
}
- Logger.LogDebug("PingTranscodingJob PlaySessionId={0} isUsedPaused: {1}", playSessionId, isUserPaused);
+ _logger.LogDebug("PingTranscodingJob PlaySessionId={0} isUsedPaused: {1}", playSessionId, isUserPaused);
List jobs;
@@ -434,9 +418,10 @@ namespace MediaBrowser.Api
{
if (isUserPaused.HasValue)
{
- Logger.LogDebug("Setting job.IsUserPaused to {0}. jobId: {1}", isUserPaused, job.Id);
+ _logger.LogDebug("Setting job.IsUserPaused to {0}. jobId: {1}", isUserPaused, job.Id);
job.IsUserPaused = isUserPaused.Value;
}
+
PingTimer(job, true);
}
}
@@ -489,7 +474,7 @@ namespace MediaBrowser.Api
}
}
- Logger.LogInformation("Transcoding kill timer stopped for JobId {0} PlaySessionId {1}. Killing transcoding", job.Id, job.PlaySessionId);
+ _logger.LogInformation("Transcoding kill timer stopped for JobId {0} PlaySessionId {1}. Killing transcoding", job.Id, job.PlaySessionId);
await KillTranscodingJob(job, true, path => true);
}
@@ -558,7 +543,7 @@ namespace MediaBrowser.Api
{
job.DisposeKillTimer();
- Logger.LogDebug("KillTranscodingJob - JobId {0} PlaySessionId {1}. Killing transcoding", job.Id, job.PlaySessionId);
+ _logger.LogDebug("KillTranscodingJob - JobId {0} PlaySessionId {1}. Killing transcoding", job.Id, job.PlaySessionId);
lock (_activeTranscodingJobs)
{
@@ -590,14 +575,14 @@ namespace MediaBrowser.Api
{
try
{
- Logger.LogInformation("Stopping ffmpeg process with q command for {Path}", job.Path);
+ _logger.LogInformation("Stopping ffmpeg process with q command for {Path}", job.Path);
process.StandardInput.WriteLine("q");
// Need to wait because killing is asynchronous
if (!process.WaitForExit(5000))
{
- Logger.LogInformation("Killing ffmpeg process for {Path}", job.Path);
+ _logger.LogInformation("Killing ffmpeg process for {Path}", job.Path);
process.Kill();
}
}
@@ -620,7 +605,7 @@ namespace MediaBrowser.Api
}
catch (Exception ex)
{
- Logger.LogError(ex, "Error closing live stream for {Path}", job.Path);
+ _logger.LogError(ex, "Error closing live stream for {Path}", job.Path);
}
}
}
@@ -632,7 +617,7 @@ namespace MediaBrowser.Api
return;
}
- Logger.LogInformation("Deleting partial stream file(s) {Path}", path);
+ _logger.LogInformation("Deleting partial stream file(s) {Path}", path);
await Task.Delay(delayMs).ConfigureAwait(false);
@@ -646,20 +631,16 @@ namespace MediaBrowser.Api
{
DeleteHlsPartialStreamFiles(path);
}
- }
- catch (FileNotFoundException)
- {
-
}
catch (IOException ex)
{
- Logger.LogError(ex, "Error deleting partial stream file(s) {Path}", path);
+ _logger.LogError(ex, "Error deleting partial stream file(s) {Path}", path);
await DeletePartialStreamFiles(path, jobType, retryCount + 1, 500).ConfigureAwait(false);
}
catch (Exception ex)
{
- Logger.LogError(ex, "Error deleting partial stream file(s) {Path}", path);
+ _logger.LogError(ex, "Error deleting partial stream file(s) {Path}", path);
}
}
@@ -669,7 +650,10 @@ namespace MediaBrowser.Api
/// The output file path.
private void DeleteProgressivePartialStreamFiles(string outputFilePath)
{
- _fileSystem.DeleteFile(outputFilePath);
+ if (File.Exists(outputFilePath))
+ {
+ _fileSystem.DeleteFile(outputFilePath);
+ }
}
///
@@ -684,178 +668,24 @@ namespace MediaBrowser.Api
var filesToDelete = _fileSystem.GetFilePaths(directory)
.Where(f => f.IndexOf(name, StringComparison.OrdinalIgnoreCase) != -1);
- Exception e = null;
-
+ List exs = null;
foreach (var file in filesToDelete)
{
try
{
- Logger.LogDebug("Deleting HLS file {0}", file);
+ _logger.LogDebug("Deleting HLS file {0}", file);
_fileSystem.DeleteFile(file);
- }
- catch (FileNotFoundException)
- {
-
}
catch (IOException ex)
{
- e = ex;
- Logger.LogError(ex, "Error deleting HLS file {Path}", file);
+ (exs ??= new List(4)).Add(ex);
+ _logger.LogError(ex, "Error deleting HLS file {Path}", file);
}
}
- if (e != null)
+ if (exs != null)
{
- throw e;
- }
- }
- }
-
- ///
- /// Class TranscodingJob
- ///
- public class TranscodingJob
- {
- ///
- /// Gets or sets the play session identifier.
- ///
- /// The play session identifier.
- public string PlaySessionId { get; set; }
- ///
- /// Gets or sets the live stream identifier.
- ///
- /// The live stream identifier.
- public string LiveStreamId { get; set; }
-
- public bool IsLiveOutput { get; set; }
-
- ///
- /// Gets or sets the path.
- ///
- /// The path.
- public MediaSourceInfo MediaSource { get; set; }
- public string Path { get; set; }
- ///
- /// Gets or sets the type.
- ///
- /// The type.
- public TranscodingJobType Type { get; set; }
- ///
- /// Gets or sets the process.
- ///
- /// The process.
- public Process Process { get; set; }
- public ILogger Logger { get; private set; }
- ///
- /// Gets or sets the active request count.
- ///
- /// The active request count.
- public int ActiveRequestCount { get; set; }
- ///
- /// Gets or sets the kill timer.
- ///
- /// The kill timer.
- private Timer KillTimer { get; set; }
-
- public string DeviceId { get; set; }
-
- public CancellationTokenSource CancellationTokenSource { get; set; }
-
- public object ProcessLock = new object();
-
- public bool HasExited { get; set; }
- public bool IsUserPaused { get; set; }
-
- public string Id { get; set; }
-
- public float? Framerate { get; set; }
- public double? CompletionPercentage { get; set; }
-
- public long? BytesDownloaded { get; set; }
- public long? BytesTranscoded { get; set; }
- public int? BitRate { get; set; }
-
- public long? TranscodingPositionTicks { get; set; }
- public long? DownloadPositionTicks { get; set; }
-
- public TranscodingThrottler TranscodingThrottler { get; set; }
-
- private readonly object _timerLock = new object();
-
- public DateTime LastPingDate { get; set; }
- public int PingTimeout { get; set; }
-
- public TranscodingJob(ILogger logger)
- {
- Logger = logger;
- }
-
- public void StopKillTimer()
- {
- lock (_timerLock)
- {
- if (KillTimer != null)
- {
- KillTimer.Change(Timeout.Infinite, Timeout.Infinite);
- }
- }
- }
-
- public void DisposeKillTimer()
- {
- lock (_timerLock)
- {
- if (KillTimer != null)
- {
- KillTimer.Dispose();
- KillTimer = null;
- }
- }
- }
-
- public void StartKillTimer(Action
private readonly IUserManager _userManager;
- ///
- /// The _user data repository
- ///
- private readonly IUserDataManager _userDataRepository;
///
/// The _library manager
///
private readonly ILibraryManager _libraryManager;
private readonly IDtoService _dtoService;
- private readonly ICollectionManager _collectionManager;
private readonly ILocalizationManager _localizationManager;
private readonly IJsonSerializer _json;
private readonly IAuthorizationContext _authContext;
- public TrailersService(IUserManager userManager, IUserDataManager userDataRepository, ILibraryManager libraryManager, IDtoService dtoService, ICollectionManager collectionManager, ILocalizationManager localizationManager, IJsonSerializer json, IAuthorizationContext authContext)
+ public TrailersService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IDtoService dtoService,
+ ILocalizationManager localizationManager,
+ IJsonSerializer json,
+ IAuthorizationContext authContext)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
_userManager = userManager;
- _userDataRepository = userDataRepository;
_libraryManager = libraryManager;
_dtoService = dtoService;
- _collectionManager = collectionManager;
_localizationManager = localizationManager;
_json = json;
_authContext = authContext;
@@ -61,7 +65,15 @@ namespace MediaBrowser.Api.Movies
getItems.IncludeItemTypes = "Trailer";
- return new ItemsService(_userManager, _libraryManager, _localizationManager, _dtoService, _authContext)
+ return new ItemsService(
+ Logger,
+ ServerConfigurationManager,
+ ResultFactory,
+ _userManager,
+ _libraryManager,
+ _localizationManager,
+ _dtoService,
+ _authContext)
{
Request = Request,
diff --git a/MediaBrowser.Api/Music/AlbumsService.cs b/MediaBrowser.Api/Music/AlbumsService.cs
index 2cd3a1003..58c95d053 100644
--- a/MediaBrowser.Api/Music/AlbumsService.cs
+++ b/MediaBrowser.Api/Music/AlbumsService.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
@@ -8,6 +9,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.Music
{
@@ -41,7 +43,17 @@ namespace MediaBrowser.Api.Music
private readonly IDtoService _dtoService;
private readonly IAuthorizationContext _authContext;
- public AlbumsService(IUserManager userManager, IUserDataManager userDataRepository, ILibraryManager libraryManager, IItemRepository itemRepo, IDtoService dtoService, IAuthorizationContext authContext)
+ public AlbumsService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IUserManager userManager,
+ IUserDataManager userDataRepository,
+ ILibraryManager libraryManager,
+ IItemRepository itemRepo,
+ IDtoService dtoService,
+ IAuthorizationContext authContext)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
_userManager = userManager;
_userDataRepository = userDataRepository;
diff --git a/MediaBrowser.Api/Music/InstantMixService.cs b/MediaBrowser.Api/Music/InstantMixService.cs
index 875f0a8de..cacec8d64 100644
--- a/MediaBrowser.Api/Music/InstantMixService.cs
+++ b/MediaBrowser.Api/Music/InstantMixService.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
@@ -8,6 +9,7 @@ using MediaBrowser.Controller.Playlists;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.Music
{
@@ -62,7 +64,16 @@ namespace MediaBrowser.Api.Music
private readonly IMusicManager _musicManager;
private readonly IAuthorizationContext _authContext;
- public InstantMixService(IUserManager userManager, IDtoService dtoService, IMusicManager musicManager, ILibraryManager libraryManager, IAuthorizationContext authContext)
+ public InstantMixService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IUserManager userManager,
+ IDtoService dtoService,
+ IMusicManager musicManager,
+ ILibraryManager libraryManager,
+ IAuthorizationContext authContext)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
_userManager = userManager;
_dtoService = dtoService;
diff --git a/MediaBrowser.Api/PackageService.cs b/MediaBrowser.Api/PackageService.cs
index 1e5a93210..afc3e026a 100644
--- a/MediaBrowser.Api/PackageService.cs
+++ b/MediaBrowser.Api/PackageService.cs
@@ -2,14 +2,14 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
-using System.Threading;
using System.Threading.Tasks;
-using MediaBrowser.Common;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Updates;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Services;
using MediaBrowser.Model.Updates;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api
{
@@ -118,12 +118,15 @@ namespace MediaBrowser.Api
public class PackageService : BaseApiService
{
private readonly IInstallationManager _installationManager;
- private readonly IApplicationHost _appHost;
- public PackageService(IInstallationManager installationManager, IApplicationHost appHost)
+ public PackageService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IInstallationManager installationManager)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
_installationManager = installationManager;
- _appHost = appHost;
}
///
@@ -133,10 +136,11 @@ namespace MediaBrowser.Api
/// System.Object.
public object Get(GetPackage request)
{
- var packages = _installationManager.GetAvailablePackages().Result;
-
- var result = packages.FirstOrDefault(p => string.Equals(p.guid, request.AssemblyGuid ?? "none", StringComparison.OrdinalIgnoreCase))
- ?? packages.FirstOrDefault(p => p.name.Equals(request.Name, StringComparison.OrdinalIgnoreCase));
+ var packages = _installationManager.GetAvailablePackages().GetAwaiter().GetResult();
+ var result = _installationManager.FilterPackages(
+ packages,
+ request.Name,
+ string.IsNullOrEmpty(request.AssemblyGuid) ? default : Guid.Parse(request.AssemblyGuid)).FirstOrDefault();
return ToOptimizedResult(result);
}
@@ -181,7 +185,7 @@ namespace MediaBrowser.Api
var package = _installationManager.GetCompatibleVersions(
packages,
request.Name,
- new Guid(request.AssemblyGuid),
+ string.IsNullOrEmpty(request.AssemblyGuid) ? Guid.Empty : Guid.Parse(request.AssemblyGuid),
string.IsNullOrEmpty(request.Version) ? null : Version.Parse(request.Version),
request.UpdateClass).FirstOrDefault();
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 4bd729aac..1e9cd3313 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -33,12 +33,6 @@ namespace MediaBrowser.Api.Playback
{
protected virtual bool EnableOutputInSubFolder => false;
- ///
- /// Gets or sets the application paths.
- ///
- /// The application paths.
- protected IServerConfigurationManager ServerConfigurationManager { get; private set; }
-
///
/// Gets or sets the user manager.
///
@@ -89,7 +83,9 @@ namespace MediaBrowser.Api.Playback
/// Initializes a new instance of the class.
///
protected BaseStreamingService(
- IServerConfigurationManager serverConfig,
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
IUserManager userManager,
ILibraryManager libraryManager,
IIsoManager isoManager,
@@ -101,8 +97,8 @@ namespace MediaBrowser.Api.Playback
IMediaSourceManager mediaSourceManager,
IJsonSerializer jsonSerializer,
IAuthorizationContext authorizationContext)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
- ServerConfigurationManager = serverConfig;
UserManager = userManager;
LibraryManager = libraryManager;
IsoManager = isoManager;
@@ -588,7 +584,7 @@ namespace MediaBrowser.Api.Playback
}
///
- /// Parses query parameters as StreamOptions
+ /// Parses query parameters as StreamOptions.
///
/// The stream request.
private void ParseStreamOptions(StreamRequest request)
diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
index 27eb67ee6..8fdc6fa49 100644
--- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
@@ -12,7 +12,6 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Configuration;
-using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Serialization;
@@ -25,6 +24,39 @@ namespace MediaBrowser.Api.Playback.Hls
///
public abstract class BaseHlsService : BaseStreamingService
{
+ public BaseHlsService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IIsoManager isoManager,
+ IMediaEncoder mediaEncoder,
+ IFileSystem fileSystem,
+ IDlnaManager dlnaManager,
+ ISubtitleEncoder subtitleEncoder,
+ IDeviceManager deviceManager,
+ IMediaSourceManager mediaSourceManager,
+ IJsonSerializer jsonSerializer,
+ IAuthorizationContext authorizationContext)
+ : base(
+ logger,
+ serverConfigurationManager,
+ httpResultFactory,
+ userManager,
+ libraryManager,
+ isoManager,
+ mediaEncoder,
+ fileSystem,
+ dlnaManager,
+ subtitleEncoder,
+ deviceManager,
+ mediaSourceManager,
+ jsonSerializer,
+ authorizationContext)
+ {
+ }
+
///
/// Gets the audio arguments.
///
@@ -313,33 +345,5 @@ namespace MediaBrowser.Api.Playback.Hls
{
return 0;
}
-
- public BaseHlsService(
- IServerConfigurationManager serverConfig,
- IUserManager userManager,
- ILibraryManager libraryManager,
- IIsoManager isoManager,
- IMediaEncoder mediaEncoder,
- IFileSystem fileSystem,
- IDlnaManager dlnaManager,
- ISubtitleEncoder subtitleEncoder,
- IDeviceManager deviceManager,
- IMediaSourceManager mediaSourceManager,
- IJsonSerializer jsonSerializer,
- IAuthorizationContext authorizationContext)
- : base(serverConfig,
- userManager,
- libraryManager,
- isoManager,
- mediaEncoder,
- fileSystem,
- dlnaManager,
- subtitleEncoder,
- deviceManager,
- mediaSourceManager,
- jsonSerializer,
- authorizationContext)
- {
- }
}
}
diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
index 9ecb5fe8c..56758db96 100644
--- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
@@ -94,9 +94,10 @@ namespace MediaBrowser.Api.Playback.Hls
[Authenticated]
public class DynamicHlsService : BaseHlsService
{
-
public DynamicHlsService(
- IServerConfigurationManager serverConfig,
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
IUserManager userManager,
ILibraryManager libraryManager,
IIsoManager isoManager,
@@ -109,7 +110,10 @@ namespace MediaBrowser.Api.Playback.Hls
IJsonSerializer jsonSerializer,
IAuthorizationContext authorizationContext,
INetworkManager networkManager)
- : base(serverConfig,
+ : base(
+ logger,
+ serverConfigurationManager,
+ httpResultFactory,
userManager,
libraryManager,
isoManager,
@@ -945,7 +949,17 @@ namespace MediaBrowser.Api.Playback.Hls
var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
- args += " " + EncodingHelper.GetVideoQualityParam(state, codec, encodingOptions, GetDefaultEncoderPreset()) + keyFrameArg;
+ args += " " + EncodingHelper.GetVideoQualityParam(state, codec, encodingOptions, GetDefaultEncoderPreset());
+
+ // 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");
+ }
+ 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 ca5a73ff1..bb12ab1f0 100644
--- a/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
+++ b/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
@@ -8,6 +8,7 @@ using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.Playback.Hls
{
@@ -83,19 +84,22 @@ namespace MediaBrowser.Api.Playback.Hls
public class HlsSegmentService : BaseApiService
{
- private readonly IServerConfigurationManager _config;
private readonly IFileSystem _fileSystem;
- public HlsSegmentService(IServerConfigurationManager config, IFileSystem fileSystem)
+ public HlsSegmentService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IFileSystem fileSystem)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
- _config = config;
_fileSystem = fileSystem;
}
public Task Get(GetHlsPlaylistLegacy request)
{
var file = request.PlaylistId + Path.GetExtension(Request.PathInfo);
- file = Path.Combine(_config.GetTranscodePath(), file);
+ file = Path.Combine(ServerConfigurationManager.GetTranscodePath(), file);
return GetFileResult(file, file);
}
@@ -113,7 +117,8 @@ namespace MediaBrowser.Api.Playback.Hls
public Task Get(GetHlsVideoSegmentLegacy request)
{
var file = request.SegmentId + Path.GetExtension(Request.PathInfo);
- var transcodeFolderPath = _config.GetTranscodePath();
+ var transcodeFolderPath = ServerConfigurationManager.GetTranscodePath();
+
file = Path.Combine(transcodeFolderPath, file);
var normalizedPlaylistId = request.PlaylistId;
@@ -133,7 +138,7 @@ namespace MediaBrowser.Api.Playback.Hls
{
// TODO: Deprecate with new iOS app
var file = request.SegmentId + Path.GetExtension(Request.PathInfo);
- file = Path.Combine(_config.GetTranscodePath(), file);
+ file = Path.Combine(ServerConfigurationManager.GetTranscodePath(), file);
return ResultFactory.GetStaticFileResult(Request, file, FileShareMode.ReadWrite);
}
diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs
index 4a5f4025b..6d12a1ccd 100644
--- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs
@@ -12,6 +12,7 @@ using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.Playback.Hls
{
@@ -137,7 +138,9 @@ namespace MediaBrowser.Api.Playback.Hls
}
public VideoHlsService(
- IServerConfigurationManager serverConfig,
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
IUserManager userManager,
ILibraryManager libraryManager,
IIsoManager isoManager,
@@ -149,7 +152,10 @@ namespace MediaBrowser.Api.Playback.Hls
IMediaSourceManager mediaSourceManager,
IJsonSerializer jsonSerializer,
IAuthorizationContext authorizationContext)
- : base(serverConfig,
+ : base(
+ logger,
+ serverConfigurationManager,
+ httpResultFactory,
userManager,
libraryManager,
isoManager,
diff --git a/MediaBrowser.Api/Playback/MediaInfoService.cs b/MediaBrowser.Api/Playback/MediaInfoService.cs
index da8f99a3d..c3032416b 100644
--- a/MediaBrowser.Api/Playback/MediaInfoService.cs
+++ b/MediaBrowser.Api/Playback/MediaInfoService.cs
@@ -69,36 +69,34 @@ namespace MediaBrowser.Api.Playback
private readonly IMediaSourceManager _mediaSourceManager;
private readonly IDeviceManager _deviceManager;
private readonly ILibraryManager _libraryManager;
- private readonly IServerConfigurationManager _config;
private readonly INetworkManager _networkManager;
private readonly IMediaEncoder _mediaEncoder;
private readonly IUserManager _userManager;
private readonly IJsonSerializer _json;
private readonly IAuthorizationContext _authContext;
- private readonly ILogger _logger;
public MediaInfoService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
IMediaSourceManager mediaSourceManager,
IDeviceManager deviceManager,
ILibraryManager libraryManager,
- IServerConfigurationManager config,
INetworkManager networkManager,
IMediaEncoder mediaEncoder,
IUserManager userManager,
IJsonSerializer json,
- IAuthorizationContext authContext,
- ILoggerFactory loggerFactory)
+ IAuthorizationContext authContext)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
_mediaSourceManager = mediaSourceManager;
_deviceManager = deviceManager;
_libraryManager = libraryManager;
- _config = config;
_networkManager = networkManager;
_mediaEncoder = mediaEncoder;
_userManager = userManager;
_json = json;
_authContext = authContext;
- _logger = loggerFactory.CreateLogger(nameof(MediaInfoService));
}
public object Get(GetBitrateTestBytes request)
@@ -275,7 +273,7 @@ namespace MediaBrowser.Api.Playback
catch (Exception ex)
{
mediaSources = new List();
- _logger.LogError(ex, "Could not find media sources for item id {id}", id);
+ Logger.LogError(ex, "Could not find media sources for item id {id}", id);
// TODO PlaybackException ??
//result.ErrorCode = ex.ErrorCode;
}
@@ -533,7 +531,7 @@ namespace MediaBrowser.Api.Playback
if (remoteClientMaxBitrate <= 0)
{
- remoteClientMaxBitrate = _config.Configuration.RemoteClientBitrateLimit;
+ remoteClientMaxBitrate = ServerConfigurationManager.Configuration.RemoteClientBitrateLimit;
}
if (remoteClientMaxBitrate > 0)
diff --git a/MediaBrowser.Api/Playback/Progressive/AudioService.cs b/MediaBrowser.Api/Playback/Progressive/AudioService.cs
index dfe4b2b8e..11527007b 100644
--- a/MediaBrowser.Api/Playback/Progressive/AudioService.cs
+++ b/MediaBrowser.Api/Playback/Progressive/AudioService.cs
@@ -10,6 +10,7 @@ using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.Playback.Progressive
{
@@ -32,8 +33,10 @@ namespace MediaBrowser.Api.Playback.Progressive
public class AudioService : BaseProgressiveStreamingService
{
public AudioService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
IHttpClient httpClient,
- IServerConfigurationManager serverConfig,
IUserManager userManager,
ILibraryManager libraryManager,
IIsoManager isoManager,
@@ -45,19 +48,22 @@ namespace MediaBrowser.Api.Playback.Progressive
IMediaSourceManager mediaSourceManager,
IJsonSerializer jsonSerializer,
IAuthorizationContext authorizationContext)
- : base(httpClient,
- serverConfig,
- userManager,
- libraryManager,
- isoManager,
- mediaEncoder,
- fileSystem,
- dlnaManager,
- subtitleEncoder,
- deviceManager,
- mediaSourceManager,
- jsonSerializer,
- authorizationContext)
+ : base(
+ logger,
+ serverConfigurationManager,
+ httpResultFactory,
+ httpClient,
+ userManager,
+ libraryManager,
+ isoManager,
+ mediaEncoder,
+ fileSystem,
+ dlnaManager,
+ subtitleEncoder,
+ deviceManager,
+ mediaSourceManager,
+ jsonSerializer,
+ authorizationContext)
{
}
diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
index 97c1a7a49..4ada90d09 100644
--- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
+++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
@@ -15,6 +15,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
namespace MediaBrowser.Api.Playback.Progressive
@@ -27,8 +28,10 @@ namespace MediaBrowser.Api.Playback.Progressive
protected IHttpClient HttpClient { get; private set; }
public BaseProgressiveStreamingService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
IHttpClient httpClient,
- IServerConfigurationManager serverConfig,
IUserManager userManager,
ILibraryManager libraryManager,
IIsoManager isoManager,
@@ -40,7 +43,10 @@ namespace MediaBrowser.Api.Playback.Progressive
IMediaSourceManager mediaSourceManager,
IJsonSerializer jsonSerializer,
IAuthorizationContext authorizationContext)
- : base(serverConfig,
+ : base(
+ logger,
+ serverConfigurationManager,
+ httpResultFactory,
userManager,
libraryManager,
isoManager,
diff --git a/MediaBrowser.Api/Playback/Progressive/VideoService.cs b/MediaBrowser.Api/Playback/Progressive/VideoService.cs
index cfc8a283d..56ec86cd4 100644
--- a/MediaBrowser.Api/Playback/Progressive/VideoService.cs
+++ b/MediaBrowser.Api/Playback/Progressive/VideoService.cs
@@ -10,6 +10,7 @@ using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.Playback.Progressive
{
@@ -69,8 +70,10 @@ namespace MediaBrowser.Api.Playback.Progressive
public class VideoService : BaseProgressiveStreamingService
{
public VideoService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
IHttpClient httpClient,
- IServerConfigurationManager serverConfig,
IUserManager userManager,
ILibraryManager libraryManager,
IIsoManager isoManager,
@@ -82,8 +85,11 @@ namespace MediaBrowser.Api.Playback.Progressive
IMediaSourceManager mediaSourceManager,
IJsonSerializer jsonSerializer,
IAuthorizationContext authorizationContext)
- : base(httpClient,
- serverConfig,
+ : base(
+ logger,
+ serverConfigurationManager,
+ httpResultFactory,
+ httpClient,
userManager,
libraryManager,
isoManager,
diff --git a/MediaBrowser.Api/Playback/UniversalAudioService.cs b/MediaBrowser.Api/Playback/UniversalAudioService.cs
index b3d8bfe59..b1450e2cc 100644
--- a/MediaBrowser.Api/Playback/UniversalAudioService.cs
+++ b/MediaBrowser.Api/Playback/UniversalAudioService.cs
@@ -76,8 +76,10 @@ namespace MediaBrowser.Api.Playback
public class UniversalAudioService : BaseApiService
{
public UniversalAudioService(
- IHttpClient httpClient,
+ ILogger logger,
IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IHttpClient httpClient,
IUserManager userManager,
ILibraryManager libraryManager,
IIsoManager isoManager,
@@ -87,15 +89,12 @@ namespace MediaBrowser.Api.Playback
IDeviceManager deviceManager,
ISubtitleEncoder subtitleEncoder,
IMediaSourceManager mediaSourceManager,
- IZipClient zipClient,
IJsonSerializer jsonSerializer,
IAuthorizationContext authorizationContext,
- IImageProcessor imageProcessor,
- INetworkManager networkManager,
- ILoggerFactory loggerFactory)
+ INetworkManager networkManager)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
HttpClient = httpClient;
- ServerConfigurationManager = serverConfigurationManager;
UserManager = userManager;
LibraryManager = libraryManager;
IsoManager = isoManager;
@@ -105,17 +104,12 @@ namespace MediaBrowser.Api.Playback
DeviceManager = deviceManager;
SubtitleEncoder = subtitleEncoder;
MediaSourceManager = mediaSourceManager;
- ZipClient = zipClient;
JsonSerializer = jsonSerializer;
AuthorizationContext = authorizationContext;
- ImageProcessor = imageProcessor;
NetworkManager = networkManager;
- _loggerFactory = loggerFactory;
- _logger = loggerFactory.CreateLogger(nameof(UniversalAudioService));
}
protected IHttpClient HttpClient { get; private set; }
- protected IServerConfigurationManager ServerConfigurationManager { get; private set; }
protected IUserManager UserManager { get; private set; }
protected ILibraryManager LibraryManager { get; private set; }
protected IIsoManager IsoManager { get; private set; }
@@ -125,13 +119,9 @@ namespace MediaBrowser.Api.Playback
protected IDeviceManager DeviceManager { get; private set; }
protected ISubtitleEncoder SubtitleEncoder { get; private set; }
protected IMediaSourceManager MediaSourceManager { get; private set; }
- protected IZipClient ZipClient { get; private set; }
protected IJsonSerializer JsonSerializer { get; private set; }
protected IAuthorizationContext AuthorizationContext { get; private set; }
- protected IImageProcessor ImageProcessor { get; private set; }
protected INetworkManager NetworkManager { get; private set; }
- private ILoggerFactory _loggerFactory;
- private ILogger _logger;
public Task Get(GetUniversalAudioStream request)
{
@@ -242,7 +232,18 @@ namespace MediaBrowser.Api.Playback
AuthorizationContext.GetAuthorizationInfo(Request).DeviceId = request.DeviceId;
- var mediaInfoService = new MediaInfoService(MediaSourceManager, DeviceManager, LibraryManager, ServerConfigurationManager, NetworkManager, MediaEncoder, UserManager, JsonSerializer, AuthorizationContext, _loggerFactory)
+ var mediaInfoService = new MediaInfoService(
+ Logger,
+ ServerConfigurationManager,
+ ResultFactory,
+ MediaSourceManager,
+ DeviceManager,
+ LibraryManager,
+ NetworkManager,
+ MediaEncoder,
+ UserManager,
+ JsonSerializer,
+ AuthorizationContext)
{
Request = Request
};
@@ -276,19 +277,22 @@ namespace MediaBrowser.Api.Playback
if (!isStatic && string.Equals(mediaSource.TranscodingSubProtocol, "hls", StringComparison.OrdinalIgnoreCase))
{
- var service = new DynamicHlsService(ServerConfigurationManager,
- UserManager,
- LibraryManager,
- IsoManager,
- MediaEncoder,
- FileSystem,
- DlnaManager,
- SubtitleEncoder,
- DeviceManager,
- MediaSourceManager,
- JsonSerializer,
- AuthorizationContext,
- NetworkManager)
+ var service = new DynamicHlsService(
+ Logger,
+ ServerConfigurationManager,
+ ResultFactory,
+ UserManager,
+ LibraryManager,
+ IsoManager,
+ MediaEncoder,
+ FileSystem,
+ DlnaManager,
+ SubtitleEncoder,
+ DeviceManager,
+ MediaSourceManager,
+ JsonSerializer,
+ AuthorizationContext,
+ NetworkManager)
{
Request = Request
};
@@ -322,8 +326,11 @@ namespace MediaBrowser.Api.Playback
}
else
{
- var service = new AudioService(HttpClient,
+ var service = new AudioService(
+ Logger,
ServerConfigurationManager,
+ ResultFactory,
+ HttpClient,
UserManager,
LibraryManager,
IsoManager,
@@ -360,6 +367,7 @@ namespace MediaBrowser.Api.Playback
{
return await service.Head(newRequest).ConfigureAwait(false);
}
+
return await service.Get(newRequest).ConfigureAwait(false);
}
}
diff --git a/MediaBrowser.Api/PlaylistService.cs b/MediaBrowser.Api/PlaylistService.cs
index 483bf98fb..953b00e35 100644
--- a/MediaBrowser.Api/PlaylistService.cs
+++ b/MediaBrowser.Api/PlaylistService.cs
@@ -1,6 +1,7 @@
using System;
using System.Linq;
using System.Threading.Tasks;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
@@ -9,6 +10,7 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Playlists;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api
{
@@ -128,7 +130,16 @@ namespace MediaBrowser.Api
private readonly ILibraryManager _libraryManager;
private readonly IAuthorizationContext _authContext;
- public PlaylistService(IDtoService dtoService, IPlaylistManager playlistManager, IUserManager userManager, ILibraryManager libraryManager, IAuthorizationContext authContext)
+ public PlaylistService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IDtoService dtoService,
+ IPlaylistManager playlistManager,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IAuthorizationContext authContext)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
_dtoService = dtoService;
_playlistManager = playlistManager;
diff --git a/MediaBrowser.Api/PluginService.cs b/MediaBrowser.Api/PluginService.cs
index af61887b2..16d3268b9 100644
--- a/MediaBrowser.Api/PluginService.cs
+++ b/MediaBrowser.Api/PluginService.cs
@@ -3,14 +3,14 @@ using System.IO;
using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Common;
-using MediaBrowser.Common.Net;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Common.Updates;
-using MediaBrowser.Controller.Devices;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api
{
@@ -150,25 +150,18 @@ namespace MediaBrowser.Api
///
private readonly IApplicationHost _appHost;
private readonly IInstallationManager _installationManager;
- private readonly INetworkManager _network;
- private readonly IDeviceManager _deviceManager;
- public PluginService(IJsonSerializer jsonSerializer,
+ public PluginService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IJsonSerializer jsonSerializer,
IApplicationHost appHost,
- IInstallationManager installationManager,
- INetworkManager network,
- IDeviceManager deviceManager)
- : base()
+ IInstallationManager installationManager)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
- if (jsonSerializer == null)
- {
- throw new ArgumentNullException(nameof(jsonSerializer));
- }
-
_appHost = appHost;
_installationManager = installationManager;
- _network = network;
- _deviceManager = deviceManager;
_jsonSerializer = jsonSerializer;
}
@@ -248,7 +241,7 @@ namespace MediaBrowser.Api
{
// We need to parse this manually because we told service stack not to with IRequiresRequestStream
// https://code.google.com/p/servicestack/source/browse/trunk/Common/ServiceStack.Text/ServiceStack.Text/Controller/PathInfo.cs
- var id = new Guid(GetPathValue(1));
+ var id = Guid.Parse(GetPathValue(1));
var plugin = _appHost.Plugins.First(p => p.Id == id) as IHasPluginConfiguration;
diff --git a/MediaBrowser.Api/Properties/AssemblyInfo.cs b/MediaBrowser.Api/Properties/AssemblyInfo.cs
index 35bcbea5c..078af3e30 100644
--- a/MediaBrowser.Api/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.Api/Properties/AssemblyInfo.cs
@@ -1,5 +1,6 @@
using System.Reflection;
using System.Resources;
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
@@ -14,6 +15,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
+[assembly: InternalsVisibleTo("Jellyfin.Api.Tests")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
diff --git a/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs b/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs
index b7e94b73f..2bd387229 100644
--- a/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs
+++ b/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs
@@ -6,6 +6,7 @@ using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Services;
using MediaBrowser.Model.Tasks;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.ScheduledTasks
{
@@ -85,27 +86,23 @@ namespace MediaBrowser.Api.ScheduledTasks
public class ScheduledTaskService : BaseApiService
{
///
- /// Gets or sets the task manager.
+ /// The task manager.
///
- /// The task manager.
- private ITaskManager TaskManager { get; set; }
-
- private readonly IServerConfigurationManager _config;
+ private readonly ITaskManager _taskManager;
///
/// Initializes a new instance of the class.
///
/// The task manager.
/// taskManager
- public ScheduledTaskService(ITaskManager taskManager, IServerConfigurationManager config)
+ public ScheduledTaskService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ ITaskManager taskManager)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
- if (taskManager == null)
- {
- throw new ArgumentNullException(nameof(taskManager));
- }
-
- TaskManager = taskManager;
- _config = config;
+ _taskManager = taskManager;
}
///
@@ -115,7 +112,7 @@ namespace MediaBrowser.Api.ScheduledTasks
/// IEnumerable{TaskInfo}.
public object Get(GetScheduledTasks request)
{
- IEnumerable result = TaskManager.ScheduledTasks
+ IEnumerable result = _taskManager.ScheduledTasks
.OrderBy(i => i.Name);
if (request.IsHidden.HasValue)
@@ -171,7 +168,7 @@ namespace MediaBrowser.Api.ScheduledTasks
/// Task not found
public object Get(GetScheduledTask request)
{
- var task = TaskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, request.Id));
+ var task = _taskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, request.Id));
if (task == null)
{
@@ -190,14 +187,14 @@ namespace MediaBrowser.Api.ScheduledTasks
/// Task not found
public void Post(StartScheduledTask request)
{
- var task = TaskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, request.Id));
+ var task = _taskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, request.Id));
if (task == null)
{
throw new ResourceNotFoundException("Task not found");
}
- TaskManager.Execute(task, new TaskOptions());
+ _taskManager.Execute(task, new TaskOptions());
}
///
@@ -207,14 +204,14 @@ namespace MediaBrowser.Api.ScheduledTasks
/// Task not found
public void Delete(StopScheduledTask request)
{
- var task = TaskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, request.Id));
+ var task = _taskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, request.Id));
if (task == null)
{
throw new ResourceNotFoundException("Task not found");
}
- TaskManager.Cancel(task);
+ _taskManager.Cancel(task);
}
///
@@ -226,9 +223,9 @@ namespace MediaBrowser.Api.ScheduledTasks
{
// We need to parse this manually because we told service stack not to with IRequiresRequestStream
// https://code.google.com/p/servicestack/source/browse/trunk/Common/ServiceStack.Text/ServiceStack.Text/Controller/PathInfo.cs
- var id = GetPathValue(1);
+ var id = GetPathValue(1).ToString();
- var task = TaskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, id, StringComparison.Ordinal));
+ var task = _taskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, id, StringComparison.Ordinal));
if (task == null)
{
diff --git a/MediaBrowser.Api/SearchService.cs b/MediaBrowser.Api/SearchService.cs
index 6c67d4fb1..0a3dc19dc 100644
--- a/MediaBrowser.Api/SearchService.cs
+++ b/MediaBrowser.Api/SearchService.cs
@@ -1,6 +1,7 @@
using System;
using System.Globalization;
using System.Linq;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
@@ -12,6 +13,7 @@ using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Search;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api
{
@@ -122,7 +124,15 @@ namespace MediaBrowser.Api
/// The library manager.
/// The dto service.
/// The image processor.
- public SearchService(ISearchEngine searchEngine, ILibraryManager libraryManager, IDtoService dtoService, IImageProcessor imageProcessor)
+ public SearchService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ ISearchEngine searchEngine,
+ ILibraryManager libraryManager,
+ IDtoService dtoService,
+ IImageProcessor imageProcessor)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
_searchEngine = searchEngine;
_libraryManager = libraryManager;
diff --git a/MediaBrowser.Api/Session/SessionsService.cs b/MediaBrowser.Api/Session/SessionsService.cs
index 6caf3b480..700861c55 100644
--- a/MediaBrowser.Api/Session/SessionsService.cs
+++ b/MediaBrowser.Api/Session/SessionsService.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Devices;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
@@ -12,6 +13,7 @@ using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Services;
using MediaBrowser.Model.Session;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.Session
{
@@ -269,12 +271,12 @@ namespace MediaBrowser.Api.Session
}
///
- /// Class SessionsService
+ /// Class SessionsService.
///
public class SessionsService : BaseApiService
{
///
- /// The _session manager
+ /// The _session manager.
///
private readonly ISessionManager _sessionManager;
@@ -283,9 +285,20 @@ namespace MediaBrowser.Api.Session
private readonly IAuthenticationRepository _authRepo;
private readonly IDeviceManager _deviceManager;
private readonly ISessionContext _sessionContext;
- private IServerApplicationHost _appHost;
+ private readonly IServerApplicationHost _appHost;
- public SessionsService(ISessionManager sessionManager, IServerApplicationHost appHost, IUserManager userManager, IAuthorizationContext authContext, IAuthenticationRepository authRepo, IDeviceManager deviceManager, ISessionContext sessionContext)
+ public SessionsService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ ISessionManager sessionManager,
+ IServerApplicationHost appHost,
+ IUserManager userManager,
+ IAuthorizationContext authContext,
+ IAuthenticationRepository authRepo,
+ IDeviceManager deviceManager,
+ ISessionContext sessionContext)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
_sessionManager = sessionManager;
_userManager = userManager;
diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.cs
deleted file mode 100644
index e69de29bb..000000000
diff --git a/MediaBrowser.Api/Subtitles/SubtitleService.cs b/MediaBrowser.Api/Subtitles/SubtitleService.cs
index 1878f51d0..c4a7ae78e 100644
--- a/MediaBrowser.Api/Subtitles/SubtitleService.cs
+++ b/MediaBrowser.Api/Subtitles/SubtitleService.cs
@@ -6,6 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
@@ -130,7 +131,18 @@ namespace MediaBrowser.Api.Subtitles
private readonly IFileSystem _fileSystem;
private readonly IAuthorizationContext _authContext;
- public SubtitleService(ILibraryManager libraryManager, ISubtitleManager subtitleManager, ISubtitleEncoder subtitleEncoder, IMediaSourceManager mediaSourceManager, IProviderManager providerManager, IFileSystem fileSystem, IAuthorizationContext authContext)
+ public SubtitleService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ ILibraryManager libraryManager,
+ ISubtitleManager subtitleManager,
+ ISubtitleEncoder subtitleEncoder,
+ IMediaSourceManager mediaSourceManager,
+ IProviderManager providerManager,
+ IFileSystem fileSystem,
+ IAuthorizationContext authContext)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
_libraryManager = libraryManager;
_subtitleManager = subtitleManager;
diff --git a/MediaBrowser.Api/SuggestionsService.cs b/MediaBrowser.Api/SuggestionsService.cs
index 4e857eafc..91f85db6f 100644
--- a/MediaBrowser.Api/SuggestionsService.cs
+++ b/MediaBrowser.Api/SuggestionsService.cs
@@ -1,5 +1,6 @@
using System;
using System.Linq;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
@@ -8,6 +9,7 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api
{
@@ -39,7 +41,15 @@ namespace MediaBrowser.Api
private readonly IUserManager _userManager;
private readonly ILibraryManager _libraryManager;
- public SuggestionsService(IDtoService dtoService, IAuthorizationContext authContext, IUserManager userManager, ILibraryManager libraryManager)
+ public SuggestionsService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IDtoService dtoService,
+ IAuthorizationContext authContext,
+ IUserManager userManager,
+ ILibraryManager libraryManager)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
_dtoService = dtoService;
_authContext = authContext;
diff --git a/MediaBrowser.Api/System/ActivityLogService.cs b/MediaBrowser.Api/System/ActivityLogService.cs
index 4d6ce1014..f95fa7ca0 100644
--- a/MediaBrowser.Api/System/ActivityLogService.cs
+++ b/MediaBrowser.Api/System/ActivityLogService.cs
@@ -1,9 +1,11 @@
using System;
using System.Globalization;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Activity;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.System
{
@@ -35,7 +37,12 @@ namespace MediaBrowser.Api.System
{
private readonly IActivityManager _activityManager;
- public ActivityLogService(IActivityManager activityManager)
+ public ActivityLogService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IActivityManager activityManager)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
_activityManager = activityManager;
}
diff --git a/MediaBrowser.Api/System/SystemService.cs b/MediaBrowser.Api/System/SystemService.cs
index 56184e18b..3a56ba701 100644
--- a/MediaBrowser.Api/System/SystemService.cs
+++ b/MediaBrowser.Api/System/SystemService.cs
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Net;
@@ -103,13 +104,19 @@ namespace MediaBrowser.Api.System
/// Initializes a new instance of the class.
///
/// The app host.
- /// The application paths.
/// The file system.
/// jsonSerializer
- public SystemService(IServerApplicationHost appHost, IApplicationPaths appPaths, IFileSystem fileSystem, INetworkManager network)
+ public SystemService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IServerApplicationHost appHost,
+ IFileSystem fileSystem,
+ INetworkManager network)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
+ _appPaths = serverConfigurationManager.ApplicationPaths;
_appHost = appHost;
- _appPaths = appPaths;
_fileSystem = fileSystem;
_network = network;
}
diff --git a/MediaBrowser.Api/TranscodingJob.cs b/MediaBrowser.Api/TranscodingJob.cs
new file mode 100644
index 000000000..6d944d19e
--- /dev/null
+++ b/MediaBrowser.Api/TranscodingJob.cs
@@ -0,0 +1,160 @@
+using System;
+using System.Diagnostics;
+using System.Threading;
+using MediaBrowser.Api.Playback;
+using MediaBrowser.Controller.MediaEncoding;
+using MediaBrowser.Model.Dto;
+using Microsoft.Extensions.Logging;
+
+namespace MediaBrowser.Api
+{
+ ///
+ /// Class TranscodingJob.
+ ///
+ public class TranscodingJob
+ {
+ ///
+ /// Gets or sets the play session identifier.
+ ///
+ /// The play session identifier.
+ public string PlaySessionId { get; set; }
+
+ ///
+ /// Gets or sets the live stream identifier.
+ ///
+ /// The live stream identifier.
+ public string LiveStreamId { get; set; }
+
+ public bool IsLiveOutput { get; set; }
+
+ ///
+ /// Gets or sets the path.
+ ///
+ /// The path.
+ public MediaSourceInfo MediaSource { get; set; }
+ public string Path { get; set; }
+ ///
+ /// Gets or sets the type.
+ ///
+ /// The type.
+ public TranscodingJobType Type { get; set; }
+ ///
+ /// Gets or sets the process.
+ ///
+ /// The process.
+ public Process Process { get; set; }
+ public ILogger Logger { get; private set; }
+ ///
+ /// Gets or sets the active request count.
+ ///
+ /// The active request count.
+ public int ActiveRequestCount { get; set; }
+ ///
+ /// Gets or sets the kill timer.
+ ///
+ /// The kill timer.
+ private Timer KillTimer { get; set; }
+
+ public string DeviceId { get; set; }
+
+ public CancellationTokenSource CancellationTokenSource { get; set; }
+
+ public object ProcessLock = new object();
+
+ public bool HasExited { get; set; }
+ public bool IsUserPaused { get; set; }
+
+ public string Id { get; set; }
+
+ public float? Framerate { get; set; }
+ public double? CompletionPercentage { get; set; }
+
+ public long? BytesDownloaded { get; set; }
+ public long? BytesTranscoded { get; set; }
+ public int? BitRate { get; set; }
+
+ public long? TranscodingPositionTicks { get; set; }
+ public long? DownloadPositionTicks { get; set; }
+
+ public TranscodingThrottler TranscodingThrottler { get; set; }
+
+ private readonly object _timerLock = new object();
+
+ public DateTime LastPingDate { get; set; }
+ public int PingTimeout { get; set; }
+
+ public TranscodingJob(ILogger logger)
+ {
+ Logger = logger;
+ }
+
+ public void StopKillTimer()
+ {
+ lock (_timerLock)
+ {
+ if (KillTimer != null)
+ {
+ KillTimer.Change(Timeout.Infinite, Timeout.Infinite);
+ }
+ }
+ }
+
+ public void DisposeKillTimer()
+ {
+ lock (_timerLock)
+ {
+ if (KillTimer != null)
+ {
+ KillTimer.Dispose();
+ KillTimer = null;
+ }
+ }
+ }
+
+ public void StartKillTimer(Action callback)
+ {
+ StartKillTimer(callback, PingTimeout);
+ }
+
+ public void StartKillTimer(Action callback, int intervalMs)
+ {
+ if (HasExited)
+ {
+ return;
+ }
+
+ lock (_timerLock)
+ {
+ if (KillTimer == null)
+ {
+ Logger.LogDebug("Starting kill timer at {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId);
+ KillTimer = new Timer(new TimerCallback(callback), this, intervalMs, Timeout.Infinite);
+ }
+ else
+ {
+ Logger.LogDebug("Changing kill timer to {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId);
+ KillTimer.Change(intervalMs, Timeout.Infinite);
+ }
+ }
+ }
+
+ public void ChangeKillTimerIfStarted()
+ {
+ if (HasExited)
+ {
+ return;
+ }
+
+ lock (_timerLock)
+ {
+ if (KillTimer != null)
+ {
+ var intervalMs = PingTimeout;
+
+ Logger.LogDebug("Changing kill timer to {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId);
+ KillTimer.Change(intervalMs, Timeout.Infinite);
+ }
+ }
+ }
+ }
+}
diff --git a/MediaBrowser.Api/TvShowsService.cs b/MediaBrowser.Api/TvShowsService.cs
index 1340bd8ef..b843f7096 100644
--- a/MediaBrowser.Api/TvShowsService.cs
+++ b/MediaBrowser.Api/TvShowsService.cs
@@ -3,17 +3,18 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using MediaBrowser.Common.Extensions;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
-using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.TV;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Services;
+using MediaBrowser.Model.Querying;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api
{
@@ -252,16 +253,11 @@ namespace MediaBrowser.Api
///
private readonly IUserManager _userManager;
- ///
- /// The _user data repository
- ///
- private readonly IUserDataManager _userDataManager;
///
/// The _library manager
///
private readonly ILibraryManager _libraryManager;
- private readonly IItemRepository _itemRepo;
private readonly IDtoService _dtoService;
private readonly ITVSeriesManager _tvSeriesManager;
private readonly IAuthorizationContext _authContext;
@@ -272,12 +268,19 @@ namespace MediaBrowser.Api
/// The user manager.
/// The user data repository.
/// The library manager.
- public TvShowsService(IUserManager userManager, IUserDataManager userDataManager, ILibraryManager libraryManager, IItemRepository itemRepo, IDtoService dtoService, ITVSeriesManager tvSeriesManager, IAuthorizationContext authContext)
+ public TvShowsService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IDtoService dtoService,
+ ITVSeriesManager tvSeriesManager,
+ IAuthorizationContext authContext)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
_userManager = userManager;
- _userDataManager = userDataManager;
_libraryManager = libraryManager;
- _itemRepo = itemRepo;
_dtoService = dtoService;
_tvSeriesManager = tvSeriesManager;
_authContext = authContext;
@@ -482,7 +485,7 @@ namespace MediaBrowser.Api
if (string.Equals(request.SortBy, ItemSortBy.Random, StringComparison.OrdinalIgnoreCase))
{
- episodes = episodes.OrderBy(i => Guid.NewGuid()).ToList();
+ episodes.Shuffle();
}
var returnItems = episodes;
diff --git a/MediaBrowser.Api/UserLibrary/ArtistsService.cs b/MediaBrowser.Api/UserLibrary/ArtistsService.cs
index a30f8adfe..adb0a440f 100644
--- a/MediaBrowser.Api/UserLibrary/ArtistsService.cs
+++ b/MediaBrowser.Api/UserLibrary/ArtistsService.cs
@@ -1,14 +1,15 @@
using System;
using System.Collections.Generic;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
-using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.UserLibrary
{
@@ -49,6 +50,27 @@ namespace MediaBrowser.Api.UserLibrary
[Authenticated]
public class ArtistsService : BaseItemsByNameService
{
+ public ArtistsService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IUserDataManager userDataRepository,
+ IDtoService dtoService,
+ IAuthorizationContext authorizationContext)
+ : base(
+ logger,
+ serverConfigurationManager,
+ httpResultFactory,
+ userManager,
+ libraryManager,
+ userDataRepository,
+ dtoService,
+ authorizationContext)
+ {
+ }
+
///
/// Gets the specified request.
///
@@ -122,9 +144,5 @@ namespace MediaBrowser.Api.UserLibrary
{
throw new NotImplementedException();
}
-
- public ArtistsService(IUserManager userManager, ILibraryManager libraryManager, IUserDataManager userDataRepository, IItemRepository itemRepository, IDtoService dtoService, IAuthorizationContext authorizationContext) : base(userManager, libraryManager, userDataRepository, itemRepository, dtoService, authorizationContext)
- {
- }
}
}
diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs
index e3c9ae58e..9fa222d32 100644
--- a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs
+++ b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs
@@ -1,14 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using MediaBrowser.Controller.Configuration;
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;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.UserLibrary
{
@@ -19,37 +20,47 @@ namespace MediaBrowser.Api.UserLibrary
public abstract class BaseItemsByNameService : BaseApiService
where TItemType : BaseItem, IItemByName
{
- ///
- /// The _user manager
- ///
- protected readonly IUserManager UserManager;
- ///
- /// The library manager
- ///
- protected readonly ILibraryManager LibraryManager;
- protected readonly IUserDataManager UserDataRepository;
- protected readonly IItemRepository ItemRepository;
- protected IDtoService DtoService { get; private set; }
- protected IAuthorizationContext AuthorizationContext { get; private set; }
-
///
/// Initializes a new instance of the class.
///
/// The user manager.
/// The library manager.
/// The user data repository.
- /// The item repository.
/// The dto service.
- protected BaseItemsByNameService(IUserManager userManager, ILibraryManager libraryManager, IUserDataManager userDataRepository, IItemRepository itemRepository, IDtoService dtoService, IAuthorizationContext authorizationContext)
+ protected BaseItemsByNameService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IUserDataManager userDataRepository,
+ IDtoService dtoService,
+ IAuthorizationContext authorizationContext)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
UserManager = userManager;
LibraryManager = libraryManager;
UserDataRepository = userDataRepository;
- ItemRepository = itemRepository;
DtoService = dtoService;
AuthorizationContext = authorizationContext;
}
+ ///
+ /// Gets the _user manager.
+ ///
+ protected IUserManager UserManager { get; }
+
+ ///
+ /// Gets the library manager
+ ///
+ protected ILibraryManager LibraryManager { get; }
+
+ protected IUserDataManager UserDataRepository { get; }
+
+ protected IDtoService DtoService { get; }
+
+ protected IAuthorizationContext AuthorizationContext { get; }
+
protected BaseItem GetParentItem(GetItemsByName request)
{
BaseItem parentItem;
diff --git a/MediaBrowser.Api/UserLibrary/GenresService.cs b/MediaBrowser.Api/UserLibrary/GenresService.cs
index 0c04d02dd..13bb88ca8 100644
--- a/MediaBrowser.Api/UserLibrary/GenresService.cs
+++ b/MediaBrowser.Api/UserLibrary/GenresService.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
@@ -9,6 +10,7 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.UserLibrary
{
@@ -47,6 +49,27 @@ namespace MediaBrowser.Api.UserLibrary
[Authenticated]
public class GenresService : BaseItemsByNameService
{
+ public GenresService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IUserDataManager userDataRepository,
+ IDtoService dtoService,
+ IAuthorizationContext authorizationContext)
+ : base(
+ logger,
+ serverConfigurationManager,
+ httpResultFactory,
+ userManager,
+ libraryManager,
+ userDataRepository,
+ dtoService,
+ authorizationContext)
+ {
+ }
+
///
/// Gets the specified request.
///
@@ -114,9 +137,5 @@ namespace MediaBrowser.Api.UserLibrary
{
throw new NotImplementedException();
}
-
- public GenresService(IUserManager userManager, ILibraryManager libraryManager, IUserDataManager userDataRepository, IItemRepository itemRepository, IDtoService dtoService, IAuthorizationContext authorizationContext) : base(userManager, libraryManager, userDataRepository, itemRepository, dtoService, authorizationContext)
- {
- }
}
}
diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs
index b4a302648..c7b505171 100644
--- a/MediaBrowser.Api/UserLibrary/ItemsService.cs
+++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
-using System.Diagnostics;
using System.Globalization;
using System.Linq;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
@@ -58,25 +58,17 @@ namespace MediaBrowser.Api.UserLibrary
/// The library manager.
/// The localization.
/// The dto service.
- public ItemsService(IUserManager userManager, ILibraryManager libraryManager, ILocalizationManager localization, IDtoService dtoService, IAuthorizationContext authContext)
+ public ItemsService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ ILocalizationManager localization,
+ IDtoService dtoService,
+ IAuthorizationContext authContext)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
- if (userManager == null)
- {
- throw new ArgumentNullException(nameof(userManager));
- }
- if (libraryManager == null)
- {
- throw new ArgumentNullException(nameof(libraryManager));
- }
- if (localization == null)
- {
- throw new ArgumentNullException(nameof(localization));
- }
- if (dtoService == null)
- {
- throw new ArgumentNullException(nameof(dtoService));
- }
-
_userManager = userManager;
_libraryManager = libraryManager;
_localization = localization;
@@ -127,6 +119,7 @@ namespace MediaBrowser.Api.UserLibrary
var result = new QueryResult
{
+ StartIndex = request.StartIndex.GetValueOrDefault(),
TotalRecordCount = itemsResult.TotalRecordCount,
Items = returnItems
};
@@ -177,6 +170,7 @@ namespace MediaBrowser.Api.UserLibrary
return new QueryResult
{
+ StartIndex = request.StartIndex.GetValueOrDefault(),
TotalRecordCount = result.TotalRecordCount,
Items = dtoList
};
@@ -237,7 +231,8 @@ namespace MediaBrowser.Api.UserLibrary
return new QueryResult
{
Items = Array.Empty(),
- TotalRecordCount = 0
+ TotalRecordCount = 0,
+ StartIndex = 0
};
}
@@ -250,7 +245,8 @@ namespace MediaBrowser.Api.UserLibrary
return new QueryResult
{
Items = itemsArray,
- TotalRecordCount = itemsArray.Length
+ TotalRecordCount = itemsArray.Length,
+ StartIndex = 0
};
}
@@ -476,7 +472,7 @@ namespace MediaBrowser.Api.UserLibrary
}
// Apply default sorting if none requested
- if (query.OrderBy.Length == 0)
+ if (query.OrderBy.Count == 0)
{
// Albums by artist
if (query.ArtistIds.Length > 0 && query.IncludeItemTypes.Length == 1 && string.Equals(query.IncludeItemTypes[0], "MusicAlbum", StringComparison.OrdinalIgnoreCase))
diff --git a/MediaBrowser.Api/UserLibrary/MusicGenresService.cs b/MediaBrowser.Api/UserLibrary/MusicGenresService.cs
index 94f5262b0..e9caca14a 100644
--- a/MediaBrowser.Api/UserLibrary/MusicGenresService.cs
+++ b/MediaBrowser.Api/UserLibrary/MusicGenresService.cs
@@ -1,14 +1,15 @@
using System;
using System.Collections.Generic;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
-using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.UserLibrary
{
@@ -38,6 +39,27 @@ namespace MediaBrowser.Api.UserLibrary
[Authenticated]
public class MusicGenresService : BaseItemsByNameService
{
+ public MusicGenresService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IUserDataManager userDataRepository,
+ IDtoService dtoService,
+ IAuthorizationContext authorizationContext)
+ : base(
+ logger,
+ serverConfigurationManager,
+ httpResultFactory,
+ userManager,
+ libraryManager,
+ userDataRepository,
+ dtoService,
+ authorizationContext)
+ {
+ }
+
///
/// Gets the specified request.
///
@@ -98,9 +120,5 @@ namespace MediaBrowser.Api.UserLibrary
{
throw new NotImplementedException();
}
-
- public MusicGenresService(IUserManager userManager, ILibraryManager libraryManager, IUserDataManager userDataRepository, IItemRepository itemRepository, IDtoService dtoService, IAuthorizationContext authorizationContext) : base(userManager, libraryManager, userDataRepository, itemRepository, dtoService, authorizationContext)
- {
- }
}
}
diff --git a/MediaBrowser.Api/UserLibrary/PersonsService.cs b/MediaBrowser.Api/UserLibrary/PersonsService.cs
index 2024e9e63..853eada25 100644
--- a/MediaBrowser.Api/UserLibrary/PersonsService.cs
+++ b/MediaBrowser.Api/UserLibrary/PersonsService.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
@@ -9,6 +10,7 @@ using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.UserLibrary
{
@@ -47,6 +49,27 @@ namespace MediaBrowser.Api.UserLibrary
[Authenticated]
public class PersonsService : BaseItemsByNameService
{
+ public PersonsService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IUserDataManager userDataRepository,
+ IDtoService dtoService,
+ IAuthorizationContext authorizationContext)
+ : base(
+ logger,
+ serverConfigurationManager,
+ httpResultFactory,
+ userManager,
+ libraryManager,
+ userDataRepository,
+ dtoService,
+ authorizationContext)
+ {
+ }
+
///
/// Gets the specified request.
///
@@ -120,9 +143,5 @@ namespace MediaBrowser.Api.UserLibrary
Items = items.Take(query.Limit ?? int.MaxValue).Select(i => (i as BaseItem, new ItemCounts())).ToArray()
};
}
-
- public PersonsService(IUserManager userManager, ILibraryManager libraryManager, IUserDataManager userDataRepository, IItemRepository itemRepository, IDtoService dtoService, IAuthorizationContext authorizationContext) : base(userManager, libraryManager, userDataRepository, itemRepository, dtoService, authorizationContext)
- {
- }
}
}
diff --git a/MediaBrowser.Api/UserLibrary/PlaystateService.cs b/MediaBrowser.Api/UserLibrary/PlaystateService.cs
index b40a92a7c..9d1cf5d9e 100644
--- a/MediaBrowser.Api/UserLibrary/PlaystateService.cs
+++ b/MediaBrowser.Api/UserLibrary/PlaystateService.cs
@@ -1,6 +1,7 @@
using System;
using System.Globalization;
using System.Threading.Tasks;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
@@ -233,7 +234,17 @@ namespace MediaBrowser.Api.UserLibrary
private readonly ISessionContext _sessionContext;
private readonly IAuthorizationContext _authContext;
- public PlaystateService(IUserManager userManager, IUserDataManager userDataRepository, ILibraryManager libraryManager, ISessionManager sessionManager, ISessionContext sessionContext, IAuthorizationContext authContext)
+ public PlaystateService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IUserManager userManager,
+ IUserDataManager userDataRepository,
+ ILibraryManager libraryManager,
+ ISessionManager sessionManager,
+ ISessionContext sessionContext,
+ IAuthorizationContext authContext)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
_userManager = userManager;
_userDataRepository = userDataRepository;
@@ -256,7 +267,7 @@ namespace MediaBrowser.Api.UserLibrary
private UserItemDataDto MarkPlayed(MarkPlayedItem request)
{
- var user = _userManager.GetUserById(request.UserId);
+ var user = _userManager.GetUserById(Guid.Parse(request.UserId));
DateTime? datePlayed = null;
@@ -406,7 +417,7 @@ namespace MediaBrowser.Api.UserLibrary
private UserItemDataDto MarkUnplayed(MarkUnplayedItem request)
{
- var user = _userManager.GetUserById(request.UserId);
+ var user = _userManager.GetUserById(Guid.Parse(request.UserId));
var session = GetSession(_sessionContext);
diff --git a/MediaBrowser.Api/UserLibrary/StudiosService.cs b/MediaBrowser.Api/UserLibrary/StudiosService.cs
index 890acc931..683ce5d09 100644
--- a/MediaBrowser.Api/UserLibrary/StudiosService.cs
+++ b/MediaBrowser.Api/UserLibrary/StudiosService.cs
@@ -1,13 +1,14 @@
using System;
using System.Collections.Generic;
+using MediaBrowser.Controller.Configuration;
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;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.UserLibrary
{
@@ -46,6 +47,27 @@ namespace MediaBrowser.Api.UserLibrary
[Authenticated]
public class StudiosService : BaseItemsByNameService
{
+ public StudiosService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IUserDataManager userDataRepository,
+ IDtoService dtoService,
+ IAuthorizationContext authorizationContext)
+ : base(
+ logger,
+ serverConfigurationManager,
+ httpResultFactory,
+ userManager,
+ libraryManager,
+ userDataRepository,
+ dtoService,
+ authorizationContext)
+ {
+ }
+
///
/// Gets the specified request.
///
@@ -106,9 +128,5 @@ namespace MediaBrowser.Api.UserLibrary
{
throw new NotImplementedException();
}
-
- public StudiosService(IUserManager userManager, ILibraryManager libraryManager, IUserDataManager userDataRepository, IItemRepository itemRepository, IDtoService dtoService, IAuthorizationContext authorizationContext) : base(userManager, libraryManager, userDataRepository, itemRepository, dtoService, authorizationContext)
- {
- }
}
}
diff --git a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs
index da0bf6dcb..2ec08f578 100644
--- a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs
+++ b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs
@@ -3,6 +3,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Extensions;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
@@ -14,6 +15,7 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.UserLibrary
{
@@ -270,7 +272,18 @@ namespace MediaBrowser.Api.UserLibrary
private readonly IFileSystem _fileSystem;
private readonly IAuthorizationContext _authContext;
- public UserLibraryService(IUserManager userManager, ILibraryManager libraryManager, IUserDataManager userDataRepository, IDtoService dtoService, IUserViewManager userViewManager, IFileSystem fileSystem, IAuthorizationContext authContext)
+ public UserLibraryService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IUserDataManager userDataRepository,
+ IDtoService dtoService,
+ IUserViewManager userViewManager,
+ IFileSystem fileSystem,
+ IAuthorizationContext authContext)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
_userManager = userManager;
_libraryManager = libraryManager;
diff --git a/MediaBrowser.Api/UserLibrary/UserViewsService.cs b/MediaBrowser.Api/UserLibrary/UserViewsService.cs
index d62049ce9..0fffb0622 100644
--- a/MediaBrowser.Api/UserLibrary/UserViewsService.cs
+++ b/MediaBrowser.Api/UserLibrary/UserViewsService.cs
@@ -1,6 +1,7 @@
using System;
using System.Globalization;
using System.Linq;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
@@ -51,11 +52,15 @@ namespace MediaBrowser.Api.UserLibrary
private readonly ILibraryManager _libraryManager;
public UserViewsService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
IUserManager userManager,
IUserViewManager userViewManager,
IDtoService dtoService,
IAuthorizationContext authContext,
ILibraryManager libraryManager)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
_userManager = userManager;
_userViewManager = userViewManager;
diff --git a/MediaBrowser.Api/UserLibrary/YearsService.cs b/MediaBrowser.Api/UserLibrary/YearsService.cs
index 0ee0fd219..07b9aff1b 100644
--- a/MediaBrowser.Api/UserLibrary/YearsService.cs
+++ b/MediaBrowser.Api/UserLibrary/YearsService.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
@@ -8,6 +9,7 @@ using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.UserLibrary
{
@@ -46,6 +48,27 @@ namespace MediaBrowser.Api.UserLibrary
[Authenticated]
public class YearsService : BaseItemsByNameService
{
+ public YearsService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IUserDataManager userDataRepository,
+ IDtoService dtoService,
+ IAuthorizationContext authorizationContext)
+ : base(
+ logger,
+ serverConfigurationManager,
+ httpResultFactory,
+ userManager,
+ libraryManager,
+ userDataRepository,
+ dtoService,
+ authorizationContext)
+ {
+ }
+
///
/// Gets the specified request.
///
@@ -105,9 +128,5 @@ namespace MediaBrowser.Api.UserLibrary
.Distinct()
.Select(year => LibraryManager.GetYear(year));
}
-
- public YearsService(IUserManager userManager, ILibraryManager libraryManager, IUserDataManager userDataRepository, IItemRepository itemRepository, IDtoService dtoService, IAuthorizationContext authorizationContext) : base(userManager, libraryManager, userDataRepository, itemRepository, dtoService, authorizationContext)
- {
- }
}
}
diff --git a/MediaBrowser.Api/UserService.cs b/MediaBrowser.Api/UserService.cs
index 2c0a0b443..e1b01b012 100644
--- a/MediaBrowser.Api/UserService.cs
+++ b/MediaBrowser.Api/UserService.cs
@@ -244,22 +244,23 @@ namespace MediaBrowser.Api
///
private readonly IUserManager _userManager;
private readonly ISessionManager _sessionMananger;
- private readonly IServerConfigurationManager _config;
private readonly INetworkManager _networkManager;
private readonly IDeviceManager _deviceManager;
private readonly IAuthorizationContext _authContext;
public UserService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
IUserManager userManager,
ISessionManager sessionMananger,
- IServerConfigurationManager config,
INetworkManager networkManager,
IDeviceManager deviceManager,
IAuthorizationContext authContext)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
_userManager = userManager;
_sessionMananger = sessionMananger;
- _config = config;
_networkManager = networkManager;
_deviceManager = deviceManager;
_authContext = authContext;
@@ -268,7 +269,7 @@ namespace MediaBrowser.Api
public object Get(GetPublicUsers request)
{
// If the startup wizard hasn't been completed then just return all users
- if (!_config.Configuration.IsStartupWizardCompleted)
+ if (!ServerConfigurationManager.Configuration.IsStartupWizardCompleted)
{
return Get(new GetUsers
{
@@ -497,9 +498,9 @@ namespace MediaBrowser.Api
/// The request.
public async Task Post(UpdateUser request)
{
- var id = GetPathValue(1);
+ var id = Guid.Parse(GetPathValue(1));
- AssertCanUpdateUser(_authContext, _userManager, new Guid(id), false);
+ AssertCanUpdateUser(_authContext, _userManager, id, false);
var dtoUser = request;
diff --git a/MediaBrowser.Api/VideosService.cs b/MediaBrowser.Api/VideosService.cs
index 474036f5c..46b6d5a94 100644
--- a/MediaBrowser.Api/VideosService.cs
+++ b/MediaBrowser.Api/VideosService.cs
@@ -7,11 +7,10 @@ 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.IO;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api
{
@@ -51,19 +50,21 @@ namespace MediaBrowser.Api
private readonly ILibraryManager _libraryManager;
private readonly IUserManager _userManager;
private readonly IDtoService _dtoService;
- private readonly IFileSystem _fileSystem;
- private readonly IItemRepository _itemRepo;
- private readonly IServerConfigurationManager _config;
private readonly IAuthorizationContext _authContext;
- public VideosService(ILibraryManager libraryManager, IUserManager userManager, IDtoService dtoService, IItemRepository itemRepo, IFileSystem fileSystem, IServerConfigurationManager config, IAuthorizationContext authContext)
+ public VideosService(
+ ILogger logger,
+ IServerConfigurationManager serverConfigurationManager,
+ IHttpResultFactory httpResultFactory,
+ ILibraryManager libraryManager,
+ IUserManager userManager,
+ IDtoService dtoService,
+ IAuthorizationContext authContext)
+ : base(logger, serverConfigurationManager, httpResultFactory)
{
_libraryManager = libraryManager;
_userManager = userManager;
_dtoService = dtoService;
- _itemRepo = itemRepo;
- _fileSystem = fileSystem;
- _config = config;
_authContext = authContext;
}
@@ -84,9 +85,8 @@ namespace MediaBrowser.Api
var dtoOptions = GetDtoOptions(_authContext, request);
- var video = item as Video;
BaseItemDto[] items;
- if (video != null)
+ if (item is Video video)
{
items = video.GetAdditionalParts()
.Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, video))
@@ -94,7 +94,7 @@ namespace MediaBrowser.Api
}
else
{
- items = new BaseItemDto[] { };
+ items = Array.Empty();
}
var result = new QueryResult
diff --git a/MediaBrowser.Common/Extensions/ShuffleExtensions.cs b/MediaBrowser.Common/Extensions/ShuffleExtensions.cs
new file mode 100644
index 000000000..5889d09c4
--- /dev/null
+++ b/MediaBrowser.Common/Extensions/ShuffleExtensions.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+
+namespace MediaBrowser.Common.Extensions
+{
+ ///
+ /// Provides Shuffle extensions methods for .
+ ///
+ public static class ShuffleExtensions
+ {
+ private static readonly Random _rng = new Random();
+
+ ///
+ /// Shuffles the items in a list.
+ ///
+ /// The list that should get shuffled.
+ /// The type.
+ public static void Shuffle(this IList list)
+ {
+ int n = list.Count;
+ while (n > 1)
+ {
+ n--;
+ int k = _rng.Next(n + 1);
+ T value = list[k];
+ list[k] = list[n];
+ list[n] = value;
+ }
+ }
+ }
+}
diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
index 78f859069..bd96059e3 100644
--- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
+++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
@@ -155,7 +155,7 @@ namespace MediaBrowser.Controller.Entities
public bool EnableGroupByMetadataKey { get; set; }
public bool? HasChapterImages { get; set; }
- public ValueTuple[] OrderBy { get; set; }
+ public IReadOnlyList<(string, SortOrder)> OrderBy { get; set; }
public DateTime? MinDateCreated { get; set; }
public DateTime? MinDateLastSaved { get; set; }
diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs
index 76cb9a651..2475b2b7e 100644
--- a/MediaBrowser.Controller/Entities/TV/Series.cs
+++ b/MediaBrowser.Controller/Entities/TV/Series.cs
@@ -226,14 +226,16 @@ namespace MediaBrowser.Controller.Entities.TV
query.AncestorWithPresentationUniqueKey = null;
query.SeriesPresentationUniqueKey = seriesKey;
- if (query.OrderBy.Length == 0)
+ if (query.OrderBy.Count == 0)
{
query.OrderBy = new[] { ItemSortBy.SortName }.Select(i => new ValueTuple(i, SortOrder.Ascending)).ToArray();
}
+
if (query.IncludeItemTypes.Length == 0)
{
query.IncludeItemTypes = new[] { typeof(Episode).Name, typeof(Season).Name };
}
+
query.IsVirtualItem = false;
return LibraryManager.GetItemsResult(query);
}
diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
index 454bdc4ae..435a1e8da 100644
--- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs
+++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
@@ -450,14 +450,16 @@ namespace MediaBrowser.Controller.Entities
return SortAndPage(items, totalRecordLimit, query, libraryManager, true);
}
- public static QueryResult SortAndPage(IEnumerable items,
+ public static QueryResult SortAndPage(
+ IEnumerable items,
int? totalRecordLimit,
InternalItemsQuery query,
- ILibraryManager libraryManager, bool enableSorting)
+ ILibraryManager libraryManager,
+ bool enableSorting)
{
if (enableSorting)
{
- if (query.OrderBy.Length > 0)
+ if (query.OrderBy.Count > 0)
{
items = libraryManager.Sort(items, query.User, query.OrderBy);
}
diff --git a/MediaBrowser.Controller/Library/IUserDataManager.cs b/MediaBrowser.Controller/Library/IUserDataManager.cs
index ce4e3f530..eb735d31a 100644
--- a/MediaBrowser.Controller/Library/IUserDataManager.cs
+++ b/MediaBrowser.Controller/Library/IUserDataManager.cs
@@ -9,7 +9,7 @@ using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Library
{
///
- /// Interface IUserDataManager
+ /// Interface IUserDataManager.
///
public interface IUserDataManager
{
@@ -26,13 +26,11 @@ namespace MediaBrowser.Controller.Library
/// The user data.
/// The reason.
/// The cancellation token.
- /// Task.
void SaveUserData(Guid userId, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
void SaveUserData(User userId, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
UserItemData GetUserData(User user, BaseItem item);
- UserItemData GetUserData(string userId, BaseItem item);
UserItemData GetUserData(Guid userId, BaseItem item);
///
diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.cs
index eea2e3a71..8d92c9f6f 100644
--- a/MediaBrowser.Controller/Library/IUserManager.cs
+++ b/MediaBrowser.Controller/Library/IUserManager.cs
@@ -49,20 +49,13 @@ namespace MediaBrowser.Controller.Library
event EventHandler> UserLockedOut;
///
- /// Gets a User by Id.
+ /// Gets a user by Id.
///
/// The id.
/// The user with the specified Id, or null if the user doesn't exist.
/// id is an empty Guid.
User GetUserById(Guid id);
- ///
- /// Gets the user by identifier.
- ///
- /// The identifier.
- /// User.
- User GetUserById(string id);
-
///
/// Gets the name of the user by.
///
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
index 0664bdd98..897e22018 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
@@ -467,6 +467,27 @@ namespace MediaBrowser.Controller.MediaEncoding
.Append(' ');
}
+ if (state.IsVideoRequest
+ && string.Equals(encodingOptions.HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
+ {
+ var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, encodingOptions);
+ var outputVideoCodec = GetVideoEncoder(state, encodingOptions);
+
+ if (encodingOptions.EnableHardwareEncoding && outputVideoCodec.Contains("qsv", StringComparison.OrdinalIgnoreCase))
+ {
+ if (!string.IsNullOrEmpty(videoDecoder) && videoDecoder.Contains("qsv", StringComparison.OrdinalIgnoreCase))
+ {
+ arg.Append("-hwaccel qsv ");
+ }
+ else
+ {
+ arg.Append("-init_hw_device qsv=hw -filter_hw_device hw ");
+ }
+ }
+
+ arg.Append(videoDecoder + " ");
+ }
+
arg.Append("-i ")
.Append(GetInputPathArgument(state));
@@ -1562,6 +1583,7 @@ namespace MediaBrowser.Controller.MediaEncoding
var videoSizeParam = string.Empty;
+ // Setup subtitle scaling
if (state.VideoStream != null && state.VideoStream.Width.HasValue && state.VideoStream.Height.HasValue)
{
videoSizeParam = string.Format(
@@ -1570,7 +1592,11 @@ namespace MediaBrowser.Controller.MediaEncoding
state.VideoStream.Width.Value,
state.VideoStream.Height.Value);
- videoSizeParam += ":force_original_aspect_ratio=decrease";
+ //For QSV, feed it into hardware encoder now
+ if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase))
+ {
+ videoSizeParam += ",hwupload=extra_hw_frames=64";
+ }
}
var mapPrefix = state.SubtitleStream.IsExternal ?
@@ -1581,9 +1607,31 @@ namespace MediaBrowser.Controller.MediaEncoding
? 0
: state.SubtitleStream.Index;
+ var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, options);
+
+ // 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))
+ {
+ /*
+ 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.
+ */
+ 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
+ {
+ 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,
- " -filter_complex \"[{0}:{1}]{4}[sub];[0:{2}][sub]overlay{3}\"",
+ retStr,
mapPrefix,
subtitleStreamIndex,
state.VideoStream.Index,
@@ -1647,31 +1695,34 @@ namespace MediaBrowser.Controller.MediaEncoding
requestedMaxWidth,
requestedMaxHeight);
- if (string.Equals(videoEncoder, "h264_vaapi", StringComparison.OrdinalIgnoreCase)
+ if ((string.Equals(videoEncoder, "h264_vaapi", StringComparison.OrdinalIgnoreCase) || string.Equals(videoEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase))
&& width.HasValue
&& height.HasValue)
{
- // Work around vaapi's reduced scaling features
- var scaler = "scale_vaapi";
-
// Given the input dimensions (inputWidth, inputHeight), determine the output dimensions
// (outputWidth, outputHeight). The user may request precise output dimensions or maximum
// output dimensions. Output dimensions are guaranteed to be even.
var outputWidth = width.Value;
var outputHeight = height.Value;
+ var vaapi_or_qsv = string.Equals(videoEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase) ? "qsv" : "vaapi";
if (!videoWidth.HasValue
|| outputWidth != videoWidth.Value
|| !videoHeight.HasValue
|| outputHeight != videoHeight.Value)
{
+ // Force nv12 pixel format to enable 10-bit to 8-bit colour conversion.
filters.Add(
string.Format(
CultureInfo.InvariantCulture,
- "{0}=w={1}:h={2}",
- scaler,
+ "scale_{0}=w={1}:h={2}:format=nv12",
+ vaapi_or_qsv,
outputWidth,
outputHeight));
+ }
+ else
+ {
+ filters.Add(string.Format(CultureInfo.InvariantCulture, "scale_{0}=format=nv12", vaapi_or_qsv));
}
}
else if ((videoDecoder ?? string.Empty).IndexOf("_cuvid", StringComparison.OrdinalIgnoreCase) != -1
@@ -1914,10 +1965,26 @@ namespace MediaBrowser.Controller.MediaEncoding
filters.Add("hwupload");
}
- if (state.DeInterlace("h264", true)
- && string.Equals(outputVideoCodec, "h264_vaapi", StringComparison.OrdinalIgnoreCase))
+ var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, options);
+
+ // 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(string.Format(CultureInfo.InvariantCulture, "deinterlace_vaapi"));
+ filters.Add("format=nv12|qsv");
+ filters.Add("hwupload=extra_hw_frames=64");
+ }
+
+ if (state.DeInterlace("h264", true))
+ {
+ if (string.Equals(outputVideoCodec, "h264_vaapi", StringComparison.OrdinalIgnoreCase))
+ {
+ filters.Add(string.Format(CultureInfo.InvariantCulture, "deinterlace_vaapi"));
+ }
+ else if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase))
+ {
+ filters.Add(string.Format(CultureInfo.InvariantCulture, "deinterlace_qsv"));
+ }
}
if ((state.DeInterlace("h264", true) || state.DeInterlace("h265", true) || state.DeInterlace("hevc", true))
@@ -1940,8 +2007,6 @@ namespace MediaBrowser.Controller.MediaEncoding
var inputHeight = videoStream?.Height;
var threeDFormat = state.MediaSource.Video3DFormat;
- var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, options);
-
filters.AddRange(GetScalingFilters(inputWidth, inputHeight, threeDFormat, videoDecoder, outputVideoCodec, request.Width, request.Height, request.MaxWidth, request.MaxHeight));
var output = string.Empty;
@@ -2134,6 +2199,7 @@ namespace MediaBrowser.Controller.MediaEncoding
}
var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, encodingOptions);
+
if (!string.IsNullOrEmpty(videoDecoder))
{
inputModifier += " " + videoDecoder;
diff --git a/MediaBrowser.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.cs
index b45043f92..3b08e72b9 100644
--- a/MediaBrowser.Controller/Playlists/Playlist.cs
+++ b/MediaBrowser.Controller/Playlists/Playlist.cs
@@ -181,7 +181,7 @@ namespace MediaBrowser.Controller.Playlists
{
Recursive = true,
IsFolder = false,
- OrderBy = new[] { ItemSortBy.SortName }.Select(i => new ValueTuple(i, SortOrder.Ascending)).ToArray(),
+ OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) },
MediaTypes = new[] { mediaType },
EnableTotalRecordCount = false,
DtoOptions = options
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index b8abe49e3..9de6fef61 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -172,16 +172,18 @@ namespace MediaBrowser.Model.Configuration
if (string.IsNullOrWhiteSpace(value))
{
// If baseUrl is empty, set an empty prefix string
- value = string.Empty;
+ _baseUrl = string.Empty;
+ return;
}
- else if (!value.StartsWith("/"))
+
+ if (value[0] != '/')
{
// If baseUrl was not configured with a leading slash, append one for consistency
value = "/" + value;
}
// Normalize the end of the string
- if (value.EndsWith("/"))
+ if (value[value.Length - 1] == '/')
{
// If baseUrl was configured with a trailing slash, remove it for consistency
value = value.Remove(value.Length - 1);
diff --git a/MediaBrowser.Model/Querying/QueryResult.cs b/MediaBrowser.Model/Querying/QueryResult.cs
index c007a45d6..221645afb 100644
--- a/MediaBrowser.Model/Querying/QueryResult.cs
+++ b/MediaBrowser.Model/Querying/QueryResult.cs
@@ -17,6 +17,12 @@ namespace MediaBrowser.Model.Querying
/// The total record count.
public int TotalRecordCount { get; set; }
+ ///
+ /// The index of the first record in Items.
+ ///
+ /// First record index.
+ public int StartIndex { get; set; }
+
public QueryResult()
{
Items = Array.Empty();
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs
index e5287048d..4269d3420 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs
@@ -35,9 +35,8 @@ namespace MediaBrowser.Providers.TV.TheTVDB
{
var list = new List();
- // The search query must either provide an episode number or date
- if (!searchInfo.IndexNumber.HasValue
- || !searchInfo.PremiereDate.HasValue
+ // Either an episode number or date must be provided; and the dictionary of provider ids must be valid
+ if ((searchInfo.IndexNumber == null && searchInfo.PremiereDate == null)
|| !TvdbSeriesProvider.IsValidSeries(searchInfo.SeriesProviderIds))
{
return list;
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
index 10ed4f073..72ceadaf1 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
@@ -170,11 +170,16 @@ namespace MediaBrowser.Providers.TV.TheTVDB
return result?.Data.First().Id.ToString();
}
+ ///
+ /// Check whether a dictionary of provider IDs includes an entry for a valid TV metadata provider.
+ ///
+ /// The dictionary to check.
+ /// True, if the dictionary contains a valid TV provider ID, otherwise false.
internal static bool IsValidSeries(Dictionary seriesProviderIds)
{
- return seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out _) ||
- seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out _) ||
- seriesProviderIds.TryGetValue(MetadataProviders.Zap2It.ToString(), out _);
+ return seriesProviderIds.ContainsKey(MetadataProviders.Tvdb.ToString()) ||
+ seriesProviderIds.ContainsKey(MetadataProviders.Imdb.ToString()) ||
+ seriesProviderIds.ContainsKey(MetadataProviders.Zap2It.ToString());
}
///
diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs
index d84bc2abb..981c3a53a 100644
--- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs
+++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs
@@ -16,7 +16,6 @@ using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.IO;
using MediaBrowser.XbmcMetadata.Configuration;
using Microsoft.Extensions.Logging;
@@ -856,7 +855,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
return;
}
- var user = userManager.GetUserById(userId);
+ var user = userManager.GetUserById(Guid.Parse(userId));
if (user == null)
{
diff --git a/MediaBrowser.sln b/MediaBrowser.sln
index 58bfb55f6..cf3f56cd9 100644
--- a/MediaBrowser.sln
+++ b/MediaBrowser.sln
@@ -36,8 +36,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Emby.Notifications", "Emby.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Emby.Naming", "Emby.Naming\Emby.Naming.csproj", "{E5AF7B26-2239-4CE0-B477-0AA2018EDAA2}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Emby.XmlTv", "Emby.XmlTv\Emby.XmlTv\Emby.XmlTv.csproj", "{6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MediaBrowser.MediaEncoding", "MediaBrowser.MediaEncoding\MediaBrowser.MediaEncoding.csproj", "{960295EE-4AF4-4440-A525-B4C295B01A61}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jellyfin.Server", "Jellyfin.Server\Jellyfin.Server.csproj", "{07E39F42-A2C6-4B32-AF8C-725F957A73FF}"
@@ -60,6 +58,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.MediaEncoding.Test
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.Naming.Tests", "tests\Jellyfin.Naming.Tests\Jellyfin.Naming.Tests.csproj", "{3998657B-1CCC-49DD-A19F-275DC8495F57}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.Api.Tests", "tests\Jellyfin.Api.Tests\Jellyfin.Api.Tests.csproj", "{A2FD0A10-8F62-4F9D-B171-FFDF9F0AFA9D}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -134,10 +134,6 @@ Global
{E5AF7B26-2239-4CE0-B477-0AA2018EDAA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5AF7B26-2239-4CE0-B477-0AA2018EDAA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5AF7B26-2239-4CE0-B477-0AA2018EDAA2}.Release|Any CPU.Build.0 = Release|Any CPU
- {6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}.Release|Any CPU.Build.0 = Release|Any CPU
{960295EE-4AF4-4440-A525-B4C295B01A61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{960295EE-4AF4-4440-A525-B4C295B01A61}.Debug|Any CPU.Build.0 = Debug|Any CPU
{960295EE-4AF4-4440-A525-B4C295B01A61}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -166,6 +162,10 @@ Global
{3998657B-1CCC-49DD-A19F-275DC8495F57}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3998657B-1CCC-49DD-A19F-275DC8495F57}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3998657B-1CCC-49DD-A19F-275DC8495F57}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A2FD0A10-8F62-4F9D-B171-FFDF9F0AFA9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A2FD0A10-8F62-4F9D-B171-FFDF9F0AFA9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A2FD0A10-8F62-4F9D-B171-FFDF9F0AFA9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A2FD0A10-8F62-4F9D-B171-FFDF9F0AFA9D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -195,5 +195,6 @@ Global
{DF194677-DFD3-42AF-9F75-D44D5A416478} = {FBBB5129-006E-4AD7-BAD5-8B7CA1D10ED6}
{28464062-0939-4AA7-9F7B-24DDDA61A7C0} = {FBBB5129-006E-4AD7-BAD5-8B7CA1D10ED6}
{3998657B-1CCC-49DD-A19F-275DC8495F57} = {FBBB5129-006E-4AD7-BAD5-8B7CA1D10ED6}
+ {A2FD0A10-8F62-4F9D-B171-FFDF9F0AFA9D} = {FBBB5129-006E-4AD7-BAD5-8B7CA1D10ED6}
EndGlobalSection
EndGlobal
diff --git a/deployment/ubuntu-package-x64/Dockerfile b/deployment/ubuntu-package-x64/Dockerfile
index 99022891b..d881c04e3 100644
--- a/deployment/ubuntu-package-x64/Dockerfile
+++ b/deployment/ubuntu-package-x64/Dockerfile
@@ -1,19 +1,28 @@
-FROM microsoft/dotnet:2.2-sdk-bionic
+FROM ubuntu:bionic
# Docker build arguments
ARG SOURCE_DIR=/jellyfin
ARG PLATFORM_DIR=/jellyfin/deployment/ubuntu-package-x64
ARG ARTIFACT_DIR=/dist
+ARG SDK_VERSION=3.0
# Docker run environment
ENV SOURCE_DIR=/jellyfin
ENV ARTIFACT_DIR=/dist
ENV DEB_BUILD_OPTIONS=noddebs
+ENV ARCH=amd64
# Prepare Ubuntu build environment
RUN apt-get update \
- && apt-get install -y apt-transport-https debhelper gnupg wget devscripts mmv libc6-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev libssl-dev \
+ && apt-get install -y apt-transport-https debhelper gnupg wget devscripts mmv libc6-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev libssl-dev liblttng-ust0 \
&& ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh \
&& mkdir -p ${SOURCE_DIR} && ln -sf ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/debian
+# Install dotnet repository
+# https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current
+RUN wget https://download.visualstudio.microsoft.com/download/pr/4f51cfd8-311d-43fe-a887-c80b40358cfd/440d10dc2091b8d0f1a12b7124034e49/dotnet-sdk-3.0.101-linux-x64.tar.gz -O dotnet-sdk.tar.gz \
+ && mkdir -p dotnet-sdk \
+ && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \
+ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet
+
# 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 \
diff --git a/tests/Jellyfin.Api.Tests/GetPathValueTests.cs b/tests/Jellyfin.Api.Tests/GetPathValueTests.cs
new file mode 100644
index 000000000..b01d1af1f
--- /dev/null
+++ b/tests/Jellyfin.Api.Tests/GetPathValueTests.cs
@@ -0,0 +1,45 @@
+using MediaBrowser.Api;
+using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Controller.Net;
+using MediaBrowser.Model.Configuration;
+using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging.Abstractions;
+using Moq;
+using Xunit;
+
+namespace Jellyfin.Api.Tests
+{
+ public class GetPathValueTests
+ {
+ [Theory]
+ [InlineData("https://localhost:8096/ScheduledTasks/1234/Triggers", "", 1, "1234")]
+ [InlineData("https://localhost:8096/emby/ScheduledTasks/1234/Triggers", "", 1, "1234")]
+ [InlineData("https://localhost:8096/mediabrowser/ScheduledTasks/1234/Triggers", "", 1, "1234")]
+ [InlineData("https://localhost:8096/jellyfin/2/ScheduledTasks/1234/Triggers", "jellyfin/2", 1, "1234")]
+ [InlineData("https://localhost:8096/jellyfin/2/emby/ScheduledTasks/1234/Triggers", "jellyfin/2", 1, "1234")]
+ [InlineData("https://localhost:8096/jellyfin/2/mediabrowser/ScheduledTasks/1234/Triggers", "jellyfin/2", 1, "1234")]
+ [InlineData("https://localhost:8096/JELLYFIN/2/ScheduledTasks/1234/Triggers", "jellyfin/2", 1, "1234")]
+ [InlineData("https://localhost:8096/JELLYFIN/2/Emby/ScheduledTasks/1234/Triggers", "jellyfin/2", 1, "1234")]
+ [InlineData("https://localhost:8096/JELLYFIN/2/MediaBrowser/ScheduledTasks/1234/Triggers", "jellyfin/2", 1, "1234")]
+ public void GetPathValueTest(string path, string baseUrl, int index, string value)
+ {
+ var reqMock = Mock.Of(x => x.PathInfo == path);
+ var conf = new ServerConfiguration()
+ {
+ BaseUrl = baseUrl
+ };
+
+ var confManagerMock = Mock.Of(x => x.Configuration == conf);
+
+ var service = new BrandingService(
+ new NullLogger(),
+ confManagerMock,
+ Mock.Of())
+ {
+ Request = reqMock
+ };
+
+ Assert.Equal(value, service.GetPathValue(index).ToString());
+ }
+ }
+}
diff --git a/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj b/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj
new file mode 100644
index 000000000..1671b8d79
--- /dev/null
+++ b/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj
@@ -0,0 +1,20 @@
+
+
+
+ netcoreapp3.0
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+