diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs
index 80ebbb719..e9f8f81f3 100644
--- a/Emby.Drawing/ImageProcessor.cs
+++ b/Emby.Drawing/ImageProcessor.cs
@@ -829,18 +829,7 @@ namespace Emby.Drawing
// Run the enhancers sequentially in order of priority
foreach (var enhancer in imageEnhancers)
{
- var typeName = enhancer.GetType().Name;
-
- try
- {
- await enhancer.EnhanceImageAsync(item, inputPath, outputPath, imageType, imageIndex).ConfigureAwait(false);
- }
- catch (Exception ex)
- {
- _logger.ErrorException("{0} failed enhancing {1}", ex, typeName, item.Name);
-
- throw;
- }
+ await enhancer.EnhanceImageAsync(item, inputPath, outputPath, imageType, imageIndex).ConfigureAwait(false);
// Feed the output into the next enhancer as input
inputPath = outputPath;
diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj
index a98637650..96d7874f0 100644
--- a/MediaBrowser.Api/MediaBrowser.Api.csproj
+++ b/MediaBrowser.Api/MediaBrowser.Api.csproj
@@ -197,6 +197,10 @@
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}
MediaBrowser.Model
+
+ {2e781478-814d-4a48-9d80-bff206441a65}
+ MediaBrowser.Server.Implementations
+
diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.cs
index ebb3204a4..4c5abc996 100644
--- a/MediaBrowser.Api/StartupWizardService.cs
+++ b/MediaBrowser.Api/StartupWizardService.cs
@@ -116,6 +116,7 @@ namespace MediaBrowser.Api
config.EnableCaseSensitiveItemIds = true;
//config.EnableFolderView = true;
config.SchemaVersion = 109;
+ config.EnableSimpleArtistDetection = true;
}
public void Post(UpdateStartupConfiguration request)
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index be88c535e..90a22b217 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -115,6 +115,22 @@ namespace MediaBrowser.Controller.Entities
[IgnoreDataMember]
public bool IsInMixedFolder { get; set; }
+ [IgnoreDataMember]
+ protected virtual bool SupportsIsInMixedFolderDetection
+ {
+ get { return false; }
+ }
+
+ public bool DetectIsInMixedFolder()
+ {
+ if (SupportsIsInMixedFolderDetection)
+ {
+
+ }
+
+ return IsInMixedFolder;
+ }
+
[IgnoreDataMember]
public virtual bool SupportsRemoteImageDownloading
{
@@ -1116,7 +1132,7 @@ namespace MediaBrowser.Controller.Entities
var hasThemeMedia = this as IHasThemeMedia;
if (hasThemeMedia != null)
{
- if (!IsInMixedFolder)
+ if (!DetectIsInMixedFolder())
{
themeSongsChanged = await RefreshThemeSongs(hasThemeMedia, options, fileSystemChildren, cancellationToken).ConfigureAwait(false);
@@ -1266,7 +1282,15 @@ namespace MediaBrowser.Controller.Entities
{
var current = this;
- return current.IsInMixedFolder == newItem.IsInMixedFolder;
+ if (!SupportsIsInMixedFolderDetection)
+ {
+ if (current.IsInMixedFolder != newItem.IsInMixedFolder)
+ {
+ return false;
+ }
+ }
+
+ return true;
}
public void AfterMetadataRefresh()
diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs
index 24910498f..a48b9f564 100644
--- a/MediaBrowser.Controller/Entities/Game.cs
+++ b/MediaBrowser.Controller/Entities/Game.cs
@@ -98,7 +98,7 @@ namespace MediaBrowser.Controller.Entities
public override IEnumerable GetDeletePaths()
{
- if (!IsInMixedFolder)
+ if (!DetectIsInMixedFolder())
{
return new[] { System.IO.Path.GetDirectoryName(Path) };
}
diff --git a/MediaBrowser.Controller/Entities/IHasImages.cs b/MediaBrowser.Controller/Entities/IHasImages.cs
index a38b7394d..1ab0566e0 100644
--- a/MediaBrowser.Controller/Entities/IHasImages.cs
+++ b/MediaBrowser.Controller/Entities/IHasImages.cs
@@ -150,11 +150,7 @@ namespace MediaBrowser.Controller.Entities
/// true if [supports local metadata]; otherwise, false.
bool SupportsLocalMetadata { get; }
- ///
- /// Gets a value indicating whether this instance is in mixed folder.
- ///
- /// true if this instance is in mixed folder; otherwise, false.
- bool IsInMixedFolder { get; }
+ bool DetectIsInMixedFolder();
///
/// Gets a value indicating whether this instance is locked.
diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs
index f0270497c..e1e336147 100644
--- a/MediaBrowser.Controller/Entities/Movies/Movie.cs
+++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs
@@ -81,7 +81,7 @@ namespace MediaBrowser.Controller.Entities.Movies
// Must have a parent to have special features
// In other words, it must be part of the Parent/Child tree
- if (LocationType == LocationType.FileSystem && GetParent() != null && !IsInMixedFolder)
+ if (LocationType == LocationType.FileSystem && GetParent() != null && !DetectIsInMixedFolder())
{
var specialFeaturesChanged = await RefreshSpecialFeatures(options, fileSystemChildren, cancellationToken).ConfigureAwait(false);
@@ -119,7 +119,7 @@ namespace MediaBrowser.Controller.Entities.Movies
{
var info = GetItemLookupInfo();
- if (!IsInMixedFolder)
+ if (!DetectIsInMixedFolder())
{
info.Name = System.IO.Path.GetFileName(ContainingFolderPath);
}
@@ -145,7 +145,7 @@ namespace MediaBrowser.Controller.Entities.Movies
else
{
// Try to get the year from the folder name
- if (!IsInMixedFolder)
+ if (!DetectIsInMixedFolder())
{
info = LibraryManager.ParseName(System.IO.Path.GetFileName(ContainingFolderPath));
diff --git a/MediaBrowser.Controller/Entities/MusicVideo.cs b/MediaBrowser.Controller/Entities/MusicVideo.cs
index 8b749b7a5..9254802dd 100644
--- a/MediaBrowser.Controller/Entities/MusicVideo.cs
+++ b/MediaBrowser.Controller/Entities/MusicVideo.cs
@@ -37,6 +37,15 @@ namespace MediaBrowser.Controller.Entities
}
}
+ [IgnoreDataMember]
+ protected override bool SupportsIsInMixedFolderDetection
+ {
+ get
+ {
+ return true;
+ }
+ }
+
public override UnratedItem GetBlockUnratedType()
{
return UnratedItem.Music;
@@ -65,7 +74,7 @@ namespace MediaBrowser.Controller.Entities
else
{
// Try to get the year from the folder name
- if (!IsInMixedFolder)
+ if (!DetectIsInMixedFolder())
{
info = LibraryManager.ParseName(System.IO.Path.GetFileName(ContainingFolderPath));
diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs
index 7a987a68e..f68cd2c85 100644
--- a/MediaBrowser.Controller/Entities/Trailer.cs
+++ b/MediaBrowser.Controller/Entities/Trailer.cs
@@ -64,7 +64,7 @@ namespace MediaBrowser.Controller.Entities
info.IsLocalTrailer = TrailerTypes.Contains(TrailerType.LocalTrailer);
- if (!IsInMixedFolder && LocationType == LocationType.FileSystem)
+ if (!DetectIsInMixedFolder() && LocationType == LocationType.FileSystem)
{
info.Name = System.IO.Path.GetFileName(ContainingFolderPath);
}
@@ -90,7 +90,7 @@ namespace MediaBrowser.Controller.Entities
else
{
// Try to get the year from the folder name
- if (!IsInMixedFolder)
+ if (!DetectIsInMixedFolder())
{
info = LibraryManager.ParseName(System.IO.Path.GetFileName(ContainingFolderPath));
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index 1406a05ce..c64cdf57d 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -480,7 +480,7 @@ namespace MediaBrowser.Controller.Entities
public override IEnumerable GetDeletePaths()
{
- if (!IsInMixedFolder)
+ if (!DetectIsInMixedFolder())
{
return new[] { ContainingFolderPath };
}
diff --git a/MediaBrowser.Controller/LiveTv/LiveStream.cs b/MediaBrowser.Controller/LiveTv/LiveStream.cs
index 7d44fbd90..a5d432a54 100644
--- a/MediaBrowser.Controller/LiveTv/LiveStream.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveStream.cs
@@ -14,6 +14,7 @@ namespace MediaBrowser.Controller.LiveTv
public ITunerHost TunerHost { get; set; }
public string OriginalStreamId { get; set; }
public bool EnableStreamSharing { get; set; }
+ public string UniqueId = Guid.NewGuid().ToString("N");
public LiveStream(MediaSourceInfo mediaSource)
{
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index e9d2054da..7c1114e22 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -287,9 +287,7 @@
-
-
diff --git a/MediaBrowser.Controller/Net/IHttpResultFactory.cs b/MediaBrowser.Controller/Net/IHttpResultFactory.cs
index 8fdb1ce37..ca453840f 100644
--- a/MediaBrowser.Controller/Net/IHttpResultFactory.cs
+++ b/MediaBrowser.Controller/Net/IHttpResultFactory.cs
@@ -11,14 +11,6 @@ namespace MediaBrowser.Controller.Net
///
public interface IHttpResultFactory
{
- ///
- /// Throws the error.
- ///
- /// The status code.
- /// The error message.
- /// The response headers.
- void ThrowError(int statusCode, string errorMessage, IDictionary responseHeaders = null);
-
///
/// Gets the result.
///
diff --git a/MediaBrowser.Controller/Providers/IImageFileSaver.cs b/MediaBrowser.Controller/Providers/IImageFileSaver.cs
deleted file mode 100644
index 3e11d8bf8..000000000
--- a/MediaBrowser.Controller/Providers/IImageFileSaver.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Collections.Generic;
-using MediaBrowser.Controller.Entities;
-using MediaBrowser.Model.Drawing;
-using MediaBrowser.Model.Entities;
-
-namespace MediaBrowser.Controller.Providers
-{
- public interface IImageFileSaver : IImageSaver
- {
- ///
- /// Gets the save paths.
- ///
- /// The item.
- /// The type.
- /// The format.
- /// The index.
- /// IEnumerable{System.String}.
- IEnumerable GetSavePaths(IHasImages item, ImageType type, ImageFormat format, int index);
- }
-}
\ No newline at end of file
diff --git a/MediaBrowser.Controller/Providers/IImageSaver.cs b/MediaBrowser.Controller/Providers/IImageSaver.cs
deleted file mode 100644
index 62017160f..000000000
--- a/MediaBrowser.Controller/Providers/IImageSaver.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace MediaBrowser.Controller.Providers
-{
- public interface IImageSaver
- {
- ///
- /// Gets the name.
- ///
- /// The name.
- string Name { get; }
- }
-}
diff --git a/MediaBrowser.Controller/Providers/IProviderManager.cs b/MediaBrowser.Controller/Providers/IProviderManager.cs
index 3eefa9647..d3e5685bb 100644
--- a/MediaBrowser.Controller/Providers/IProviderManager.cs
+++ b/MediaBrowser.Controller/Providers/IProviderManager.cs
@@ -95,15 +95,8 @@ namespace MediaBrowser.Controller.Providers
///
/// Adds the metadata providers.
///
- /// The image providers.
- /// The metadata services.
- /// The metadata providers.
- /// The savers.
- /// The image savers.
- /// The external ids.
void AddParts(IEnumerable imageProviders, IEnumerable metadataServices, IEnumerable metadataProviders,
IEnumerable savers,
- IEnumerable imageSavers,
IEnumerable externalIds);
///
diff --git a/MediaBrowser.Controller/Providers/ItemInfo.cs b/MediaBrowser.Controller/Providers/ItemInfo.cs
index 63cc48058..8de11b743 100644
--- a/MediaBrowser.Controller/Providers/ItemInfo.cs
+++ b/MediaBrowser.Controller/Providers/ItemInfo.cs
@@ -10,7 +10,7 @@ namespace MediaBrowser.Controller.Providers
{
Path = item.Path;
ContainingFolderPath = item.ContainingFolderPath;
- IsInMixedFolder = item.IsInMixedFolder;
+ IsInMixedFolder = item.DetectIsInMixedFolder();
var video = item as Video;
if (video != null)
diff --git a/MediaBrowser.Dlna/Eventing/EventManager.cs b/MediaBrowser.Dlna/Eventing/EventManager.cs
index 68f012c3a..51c8d2d91 100644
--- a/MediaBrowser.Dlna/Eventing/EventManager.cs
+++ b/MediaBrowser.Dlna/Eventing/EventManager.cs
@@ -156,7 +156,6 @@ namespace MediaBrowser.Dlna.Eventing
}
catch (OperationCanceledException)
{
- throw;
}
catch
{
diff --git a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs
index fe61a7a46..ef9160b70 100644
--- a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs
+++ b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs
@@ -132,7 +132,7 @@ namespace MediaBrowser.LocalMetadata.Images
}
var imagePrefix = item.FileNameWithoutExtension + "-";
- var isInMixedFolder = item.IsInMixedFolder;
+ var isInMixedFolder = item.DetectIsInMixedFolder();
PopulatePrimaryImages(item, images, files, imagePrefix, isInMixedFolder);
diff --git a/MediaBrowser.LocalMetadata/Savers/GameXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/GameXmlSaver.cs
index a90789a3e..5592c068c 100644
--- a/MediaBrowser.LocalMetadata/Savers/GameXmlSaver.cs
+++ b/MediaBrowser.LocalMetadata/Savers/GameXmlSaver.cs
@@ -99,7 +99,7 @@ namespace MediaBrowser.LocalMetadata.Savers
public static string GetGameSavePath(Game item)
{
- if (item.IsInMixedFolder)
+ if (item.DetectIsInMixedFolder())
{
return Path.ChangeExtension(item.Path, ".xml");
}
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs
index 33e90743a..5d0f1f075 100644
--- a/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs
@@ -76,7 +76,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
public static string GetProbeSizeArgument(bool isDvd)
{
- return isDvd ? "-probesize 1G -analyzeduration 200M" : " -analyzeduration 2M";
+ return isDvd ? "-probesize 1G -analyzeduration 200M" : "";
}
}
}
diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
index 25ad14fe8..5c3345008 100644
--- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
@@ -426,8 +426,10 @@ namespace MediaBrowser.MediaEncoding.Encoder
var inputFiles = MediaEncoderHelpers.GetInputArgument(FileSystem, request.InputPath, request.Protocol, request.MountedIso, request.PlayableStreamFileNames);
+ var probeSizeArgument = GetProbeSizeArgument(inputFiles, request.Protocol);
+
return GetMediaInfoInternal(GetInputArgument(inputFiles, request.Protocol), request.InputPath, request.Protocol, extractChapters,
- GetProbeSizeArgument(inputFiles, request.Protocol), request.MediaType == DlnaProfileType.Audio, request.VideoType, cancellationToken);
+ probeSizeArgument, request.MediaType == DlnaProfileType.Audio, request.VideoType, cancellationToken);
}
///
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index 1d2928f67..e7f8e6548 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -203,6 +203,7 @@ namespace MediaBrowser.Model.Configuration
public string[] CodecsUsed { get; set; }
public bool EnableChannelView { get; set; }
public bool EnableExternalContentInSuggestions { get; set; }
+ public bool EnableSimpleArtistDetection { get; set; }
public int ImageExtractionTimeoutMs { get; set; }
///
diff --git a/MediaBrowser.Model/Notifications/NotificationType.cs b/MediaBrowser.Model/Notifications/NotificationType.cs
index f5e3624f0..eefd15808 100644
--- a/MediaBrowser.Model/Notifications/NotificationType.cs
+++ b/MediaBrowser.Model/Notifications/NotificationType.cs
@@ -16,7 +16,6 @@ namespace MediaBrowser.Model.Notifications
PluginUpdateInstalled,
PluginUninstalled,
NewLibraryContent,
- NewLibraryContentMultiple,
ServerRestartRequired,
TaskFailed,
CameraImageUploaded,
diff --git a/MediaBrowser.Providers/Manager/ImageSaver.cs b/MediaBrowser.Providers/Manager/ImageSaver.cs
index c9b3f22c5..5203adc9d 100644
--- a/MediaBrowser.Providers/Manager/ImageSaver.cs
+++ b/MediaBrowser.Providers/Manager/ImageSaver.cs
@@ -371,7 +371,7 @@ namespace MediaBrowser.Providers.Manager
return Path.Combine(seriesFolder, imageFilename);
}
- if (item.IsInMixedFolder)
+ if (item.DetectIsInMixedFolder())
{
return GetSavePathForItemInMixedFolder(item, type, "landscape", extension);
}
@@ -447,7 +447,7 @@ namespace MediaBrowser.Providers.Manager
path = Path.Combine(Path.GetDirectoryName(item.Path), "metadata", filename + extension);
}
- else if (item.IsInMixedFolder)
+ else if (item.DetectIsInMixedFolder())
{
path = GetSavePathForItemInMixedFolder(item, type, filename, extension);
}
@@ -514,7 +514,7 @@ namespace MediaBrowser.Providers.Manager
if (imageIndex.Value == 0)
{
- if (item.IsInMixedFolder)
+ if (item.DetectIsInMixedFolder())
{
return new[] { GetSavePathForItemInMixedFolder(item, type, "fanart", extension) };
}
@@ -540,7 +540,7 @@ namespace MediaBrowser.Providers.Manager
var outputIndex = imageIndex.Value;
- if (item.IsInMixedFolder)
+ if (item.DetectIsInMixedFolder())
{
return new[] { GetSavePathForItemInMixedFolder(item, type, "fanart" + outputIndex.ToString(UsCulture), extension) };
}
@@ -583,7 +583,7 @@ namespace MediaBrowser.Providers.Manager
return new[] { Path.Combine(seasonFolder, imageFilename) };
}
- if (item.IsInMixedFolder || item is MusicVideo)
+ if (item.DetectIsInMixedFolder() || item is MusicVideo)
{
return new[] { GetSavePathForItemInMixedFolder(item, type, string.Empty, extension) };
}
diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs
index 7e28254b0..ae1d60eb9 100644
--- a/MediaBrowser.Providers/Manager/ProviderManager.cs
+++ b/MediaBrowser.Providers/Manager/ProviderManager.cs
@@ -58,7 +58,6 @@ namespace MediaBrowser.Providers.Manager
private IMetadataService[] _metadataServices = { };
private IMetadataProvider[] _metadataProviders = { };
private IEnumerable _savers;
- private IImageSaver[] _imageSavers;
private readonly IServerApplicationPaths _appPaths;
private readonly IJsonSerializer _json;
@@ -91,21 +90,14 @@ namespace MediaBrowser.Providers.Manager
///
/// Adds the metadata providers.
///
- /// The image providers.
- /// The metadata services.
- /// The metadata providers.
- /// The metadata savers.
- /// The image savers.
- /// The external ids.
public void AddParts(IEnumerable imageProviders, IEnumerable metadataServices,
IEnumerable metadataProviders, IEnumerable metadataSavers,
- IEnumerable imageSavers, IEnumerable externalIds)
+ IEnumerable externalIds)
{
ImageProviders = imageProviders.ToArray();
_metadataServices = metadataServices.OrderBy(i => i.Order).ToArray();
_metadataProviders = metadataProviders.ToArray();
- _imageSavers = imageSavers.ToArray();
_externalIds = externalIds.OrderBy(i => i.Name).ToArray();
_savers = metadataSavers.Where(i =>
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
index ca4f1b956..2572a4f58 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
@@ -41,7 +41,7 @@ namespace MediaBrowser.Providers.TV
private readonly ILibraryManager _libraryManager;
private readonly IMemoryStreamProvider _memoryStreamProvider;
- public TvdbSeriesProvider(IZipClient zipClient, IHttpClient httpClient, IFileSystem fileSystem, IServerConfigurationManager config, ILogger logger, ILibraryManager libraryManager)
+ public TvdbSeriesProvider(IZipClient zipClient, IHttpClient httpClient, IFileSystem fileSystem, IServerConfigurationManager config, ILogger logger, ILibraryManager libraryManager, IMemoryStreamProvider memoryStreamProvider)
{
_zipClient = zipClient;
_httpClient = httpClient;
@@ -49,6 +49,7 @@ namespace MediaBrowser.Providers.TV
_config = config;
_logger = logger;
_libraryManager = libraryManager;
+ _memoryStreamProvider = memoryStreamProvider;
Current = this;
}
diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs
index e84b66c5a..f7fe707da 100644
--- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs
+++ b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs
@@ -377,10 +377,10 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
DisposeLibraryUpdateTimer();
}
- if (items.Count == 1)
- {
- var item = items.First();
+ items = items.Take(10).ToList();
+ foreach (var item in items)
+ {
var notification = new NotificationRequest
{
NotificationType = NotificationType.NewLibraryContent.ToString()
@@ -388,17 +388,6 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
notification.Variables["Name"] = GetItemName(item);
- await SendNotification(notification).ConfigureAwait(false);
- }
- else
- {
- var notification = new NotificationRequest
- {
- NotificationType = NotificationType.NewLibraryContentMultiple.ToString()
- };
-
- notification.Variables["ItemCount"] = items.Count.ToString(CultureInfo.InvariantCulture);
-
await SendNotification(notification).ConfigureAwait(false);
}
}
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs
index 7dc6fbb25..2ebeb0d44 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs
@@ -94,12 +94,12 @@ namespace MediaBrowser.Server.Implementations.HttpServer
// The Markdown feature causes slow startup times (5 mins+) on cold boots for some users
// Custom format allows images
- HostConfig.Instance.EnableFeatures = Feature.Csv | Feature.Html | Feature.Json | Feature.Jsv | Feature.Metadata | Feature.Xml | Feature.CustomFormat;
+ HostConfig.Instance.EnableFeatures = Feature.Html | Feature.Json | Feature.CustomFormat;
container.Adapter = _containerAdapter;
Plugins.RemoveAll(x => x is NativeTypesFeature);
- Plugins.Add(new SwaggerFeature());
+ //Plugins.Add(new SwaggerFeature());
Plugins.Add(new CorsFeature(allowedHeaders: "Content-Type, Authorization, Range, X-MediaBrowser-Token, X-Emby-Authorization"));
//Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] {
@@ -546,8 +546,10 @@ namespace MediaBrowser.Server.Implementations.HttpServer
}
}
}
-
- throw new NotImplementedException("Cannot execute handler: " + handler + " at PathInfo: " + httpReq.PathInfo);
+ else
+ {
+ httpRes.Close();
+ }
}
///
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
index 04085d3c7..10d6f7493 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
@@ -683,29 +683,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
}
}
- ///
- /// Gets the error result.
- ///
- /// The status code.
- /// The error message.
- /// The response headers.
- /// System.Object.
- public void ThrowError(int statusCode, string errorMessage, IDictionary responseHeaders = null)
- {
- var error = new HttpError
- {
- Status = statusCode,
- ErrorCode = errorMessage
- };
-
- if (responseHeaders != null)
- {
- AddResponseHeaders(error, responseHeaders);
- }
-
- throw error;
- }
-
public object GetAsyncStreamWriter(IAsyncStreamSource streamSource)
{
return new AsyncStreamWriter(streamSource);
diff --git a/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs b/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs
deleted file mode 100644
index cac2f8e09..000000000
--- a/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs
+++ /dev/null
@@ -1,240 +0,0 @@
-using MediaBrowser.Common.Events;
-using MediaBrowser.Controller.Net;
-using MediaBrowser.Model.Logging;
-using System;
-using System.Net.WebSockets;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using WebSocketMessageType = MediaBrowser.Model.Net.WebSocketMessageType;
-using WebSocketState = MediaBrowser.Model.Net.WebSocketState;
-
-namespace MediaBrowser.Server.Implementations.HttpServer
-{
- ///
- /// Class NativeWebSocket
- ///
- public class NativeWebSocket : IWebSocket
- {
- ///
- /// The logger
- ///
- private readonly ILogger _logger;
-
- public event EventHandler Closed;
-
- ///
- /// Gets or sets the web socket.
- ///
- /// The web socket.
- private System.Net.WebSockets.WebSocket WebSocket { get; set; }
-
- private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The socket.
- /// The logger.
- /// socket
- public NativeWebSocket(WebSocket socket, ILogger logger)
- {
- if (socket == null)
- {
- throw new ArgumentNullException("socket");
- }
-
- if (logger == null)
- {
- throw new ArgumentNullException("logger");
- }
-
- _logger = logger;
- WebSocket = socket;
-
- Receive();
- }
-
- ///
- /// Gets or sets the state.
- ///
- /// The state.
- public WebSocketState State
- {
- get
- {
- WebSocketState commonState;
-
- if (!Enum.TryParse(WebSocket.State.ToString(), true, out commonState))
- {
- _logger.Warn("Unrecognized WebSocketState: {0}", WebSocket.State.ToString());
- }
-
- return commonState;
- }
- }
-
- ///
- /// Receives this instance.
- ///
- private async void Receive()
- {
- while (true)
- {
- byte[] bytes;
-
- try
- {
- bytes = await ReceiveBytesAsync(_cancellationTokenSource.Token).ConfigureAwait(false);
- }
- catch (OperationCanceledException)
- {
- break;
- }
- catch (WebSocketException ex)
- {
- _logger.ErrorException("Error receiving web socket message", ex);
-
- break;
- }
-
- if (bytes == null)
- {
- // Connection closed
- EventHelper.FireEventIfNotNull(Closed, this, EventArgs.Empty, _logger);
- break;
- }
-
- if (OnReceiveBytes != null)
- {
- OnReceiveBytes(bytes);
- }
- }
- }
-
- ///
- /// Receives the async.
- ///
- /// The cancellation token.
- /// Task{WebSocketMessageInfo}.
- /// Connection closed
- private async Task ReceiveBytesAsync(CancellationToken cancellationToken)
- {
- var bytes = new byte[4096];
- var buffer = new ArraySegment(bytes);
-
- var result = await WebSocket.ReceiveAsync(buffer, cancellationToken).ConfigureAwait(false);
-
- if (result.CloseStatus.HasValue)
- {
- _logger.Info("Web socket connection closed by client. Reason: {0}", result.CloseStatus.Value);
- return null;
- }
-
- return buffer.Array;
- }
-
- ///
- /// Sends the async.
- ///
- /// The bytes.
- /// The type.
- /// if set to true [end of message].
- /// The cancellation token.
- /// Task.
- public Task SendAsync(byte[] bytes, WebSocketMessageType type, bool endOfMessage, CancellationToken cancellationToken)
- {
- System.Net.WebSockets.WebSocketMessageType nativeType;
-
- if (!Enum.TryParse(type.ToString(), true, out nativeType))
- {
- _logger.Warn("Unrecognized WebSocketMessageType: {0}", type.ToString());
- }
-
- var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _cancellationTokenSource.Token);
-
- return WebSocket.SendAsync(new ArraySegment(bytes), nativeType, true, linkedTokenSource.Token);
- }
-
- public Task SendAsync(byte[] bytes, bool endOfMessage, CancellationToken cancellationToken)
- {
- var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _cancellationTokenSource.Token);
-
- return WebSocket.SendAsync(new ArraySegment(bytes), System.Net.WebSockets.WebSocketMessageType.Binary, true, linkedTokenSource.Token);
- }
-
- public Task SendAsync(string text, bool endOfMessage, CancellationToken cancellationToken)
- {
- var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _cancellationTokenSource.Token);
-
- var bytes = Encoding.UTF8.GetBytes(text);
-
- return WebSocket.SendAsync(new ArraySegment(bytes), System.Net.WebSockets.WebSocketMessageType.Text, true, linkedTokenSource.Token);
- }
-
- ///
- /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- ///
- public void Dispose()
- {
- Dispose(true);
- }
-
- ///
- /// 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 dispose)
- {
- if (dispose)
- {
- _cancellationTokenSource.Cancel();
-
- WebSocket.Dispose();
- }
- }
-
- ///
- /// Gets or sets the receive action.
- ///
- /// The receive action.
- public Action OnReceiveBytes { get; set; }
-
- ///
- /// Gets or sets the on receive.
- ///
- /// The on receive.
- public Action OnReceive { get; set; }
-
- ///
- /// The _supports native web socket
- ///
- private static bool? _supportsNativeWebSocket;
-
- ///
- /// Gets a value indicating whether [supports web sockets].
- ///
- /// true if [supports web sockets]; otherwise, false.
- public static bool IsSupported
- {
- get
- {
- if (!_supportsNativeWebSocket.HasValue)
- {
- try
- {
- new ClientWebSocket();
-
- _supportsNativeWebSocket = true;
- }
- catch (PlatformNotSupportedException)
- {
- _supportsNativeWebSocket = false;
- }
- }
-
- return _supportsNativeWebSocket.Value;
- }
- }
- }
-}
diff --git a/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs b/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs
index 488c630fe..4b94095f5 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs
@@ -191,15 +191,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
}
}
}
- catch (IOException)
- {
- throw;
- }
- catch (Exception ex)
- {
- _logger.ErrorException("Error in range request writer", ex);
- throw;
- }
finally
{
if (OnComplete != null)
@@ -251,15 +242,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
}
}
}
- catch (IOException ex)
- {
- throw;
- }
- catch (Exception ex)
- {
- _logger.ErrorException("Error in range request writer", ex);
- throw;
- }
finally
{
if (OnComplete != null)
diff --git a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpResponse.cs b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpResponse.cs
index e08be8bd1..a58645ec5 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpResponse.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpResponse.cs
@@ -81,20 +81,12 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
public void Write(string text)
{
- try
- {
- var bOutput = System.Text.Encoding.UTF8.GetBytes(text);
- response.ContentLength64 = bOutput.Length;
+ var bOutput = System.Text.Encoding.UTF8.GetBytes(text);
+ response.ContentLength64 = bOutput.Length;
- var outputStream = response.OutputStream;
- outputStream.Write(bOutput, 0, bOutput.Length);
- Close();
- }
- catch (Exception ex)
- {
- _logger.ErrorException("Could not WriteTextToResponse: " + ex.Message, ex);
- throw;
- }
+ var outputStream = response.OutputStream;
+ outputStream.Write(bOutput, 0, bOutput.Length);
+ Close();
}
public void Close()
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index b2bddc70d..f7661f55b 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -2463,7 +2463,7 @@ namespace MediaBrowser.Server.Implementations.Library
public IEnumerable