diff --git a/Emby.Drawing/Emby.Drawing.csproj b/Emby.Drawing/Emby.Drawing.csproj
index f278e1e29..b286885a5 100644
--- a/Emby.Drawing/Emby.Drawing.csproj
+++ b/Emby.Drawing/Emby.Drawing.csproj
@@ -34,7 +34,7 @@
False
- ..\packages\ImageMagickSharp.1.0.0.15\lib\net45\ImageMagickSharp.dll
+ ..\packages\ImageMagickSharp.1.0.0.16\lib\net45\ImageMagickSharp.dll
diff --git a/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs b/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs
index 3d6cdd03d..380c56059 100644
--- a/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs
+++ b/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs
@@ -63,6 +63,7 @@ namespace Emby.Drawing.ImageMagick
{
_logger.Info("ImageMagick version: " + Wand.VersionString);
TestWebp();
+ Wand.SetMagickThreadCount(1);
}
private bool _webpAvailable = true;
diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs
index 55c6f6455..59c2e95c7 100644
--- a/Emby.Drawing/ImageProcessor.cs
+++ b/Emby.Drawing/ImageProcessor.cs
@@ -51,8 +51,14 @@ namespace Emby.Drawing
private readonly IJsonSerializer _jsonSerializer;
private readonly IServerApplicationPaths _appPaths;
private readonly IImageEncoder _imageEncoder;
+ private readonly SemaphoreSlim _imageProcessingSemaphore;
- public ImageProcessor(ILogger logger, IServerApplicationPaths appPaths, IFileSystem fileSystem, IJsonSerializer jsonSerializer, IImageEncoder imageEncoder)
+ public ImageProcessor(ILogger logger,
+ IServerApplicationPaths appPaths,
+ IFileSystem fileSystem,
+ IJsonSerializer jsonSerializer,
+ IImageEncoder imageEncoder,
+ int maxConcurrentImageProcesses)
{
_logger = logger;
_fileSystem = fileSystem;
@@ -88,6 +94,8 @@ namespace Emby.Drawing
}
_cachedImagedSizes = new ConcurrentDictionary(sizeDictionary);
+ _logger.Info("ImageProcessor started with {0} max concurrent image processes", maxConcurrentImageProcesses);
+ _imageProcessingSemaphore = new SemaphoreSlim(maxConcurrentImageProcesses, maxConcurrentImageProcesses);
}
public string[] SupportedInputFormats
@@ -201,6 +209,8 @@ namespace Emby.Drawing
await semaphore.WaitAsync().ConfigureAwait(false);
+ var imageProcessingLockTaken = false;
+
try
{
CheckDisposed();
@@ -212,11 +222,20 @@ namespace Emby.Drawing
Directory.CreateDirectory(Path.GetDirectoryName(cacheFilePath));
+ await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);
+
+ imageProcessingLockTaken = true;
+
_imageEncoder.EncodeImage(originalImagePath, cacheFilePath, newWidth, newHeight, quality, options);
}
}
finally
{
+ if (imageProcessingLockTaken)
+ {
+ _imageProcessingSemaphore.Release();
+ }
+
semaphore.Release();
}
@@ -254,10 +273,15 @@ namespace Emby.Drawing
return GetResult(croppedImagePath);
}
+ var imageProcessingLockTaken = false;
+
try
{
Directory.CreateDirectory(Path.GetDirectoryName(croppedImagePath));
+ await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);
+ imageProcessingLockTaken = true;
+
_imageEncoder.CropWhiteSpace(originalImagePath, croppedImagePath);
}
catch (Exception ex)
@@ -269,6 +293,11 @@ namespace Emby.Drawing
}
finally
{
+ if (imageProcessingLockTaken)
+ {
+ _imageProcessingSemaphore.Release();
+ }
+
semaphore.Release();
}
@@ -592,13 +621,25 @@ namespace Emby.Drawing
return enhancedImagePath;
}
+ var imageProcessingLockTaken = false;
+
try
{
Directory.CreateDirectory(Path.GetDirectoryName(enhancedImagePath));
+
+ await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);
+
+ imageProcessingLockTaken = true;
+
await ExecuteImageEnhancers(supportedEnhancers, originalImagePath, enhancedImagePath, item, imageType, imageIndex).ConfigureAwait(false);
}
finally
{
+ if (imageProcessingLockTaken)
+ {
+ _imageProcessingSemaphore.Release();
+ }
+
semaphore.Release();
}
@@ -717,9 +758,18 @@ namespace Emby.Drawing
return Path.Combine(path, filename);
}
- public void CreateImageCollage(ImageCollageOptions options)
+ public async Task CreateImageCollage(ImageCollageOptions options)
{
- _imageEncoder.CreateImageCollage(options);
+ await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);
+
+ try
+ {
+ _imageEncoder.CreateImageCollage(options);
+ }
+ finally
+ {
+ _imageProcessingSemaphore.Release();
+ }
}
public IEnumerable GetSupportedEnhancers(IHasImages item, ImageType imageType)
diff --git a/Emby.Drawing/packages.config b/Emby.Drawing/packages.config
index 35c98e592..acbd2ee3a 100644
--- a/Emby.Drawing/packages.config
+++ b/Emby.Drawing/packages.config
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/MediaBrowser.Api/ItemRefreshService.cs b/MediaBrowser.Api/ItemRefreshService.cs
index 419077f21..f56fd3282 100644
--- a/MediaBrowser.Api/ItemRefreshService.cs
+++ b/MediaBrowser.Api/ItemRefreshService.cs
@@ -1,7 +1,9 @@
-using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Providers;
using ServiceStack;
+using System.Threading;
namespace MediaBrowser.Api
{
@@ -52,7 +54,14 @@ namespace MediaBrowser.Api
var options = GetRefreshOptions(request);
- _providerManager.QueueRefresh(item.Id, options);
+ if (item is Folder)
+ {
+ _providerManager.QueueRefresh(item.Id, options);
+ }
+ else
+ {
+ _providerManager.RefreshFullItem(item, options, CancellationToken.None);
+ }
}
private MetadataRefreshOptions GetRefreshOptions(BaseRefreshRequest request)
diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs
index 4d9afa260..f89a70340 100644
--- a/MediaBrowser.Api/Library/LibraryService.cs
+++ b/MediaBrowser.Api/Library/LibraryService.cs
@@ -591,7 +591,7 @@ namespace MediaBrowser.Api.Library
ThemeSongsResult = themeSongs,
ThemeVideosResult = themeVideos,
- SoundtrackSongsResult = GetSoundtrackSongs(request, request.Id, request.UserId, request.InheritFromParent)
+ SoundtrackSongsResult = new ThemeMediaResult()
});
}
@@ -789,53 +789,5 @@ namespace MediaBrowser.Api.Library
return ToOptimizedSerializedResultUsingCache(lookup);
}
-
- public ThemeMediaResult GetSoundtrackSongs(GetThemeMedia request, string id, Guid? userId, bool inheritFromParent)
- {
- var user = userId.HasValue ? _userManager.GetUserById(userId.Value) : null;
-
- var item = string.IsNullOrEmpty(id)
- ? (userId.HasValue
- ? user.RootFolder
- : _libraryManager.RootFolder)
- : _libraryManager.GetItemById(id);
-
- var dtoOptions = GetDtoOptions(request);
-
- var dtos = GetSoundtrackSongIds(item, inheritFromParent)
- .Select(_libraryManager.GetItemById)
- .OfType()
- .SelectMany(i => i.GetRecursiveChildren(a => a is Audio))
- .OrderBy(i => i.SortName)
- .Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, item));
-
- var items = dtos.ToArray();
-
- return new ThemeMediaResult
- {
- Items = items,
- TotalRecordCount = items.Length,
- OwnerId = _dtoService.GetDtoId(item)
- };
- }
-
- private IEnumerable GetSoundtrackSongIds(BaseItem item, bool inherit)
- {
- var hasSoundtracks = item as IHasSoundtracks;
-
- if (hasSoundtracks != null)
- {
- return hasSoundtracks.SoundtrackIds;
- }
-
- if (!inherit)
- {
- return new List();
- }
-
- hasSoundtracks = item.Parents.OfType().FirstOrDefault();
-
- return hasSoundtracks != null ? hasSoundtracks.SoundtrackIds : new List();
- }
}
}
diff --git a/MediaBrowser.Api/Movies/CollectionService.cs b/MediaBrowser.Api/Movies/CollectionService.cs
index e6277e39a..ec3265b56 100644
--- a/MediaBrowser.Api/Movies/CollectionService.cs
+++ b/MediaBrowser.Api/Movies/CollectionService.cs
@@ -62,12 +62,15 @@ namespace MediaBrowser.Api.Movies
public async Task
diff --git a/MediaBrowser.Dlna/PlayTo/PlayToController.cs b/MediaBrowser.Dlna/PlayTo/PlayToController.cs
index 66cdc51af..5aa8c1f9c 100644
--- a/MediaBrowser.Dlna/PlayTo/PlayToController.cs
+++ b/MediaBrowser.Dlna/PlayTo/PlayToController.cs
@@ -310,12 +310,12 @@ namespace MediaBrowser.Dlna.PlayTo
{
if (isFirst && command.StartPositionTicks.HasValue)
{
- playlist.Add(CreatePlaylistItem(item, user, command.StartPositionTicks.Value));
+ playlist.Add(CreatePlaylistItem(item, user, command.StartPositionTicks.Value, null, null, null));
isFirst = false;
}
else
{
- playlist.Add(CreatePlaylistItem(item, user, 0));
+ playlist.Add(CreatePlaylistItem(item, user, 0, null, null, null));
}
}
@@ -456,11 +456,6 @@ namespace MediaBrowser.Dlna.PlayTo
}
}
- private PlaylistItem CreatePlaylistItem(BaseItem item, User user, long startPostionTicks)
- {
- return CreatePlaylistItem(item, user, startPostionTicks, null, null, null);
- }
-
private PlaylistItem CreatePlaylistItem(BaseItem item, User user, long startPostionTicks, string mediaSourceId, int? audioStreamIndex, int? subtitleStreamIndex)
{
var deviceInfo = _device.Properties;
@@ -514,8 +509,6 @@ namespace MediaBrowser.Dlna.PlayTo
streamInfo.TargetHeight,
streamInfo.TargetVideoBitDepth,
streamInfo.TargetVideoBitrate,
- streamInfo.TargetAudioChannels,
- streamInfo.TargetAudioBitrate,
streamInfo.TargetTimestamp,
streamInfo.IsDirectStream,
streamInfo.RunTimeTicks,
diff --git a/MediaBrowser.Dlna/PlayTo/PlayToManager.cs b/MediaBrowser.Dlna/PlayTo/PlayToManager.cs
index 77c98f9b9..3c68af550 100644
--- a/MediaBrowser.Dlna/PlayTo/PlayToManager.cs
+++ b/MediaBrowser.Dlna/PlayTo/PlayToManager.cs
@@ -13,6 +13,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
+using System.Threading;
namespace MediaBrowser.Dlna.PlayTo
{
@@ -34,6 +35,9 @@ namespace MediaBrowser.Dlna.PlayTo
private readonly DeviceDiscovery _deviceDiscovery;
private readonly IMediaSourceManager _mediaSourceManager;
+ private readonly List _nonRendererUrls = new List();
+ private Timer _clearNonRenderersTimer;
+
public PlayToManager(ILogger logger, ISessionManager sessionManager, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IServerApplicationHost appHost, IImageProcessor imageProcessor, DeviceDiscovery deviceDiscovery, IHttpClient httpClient, IServerConfigurationManager config, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager)
{
_logger = logger;
@@ -53,9 +57,19 @@ namespace MediaBrowser.Dlna.PlayTo
public void Start()
{
+ _clearNonRenderersTimer = new Timer(OnClearUrlTimerCallback, null, TimeSpan.FromMinutes(10), TimeSpan.FromMinutes(10));
+
_deviceDiscovery.DeviceDiscovered += _deviceDiscovery_DeviceDiscovered;
}
+ private void OnClearUrlTimerCallback(object state)
+ {
+ lock (_nonRendererUrls)
+ {
+ _nonRendererUrls.Clear();
+ }
+ }
+
async void _deviceDiscovery_DeviceDiscovered(object sender, SsdpMessageEventArgs e)
{
var localIp = e.LocalIp;
@@ -68,7 +82,7 @@ namespace MediaBrowser.Dlna.PlayTo
string location;
if (!e.Headers.TryGetValue("Location", out location)) location = string.Empty;
-
+
// It has to report that it's a media renderer
if (usn.IndexOf("MediaRenderer:", StringComparison.OrdinalIgnoreCase) == -1 &&
nt.IndexOf("MediaRenderer:", StringComparison.OrdinalIgnoreCase) == -1)
@@ -85,61 +99,75 @@ namespace MediaBrowser.Dlna.PlayTo
{
var uri = new Uri(location);
+ lock (_nonRendererUrls)
+ {
+ if (_nonRendererUrls.Contains(location, StringComparer.OrdinalIgnoreCase))
+ {
+ return;
+ }
+ }
+
var device = await Device.CreateuPnpDeviceAsync(uri, _httpClient, _config, _logger).ConfigureAwait(false);
- if (device.RendererCommands != null)
+ if (device.RendererCommands == null)
{
- var sessionInfo = await _sessionManager.LogSessionActivity(device.Properties.ClientType, _appHost.ApplicationVersion.ToString(), device.Properties.UUID, device.Properties.Name, uri.OriginalString, null)
- .ConfigureAwait(false);
-
- var controller = sessionInfo.SessionController as PlayToController;
-
- if (controller == null)
+ lock (_nonRendererUrls)
{
- var serverAddress = GetServerAddress(localIp);
- string accessToken = null;
-
- sessionInfo.SessionController = controller = new PlayToController(sessionInfo,
- _sessionManager,
- _libraryManager,
- _logger,
- _dlnaManager,
- _userManager,
- _imageProcessor,
- serverAddress,
- accessToken,
- _deviceDiscovery,
- _userDataManager,
- _localization,
- _mediaSourceManager);
-
- controller.Init(device);
-
- var profile = _dlnaManager.GetProfile(device.Properties.ToDeviceIdentification()) ??
- _dlnaManager.GetDefaultProfile();
-
- _sessionManager.ReportCapabilities(sessionInfo.Id, new ClientCapabilities
- {
- PlayableMediaTypes = profile.GetSupportedMediaTypes(),
-
- SupportedCommands = new List
- {
- GeneralCommandType.VolumeDown.ToString(),
- GeneralCommandType.VolumeUp.ToString(),
- GeneralCommandType.Mute.ToString(),
- GeneralCommandType.Unmute.ToString(),
- GeneralCommandType.ToggleMute.ToString(),
- GeneralCommandType.SetVolume.ToString(),
- GeneralCommandType.SetAudioStreamIndex.ToString(),
- GeneralCommandType.SetSubtitleStreamIndex.ToString()
- },
-
- SupportsMediaControl = true
- });
-
- _logger.Info("DLNA Session created for {0} - {1}", device.Properties.Name, device.Properties.ModelName);
+ _nonRendererUrls.Add(location);
+ return;
}
}
+
+ var sessionInfo = await _sessionManager.LogSessionActivity(device.Properties.ClientType, _appHost.ApplicationVersion.ToString(), device.Properties.UUID, device.Properties.Name, uri.OriginalString, null)
+ .ConfigureAwait(false);
+
+ var controller = sessionInfo.SessionController as PlayToController;
+
+ if (controller == null)
+ {
+ var serverAddress = GetServerAddress(localIp);
+ string accessToken = null;
+
+ sessionInfo.SessionController = controller = new PlayToController(sessionInfo,
+ _sessionManager,
+ _libraryManager,
+ _logger,
+ _dlnaManager,
+ _userManager,
+ _imageProcessor,
+ serverAddress,
+ accessToken,
+ _deviceDiscovery,
+ _userDataManager,
+ _localization,
+ _mediaSourceManager);
+
+ controller.Init(device);
+
+ var profile = _dlnaManager.GetProfile(device.Properties.ToDeviceIdentification()) ??
+ _dlnaManager.GetDefaultProfile();
+
+ _sessionManager.ReportCapabilities(sessionInfo.Id, new ClientCapabilities
+ {
+ PlayableMediaTypes = profile.GetSupportedMediaTypes(),
+
+ SupportedCommands = new List
+ {
+ GeneralCommandType.VolumeDown.ToString(),
+ GeneralCommandType.VolumeUp.ToString(),
+ GeneralCommandType.Mute.ToString(),
+ GeneralCommandType.Unmute.ToString(),
+ GeneralCommandType.ToggleMute.ToString(),
+ GeneralCommandType.SetVolume.ToString(),
+ GeneralCommandType.SetAudioStreamIndex.ToString(),
+ GeneralCommandType.SetSubtitleStreamIndex.ToString()
+ },
+
+ SupportsMediaControl = true
+ });
+
+ _logger.Info("DLNA Session created for {0} - {1}", device.Properties.Name, device.Properties.ModelName);
+ }
}
catch (Exception ex)
{
@@ -155,6 +183,12 @@ namespace MediaBrowser.Dlna.PlayTo
public void Dispose()
{
_deviceDiscovery.DeviceDiscovered -= _deviceDiscovery_DeviceDiscovered;
+
+ if (_clearNonRenderersTimer != null)
+ {
+ _clearNonRenderersTimer.Dispose();
+ _clearNonRenderersTimer = null;
+ }
}
}
}
diff --git a/MediaBrowser.Dlna/PlayTo/PlaylistItem.cs b/MediaBrowser.Dlna/PlayTo/PlaylistItem.cs
index 2af9f8da9..e1f14bfa2 100644
--- a/MediaBrowser.Dlna/PlayTo/PlaylistItem.cs
+++ b/MediaBrowser.Dlna/PlayTo/PlaylistItem.cs
@@ -4,8 +4,6 @@ namespace MediaBrowser.Dlna.PlayTo
{
public class PlaylistItem
{
- public int PlayState { get; set; }
-
public string StreamUrl { get; set; }
public string Didl { get; set; }
diff --git a/MediaBrowser.Model/Dlna/Profiles/DefaultProfile.cs b/MediaBrowser.Dlna/Profiles/DefaultProfile.cs
similarity index 98%
rename from MediaBrowser.Model/Dlna/Profiles/DefaultProfile.cs
rename to MediaBrowser.Dlna/Profiles/DefaultProfile.cs
index c9db9fbf8..a243fd011 100644
--- a/MediaBrowser.Model/Dlna/Profiles/DefaultProfile.cs
+++ b/MediaBrowser.Dlna/Profiles/DefaultProfile.cs
@@ -1,6 +1,7 @@
-using System.Xml.Serialization;
+using MediaBrowser.Model.Dlna;
+using System.Xml.Serialization;
-namespace MediaBrowser.Model.Dlna.Profiles
+namespace MediaBrowser.Dlna.Profiles
{
[XmlRoot("Profile")]
public class DefaultProfile : DeviceProfile
diff --git a/MediaBrowser.Dlna/Profiles/DenonAvrProfile.cs b/MediaBrowser.Dlna/Profiles/DenonAvrProfile.cs
index 224ae7715..f8451bdfd 100644
--- a/MediaBrowser.Dlna/Profiles/DenonAvrProfile.cs
+++ b/MediaBrowser.Dlna/Profiles/DenonAvrProfile.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Model.Dlna;
using System.Xml.Serialization;
-using MediaBrowser.Model.Dlna.Profiles;
namespace MediaBrowser.Dlna.Profiles
{
diff --git a/MediaBrowser.Dlna/Profiles/DirectTvProfile.cs b/MediaBrowser.Dlna/Profiles/DirectTvProfile.cs
index 4c07c2827..585f8652e 100644
--- a/MediaBrowser.Dlna/Profiles/DirectTvProfile.cs
+++ b/MediaBrowser.Dlna/Profiles/DirectTvProfile.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Model.Dlna;
using System.Xml.Serialization;
-using MediaBrowser.Model.Dlna.Profiles;
namespace MediaBrowser.Dlna.Profiles
{
diff --git a/MediaBrowser.Dlna/Profiles/DishHopperJoeyProfile.cs b/MediaBrowser.Dlna/Profiles/DishHopperJoeyProfile.cs
index ab887a3bf..bd7b42d5d 100644
--- a/MediaBrowser.Dlna/Profiles/DishHopperJoeyProfile.cs
+++ b/MediaBrowser.Dlna/Profiles/DishHopperJoeyProfile.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Model.Dlna;
using System.Xml.Serialization;
-using MediaBrowser.Model.Dlna.Profiles;
namespace MediaBrowser.Dlna.Profiles
{
diff --git a/MediaBrowser.Dlna/Profiles/Foobar2000Profile.cs b/MediaBrowser.Dlna/Profiles/Foobar2000Profile.cs
index 1d011a243..45cbbef6c 100644
--- a/MediaBrowser.Dlna/Profiles/Foobar2000Profile.cs
+++ b/MediaBrowser.Dlna/Profiles/Foobar2000Profile.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Model.Dlna;
using System.Xml.Serialization;
-using MediaBrowser.Model.Dlna.Profiles;
namespace MediaBrowser.Dlna.Profiles
{
diff --git a/MediaBrowser.Dlna/Profiles/LgTvProfile.cs b/MediaBrowser.Dlna/Profiles/LgTvProfile.cs
index 8b887500e..4ecfd3c5b 100644
--- a/MediaBrowser.Dlna/Profiles/LgTvProfile.cs
+++ b/MediaBrowser.Dlna/Profiles/LgTvProfile.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Model.Dlna;
using System.Xml.Serialization;
-using MediaBrowser.Model.Dlna.Profiles;
namespace MediaBrowser.Dlna.Profiles
{
diff --git a/MediaBrowser.Dlna/Profiles/LinksysDMA2100Profile.cs b/MediaBrowser.Dlna/Profiles/LinksysDMA2100Profile.cs
index 0565f6c93..e7542ea9e 100644
--- a/MediaBrowser.Dlna/Profiles/LinksysDMA2100Profile.cs
+++ b/MediaBrowser.Dlna/Profiles/LinksysDMA2100Profile.cs
@@ -1,7 +1,6 @@
using System.Xml.Serialization;
using MediaBrowser.Controller.Dlna;
using MediaBrowser.Model.Dlna;
-using MediaBrowser.Model.Dlna.Profiles;
namespace MediaBrowser.Dlna.Profiles
{
diff --git a/MediaBrowser.Dlna/Profiles/MediaMonkeyProfile.cs b/MediaBrowser.Dlna/Profiles/MediaMonkeyProfile.cs
index a73c6ccf4..7163252db 100644
--- a/MediaBrowser.Dlna/Profiles/MediaMonkeyProfile.cs
+++ b/MediaBrowser.Dlna/Profiles/MediaMonkeyProfile.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Model.Dlna;
using System.Xml.Serialization;
-using MediaBrowser.Model.Dlna.Profiles;
namespace MediaBrowser.Dlna.Profiles
{
diff --git a/MediaBrowser.Dlna/Profiles/PanasonicVieraProfile.cs b/MediaBrowser.Dlna/Profiles/PanasonicVieraProfile.cs
index 99dec2bc6..9e51c2895 100644
--- a/MediaBrowser.Dlna/Profiles/PanasonicVieraProfile.cs
+++ b/MediaBrowser.Dlna/Profiles/PanasonicVieraProfile.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Model.Dlna;
using System.Xml.Serialization;
-using MediaBrowser.Model.Dlna.Profiles;
namespace MediaBrowser.Dlna.Profiles
{
diff --git a/MediaBrowser.Dlna/Profiles/PopcornHourProfile.cs b/MediaBrowser.Dlna/Profiles/PopcornHourProfile.cs
index 883af57d2..c98609393 100644
--- a/MediaBrowser.Dlna/Profiles/PopcornHourProfile.cs
+++ b/MediaBrowser.Dlna/Profiles/PopcornHourProfile.cs
@@ -1,5 +1,4 @@
using MediaBrowser.Model.Dlna;
-using MediaBrowser.Model.Dlna.Profiles;
using System.Xml.Serialization;
namespace MediaBrowser.Dlna.Profiles
diff --git a/MediaBrowser.Dlna/Profiles/SamsungSmartTvProfile.cs b/MediaBrowser.Dlna/Profiles/SamsungSmartTvProfile.cs
index 970995b7d..396dd6489 100644
--- a/MediaBrowser.Dlna/Profiles/SamsungSmartTvProfile.cs
+++ b/MediaBrowser.Dlna/Profiles/SamsungSmartTvProfile.cs
@@ -1,5 +1,4 @@
using MediaBrowser.Model.Dlna;
-using MediaBrowser.Model.Dlna.Profiles;
using System.Xml.Serialization;
namespace MediaBrowser.Dlna.Profiles
diff --git a/MediaBrowser.Dlna/Profiles/SonyBlurayPlayer2013Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBlurayPlayer2013Profile.cs
index ed325e301..baaccba5a 100644
--- a/MediaBrowser.Dlna/Profiles/SonyBlurayPlayer2013Profile.cs
+++ b/MediaBrowser.Dlna/Profiles/SonyBlurayPlayer2013Profile.cs
@@ -1,5 +1,4 @@
using MediaBrowser.Model.Dlna;
-using MediaBrowser.Model.Dlna.Profiles;
using System.Xml.Serialization;
namespace MediaBrowser.Dlna.Profiles
diff --git a/MediaBrowser.Dlna/Profiles/SonyBlurayPlayerProfile.cs b/MediaBrowser.Dlna/Profiles/SonyBlurayPlayerProfile.cs
index 6802bf631..d2e6d7c15 100644
--- a/MediaBrowser.Dlna/Profiles/SonyBlurayPlayerProfile.cs
+++ b/MediaBrowser.Dlna/Profiles/SonyBlurayPlayerProfile.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Model.Dlna;
using System.Xml.Serialization;
-using MediaBrowser.Model.Dlna.Profiles;
namespace MediaBrowser.Dlna.Profiles
{
diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs
index 46549040f..71f877232 100644
--- a/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs
+++ b/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Model.Dlna;
using System.Xml.Serialization;
-using MediaBrowser.Model.Dlna.Profiles;
namespace MediaBrowser.Dlna.Profiles
{
diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs
index d9891e87b..0b157ae33 100644
--- a/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs
+++ b/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Model.Dlna;
using System.Xml.Serialization;
-using MediaBrowser.Model.Dlna.Profiles;
namespace MediaBrowser.Dlna.Profiles
{
diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs
index 85643bace..0d974cbc0 100644
--- a/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs
+++ b/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Model.Dlna;
using System.Xml.Serialization;
-using MediaBrowser.Model.Dlna.Profiles;
namespace MediaBrowser.Dlna.Profiles
{
diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs
index 0f7151a84..ac4cb2131 100644
--- a/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs
+++ b/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Model.Dlna;
using System.Xml.Serialization;
-using MediaBrowser.Model.Dlna.Profiles;
namespace MediaBrowser.Dlna.Profiles
{
diff --git a/MediaBrowser.Dlna/Profiles/SonyPs3Profile.cs b/MediaBrowser.Dlna/Profiles/SonyPs3Profile.cs
index e92b0acfe..a99d7775a 100644
--- a/MediaBrowser.Dlna/Profiles/SonyPs3Profile.cs
+++ b/MediaBrowser.Dlna/Profiles/SonyPs3Profile.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Model.Dlna;
using System.Xml.Serialization;
-using MediaBrowser.Model.Dlna.Profiles;
namespace MediaBrowser.Dlna.Profiles
{
diff --git a/MediaBrowser.Dlna/Profiles/WdtvLiveProfile.cs b/MediaBrowser.Dlna/Profiles/WdtvLiveProfile.cs
index 553d77c7f..a26c43911 100644
--- a/MediaBrowser.Dlna/Profiles/WdtvLiveProfile.cs
+++ b/MediaBrowser.Dlna/Profiles/WdtvLiveProfile.cs
@@ -1,5 +1,4 @@
using MediaBrowser.Model.Dlna;
-using MediaBrowser.Model.Dlna.Profiles;
using System.Xml.Serialization;
namespace MediaBrowser.Dlna.Profiles
diff --git a/MediaBrowser.Dlna/Profiles/Xbox360Profile.cs b/MediaBrowser.Dlna/Profiles/Xbox360Profile.cs
index e3dd83224..62c06f8f5 100644
--- a/MediaBrowser.Dlna/Profiles/Xbox360Profile.cs
+++ b/MediaBrowser.Dlna/Profiles/Xbox360Profile.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Model.Dlna;
using System.Xml.Serialization;
-using MediaBrowser.Model.Dlna.Profiles;
namespace MediaBrowser.Dlna.Profiles
{
diff --git a/MediaBrowser.Dlna/Profiles/XboxOneProfile.cs b/MediaBrowser.Dlna/Profiles/XboxOneProfile.cs
index 3427d75f7..4c3b049bd 100644
--- a/MediaBrowser.Dlna/Profiles/XboxOneProfile.cs
+++ b/MediaBrowser.Dlna/Profiles/XboxOneProfile.cs
@@ -1,5 +1,4 @@
using MediaBrowser.Model.Dlna;
-using MediaBrowser.Model.Dlna.Profiles;
using System.Xml.Serialization;
namespace MediaBrowser.Dlna.Profiles
diff --git a/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs b/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs
index a90c6dc01..3dd482e64 100644
--- a/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs
+++ b/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs
@@ -2,6 +2,7 @@
using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Controller.Dlna;
using MediaBrowser.Model.Logging;
using System;
using System.Collections.Generic;
@@ -47,12 +48,13 @@ namespace MediaBrowser.Dlna.Ssdp
if (!network.SupportsMulticast || OperationalStatus.Up != network.OperationalStatus || !network.GetIPProperties().MulticastAddresses.Any())
continue;
-
- var ipV4 = network.GetIPProperties().GetIPv4Properties();
+
+ var properties = network.GetIPProperties();
+ var ipV4 = properties.GetIPv4Properties();
if (null == ipV4)
continue;
- var localIps = network.GetIPProperties().UnicastAddresses
+ var localIps = properties.UnicastAddresses
.Where(i => i.Address.AddressFamily == AddressFamily.InterNetwork)
.Select(i => i.Address)
.ToList();
@@ -182,7 +184,6 @@ namespace MediaBrowser.Dlna.Ssdp
}
}, _tokenSource.Token, TaskCreationOptions.LongRunning);
-
}
private Socket GetMulticastSocket(IPAddress localIpAddress, EndPoint localEndpoint)
diff --git a/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs b/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs
index 73bc4984c..5b3746aeb 100644
--- a/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs
+++ b/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs
@@ -1,6 +1,8 @@
-using MediaBrowser.Common.Configuration;
+using MediaBrowser.Common;
+using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Events;
using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Controller.Dlna;
using MediaBrowser.Dlna.Server;
using MediaBrowser.Model.Logging;
using System;
@@ -16,7 +18,7 @@ using System.Threading.Tasks;
namespace MediaBrowser.Dlna.Ssdp
{
- public class SsdpHandler : IDisposable
+ public class SsdpHandler : IDisposable, ISsdpHandler
{
private Socket _socket;
@@ -39,13 +41,39 @@ namespace MediaBrowser.Dlna.Ssdp
private bool _isDisposed;
private readonly ConcurrentDictionary> _devices = new ConcurrentDictionary>();
- public SsdpHandler(ILogger logger, IServerConfigurationManager config, string serverSignature)
+ private readonly IApplicationHost _appHost;
+
+ public SsdpHandler(ILogger logger, IServerConfigurationManager config, IApplicationHost appHost)
{
_logger = logger;
_config = config;
- _serverSignature = serverSignature;
+ _appHost = appHost;
_config.NamedConfigurationUpdated += _config_ConfigurationUpdated;
+ _serverSignature = GenerateServerSignature();
+ }
+
+ private string GenerateServerSignature()
+ {
+ var os = Environment.OSVersion;
+ var pstring = os.Platform.ToString();
+ switch (os.Platform)
+ {
+ case PlatformID.Win32NT:
+ case PlatformID.Win32S:
+ case PlatformID.Win32Windows:
+ pstring = "WIN";
+ break;
+ }
+
+ return String.Format(
+ "{0}{1}/{2}.{3} UPnP/1.0 DLNADOC/1.5 MediaBrowser/{4}",
+ pstring,
+ IntPtr.Size * 8,
+ os.Version.Major,
+ os.Version.Minor,
+ _appHost.ApplicationVersion
+ );
}
void _config_ConfigurationUpdated(object sender, ConfigurationUpdateEventArgs e)
@@ -116,13 +144,14 @@ namespace MediaBrowser.Dlna.Ssdp
// Seconds to delay response
values["MX"] = "3";
- SendDatagram("M-SEARCH * HTTP/1.1", values, localIp);
+ // UDP is unreliable, so send 3 requests at a time (per Upnp spec, sec 1.1.2)
+ SendDatagram("M-SEARCH * HTTP/1.1", values, localIp, 2);
}
public void SendDatagram(string header,
Dictionary values,
EndPoint localAddress,
- int sendCount = 1)
+ int sendCount)
{
SendDatagram(header, values, _ssdpEndp, localAddress, false, sendCount);
}
@@ -132,7 +161,7 @@ namespace MediaBrowser.Dlna.Ssdp
EndPoint endpoint,
EndPoint localAddress,
bool ignoreBindFailure,
- int sendCount = 1)
+ int sendCount)
{
var msg = new SsdpMessageBuilder().BuildMessage(header, values);
var queued = false;
@@ -376,11 +405,11 @@ namespace MediaBrowser.Dlna.Ssdp
}
foreach (var d in RegisteredDevices)
{
- NotifyDevice(d, "alive");
+ NotifyDevice(d, "alive", 1);
}
}
- private void NotifyDevice(UpnpDevice dev, string type, int sendCount = 1)
+ private void NotifyDevice(UpnpDevice dev, string type, int sendCount)
{
const string header = "NOTIFY * HTTP/1.1";
diff --git a/MediaBrowser.Dlna/Ssdp/SsdpHelper.cs b/MediaBrowser.Dlna/Ssdp/SsdpHelper.cs
index 707f0b877..d196e9851 100644
--- a/MediaBrowser.Dlna/Ssdp/SsdpHelper.cs
+++ b/MediaBrowser.Dlna/Ssdp/SsdpHelper.cs
@@ -1,4 +1,5 @@
-using System;
+using MediaBrowser.Controller.Dlna;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
@@ -34,7 +35,8 @@ namespace MediaBrowser.Dlna.Ssdp
return new SsdpMessageEventArgs
{
Method = method,
- Headers = headers
+ Headers = headers,
+ Message = data
};
}
}
diff --git a/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs
index a12724ff7..02457ee73 100644
--- a/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs
+++ b/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs
@@ -50,6 +50,14 @@ namespace MediaBrowser.LocalMetadata.Parsers
}
break;
+ case "Shares":
+
+ using (var subReader = reader.ReadSubtree())
+ {
+ FetchFromSharesNode(subReader, item);
+ }
+ break;
+
default:
base.FetchDataFromXmlNode(reader, item);
break;
@@ -92,5 +100,42 @@ namespace MediaBrowser.LocalMetadata.Parsers
item.LinkedChildren = list;
}
+
+ private void FetchFromSharesNode(XmlReader reader, Playlist item)
+ {
+ reader.MoveToContent();
+
+ var list = new List();
+
+ while (reader.Read())
+ {
+ if (reader.NodeType == XmlNodeType.Element)
+ {
+ switch (reader.Name)
+ {
+ case "Share":
+ {
+ using (var subReader = reader.ReadSubtree())
+ {
+ var child = GetShare(subReader);
+
+ if (child != null)
+ {
+ list.Add(child);
+ }
+ }
+
+ break;
+ }
+
+ default:
+ reader.Skip();
+ break;
+ }
+ }
+ }
+
+ item.Shares = list;
+ }
}
}
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
index ea3cc6d89..44b85a77d 100644
--- a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
@@ -716,8 +716,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
profile.GetVideoMediaProfile(outputContainer,
audioCodec,
videoCodec,
- state.OutputAudioBitrate,
- state.OutputAudioChannels,
state.OutputWidth,
state.OutputHeight,
state.TargetVideoBitDepth,
diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
index d076a5b6b..a01f37f91 100644
--- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
@@ -119,7 +119,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
var extractKeyFrameInterval = request.ExtractKeyFrameInterval && request.Protocol == MediaProtocol.File && request.VideoType == VideoType.VideoFile;
return GetMediaInfoInternal(GetInputArgument(inputFiles, request.Protocol), request.InputPath, request.Protocol, extractChapters, extractKeyFrameInterval,
- GetProbeSizeArgument(inputFiles, request.Protocol), request.MediaType == DlnaProfileType.Audio, cancellationToken);
+ GetProbeSizeArgument(inputFiles, request.Protocol), request.MediaType == DlnaProfileType.Audio, request.VideoType, cancellationToken);
}
///
@@ -155,6 +155,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
/// if set to true [extract key frame interval].
/// The probe size argument.
/// if set to true [is audio].
+ /// Type of the video.
/// The cancellation token.
/// Task{MediaInfoResult}.
///
@@ -165,6 +166,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
bool extractKeyFrameInterval,
string probeSizeArgument,
bool isAudio,
+ VideoType videoType,
CancellationToken cancellationToken)
{
var args = extractChapters
@@ -236,7 +238,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
}
- var mediaInfo = new ProbeResultNormalizer(_logger, FileSystem).GetMediaInfo(result, isAudio, primaryPath, protocol);
+ var mediaInfo = new ProbeResultNormalizer(_logger, FileSystem).GetMediaInfo(result, videoType, isAudio, primaryPath, protocol);
if (extractKeyFrameInterval && mediaInfo.RunTimeTicks.HasValue)
{
diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
index 267ff875a..2cd855e96 100644
--- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
+++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
@@ -25,7 +25,7 @@ namespace MediaBrowser.MediaEncoding.Probing
_fileSystem = fileSystem;
}
- public Model.MediaInfo.MediaInfo GetMediaInfo(InternalMediaInfoResult data, bool isAudio, string path, MediaProtocol protocol)
+ public Model.MediaInfo.MediaInfo GetMediaInfo(InternalMediaInfoResult data, VideoType videoType, bool isAudio, string path, MediaProtocol protocol)
{
var info = new Model.MediaInfo.MediaInfo
{
@@ -79,7 +79,7 @@ namespace MediaBrowser.MediaEncoding.Probing
var videoStream = info.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video);
- if (videoStream != null)
+ if (videoStream != null && videoType == VideoType.VideoFile)
{
UpdateFromMediaInfo(info, videoStream);
}
@@ -146,7 +146,44 @@ namespace MediaBrowser.MediaEncoding.Probing
// string.Equals(stream.AspectRatio, "2.35:1", StringComparison.OrdinalIgnoreCase) ||
// string.Equals(stream.AspectRatio, "2.40:1", StringComparison.OrdinalIgnoreCase);
- stream.IsAnamorphic = string.Equals(streamInfo.sample_aspect_ratio, "0:1", StringComparison.OrdinalIgnoreCase);
+ if (string.Equals(streamInfo.sample_aspect_ratio, "1:1", StringComparison.OrdinalIgnoreCase))
+ {
+ stream.IsAnamorphic = false;
+ }
+ else if (!((string.IsNullOrWhiteSpace(streamInfo.sample_aspect_ratio) || string.Equals(streamInfo.sample_aspect_ratio, "0:1", StringComparison.OrdinalIgnoreCase))))
+ {
+ stream.IsAnamorphic = true;
+ }
+ else if (string.IsNullOrWhiteSpace(streamInfo.display_aspect_ratio) || string.Equals(streamInfo.display_aspect_ratio, "0:1", StringComparison.OrdinalIgnoreCase))
+ {
+ stream.IsAnamorphic = false;
+ }
+ else
+ {
+ var ratioParts = streamInfo.display_aspect_ratio.Split(':');
+ if (ratioParts.Length != 2)
+ {
+ stream.IsAnamorphic = false;
+ }
+ else
+ {
+ int ratio0;
+ int ratio1;
+ if (!Int32.TryParse(ratioParts[0], NumberStyles.Any, CultureInfo.InvariantCulture, out ratio0))
+ {
+ stream.IsAnamorphic = false;
+ }
+ else if (!Int32.TryParse(ratioParts[1], NumberStyles.Any, CultureInfo.InvariantCulture, out ratio1))
+ {
+ stream.IsAnamorphic = false;
+ }
+ else
+ {
+ stream.IsAnamorphic = ((streamInfo.width * ratio1) != (stream.Height * ratio0));
+ }
+ }
+ }
+
}
else
{
@@ -863,12 +900,14 @@ namespace MediaBrowser.MediaEncoding.Probing
private void UpdateFromMediaInfo(MediaSourceInfo video, MediaStream videoStream)
{
- if (video.VideoType == VideoType.VideoFile && video.Protocol == MediaProtocol.File)
+ if (video.Protocol == MediaProtocol.File)
{
if (videoStream != null)
{
try
{
+ _logger.Debug("Running MediaInfo against {0}", video.Path);
+
var result = new MediaInfoLib().GetVideoInfo(video.Path);
videoStream.IsCabac = result.IsCabac ?? videoStream.IsCabac;
diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
index 87378fd5a..f70fe628e 100644
--- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
+++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
@@ -383,9 +383,6 @@
Dlna\ProfileConditionValue.cs
-
- Dlna\Profiles\DefaultProfile.cs
-
Dlna\ResolutionConfiguration.cs
diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
index 61057e5bb..bb8b09682 100644
--- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
+++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
@@ -348,9 +348,6 @@
Dlna\ProfileConditionValue.cs
-
- Dlna\Profiles\DefaultProfile.cs
-
Dlna\ResolutionConfiguration.cs
diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs
index 8c7ca0ad9..026e65ec4 100644
--- a/MediaBrowser.Model/ApiClient/IApiClient.cs
+++ b/MediaBrowser.Model/ApiClient/IApiClient.cs
@@ -1499,5 +1499,11 @@ namespace MediaBrowser.Model.ApiClient
/// The item ids.
/// Task.
Task CancelSyncLibraryItems(string targetId, IEnumerable itemIds);
+ ///
+ /// Gets the supported bitrate.
+ ///
+ /// The cancellation token.
+ /// Task<System.Int32>.
+ Task GetSupportedBitrate(CancellationToken cancellationToken);
}
}
\ No newline at end of file
diff --git a/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs b/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs
index 19620890e..ca9db0bf0 100644
--- a/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs
@@ -50,6 +50,12 @@ namespace MediaBrowser.Model.Configuration
/// The cache path.
public string CachePath { get; set; }
+ ///
+ /// Gets or sets a value indicating whether [enable custom path sub folders].
+ ///
+ /// true if [enable custom path sub folders]; otherwise, false.
+ public bool EnableCustomPathSubFolders { get; set; }
+
///
/// Initializes a new instance of the class.
///
diff --git a/MediaBrowser.Model/Configuration/EncodingOptions.cs b/MediaBrowser.Model/Configuration/EncodingOptions.cs
index c44a7c94d..afd67eb15 100644
--- a/MediaBrowser.Model/Configuration/EncodingOptions.cs
+++ b/MediaBrowser.Model/Configuration/EncodingOptions.cs
@@ -17,7 +17,7 @@ namespace MediaBrowser.Model.Configuration
DownMixAudioBoost = 2;
EncodingQuality = EncodingQuality.Auto;
EnableThrottling = true;
- ThrottleThresholdSeconds = 90;
+ ThrottleThresholdSeconds = 120;
}
}
}
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index ac9bd6b08..8a3a2a3e4 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -185,8 +185,6 @@ namespace MediaBrowser.Model.Configuration
public MetadataOptions[] MetadataOptions { get; set; }
- public string TranscodingTempPath { get; set; }
-
public bool EnableAutomaticRestart { get; set; }
public bool EnableRealtimeMonitor { get; set; }
diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.cs
index 376963444..793036f40 100644
--- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs
+++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs
@@ -7,8 +7,6 @@ namespace MediaBrowser.Model.Dlna
public class ConditionProcessor
{
public bool IsVideoConditionSatisfied(ProfileCondition condition,
- int? audioBitrate,
- int? audioChannels,
int? width,
int? height,
int? bitDepth,
@@ -44,10 +42,6 @@ namespace MediaBrowser.Model.Dlna
return IsConditionSatisfied(condition, videoProfile);
case ProfileConditionValue.PacketLength:
return IsConditionSatisfied(condition, packetLength);
- case ProfileConditionValue.AudioBitrate:
- return IsConditionSatisfied(condition, audioBitrate);
- case ProfileConditionValue.AudioChannels:
- return IsConditionSatisfied(condition, audioChannels);
case ProfileConditionValue.VideoBitDepth:
return IsConditionSatisfied(condition, bitDepth);
case ProfileConditionValue.VideoBitrate:
diff --git a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs
index 8161f1c26..3a798e3fe 100644
--- a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs
+++ b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs
@@ -105,8 +105,6 @@ namespace MediaBrowser.Model.Dlna
int? height,
int? bitDepth,
int? videoBitrate,
- int? audioChannels,
- int? audioBitrate,
TransportStreamTimestamp timestamp,
bool isDirectStream,
long? runtimeTicks,
@@ -147,8 +145,6 @@ namespace MediaBrowser.Model.Dlna
ResponseProfile mediaProfile = _profile.GetVideoMediaProfile(container,
audioCodec,
videoCodec,
- audioBitrate,
- audioChannels,
width,
height,
bitDepth,
diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs
index 8b9b2edf3..a78724bf2 100644
--- a/MediaBrowser.Model/Dlna/DeviceProfile.cs
+++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs
@@ -111,6 +111,10 @@ namespace MediaBrowser.Model.Dlna
XmlRootAttributes = new XmlAttribute[] { };
SupportedMediaTypes = "Audio,Photo,Video";
+ MaxStreamingBitrate = 8000000;
+ MaxStaticBitrate = 8000000;
+ MusicStreamingTranscodingBitrate = 128000;
+ MusicSyncBitrate = 128000;
}
public List GetSupportedMediaTypes()
@@ -268,8 +272,6 @@ namespace MediaBrowser.Model.Dlna
public ResponseProfile GetVideoMediaProfile(string container,
string audioCodec,
string videoCodec,
- int? audioBitrate,
- int? audioChannels,
int? width,
int? height,
int? bitDepth,
@@ -317,7 +319,7 @@ namespace MediaBrowser.Model.Dlna
var anyOff = false;
foreach (ProfileCondition c in i.Conditions)
{
- if (!conditionProcessor.IsVideoConditionSatisfied(c, audioBitrate, audioChannels, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams))
+ if (!conditionProcessor.IsVideoConditionSatisfied(c, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams))
{
anyOff = true;
break;
diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs
index 30da8bb4c..715752d05 100644
--- a/MediaBrowser.Model/Dlna/StreamBuilder.cs
+++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs
@@ -456,7 +456,7 @@ namespace MediaBrowser.Model.Dlna
playlistItem.MaxAudioChannels = Math.Min(options.MaxAudioChannels.Value, currentValue);
}
- int audioBitrate = GetAudioBitrate(playlistItem.TargetAudioChannels, playlistItem.TargetAudioCodec);
+ int audioBitrate = GetAudioBitrate(options.GetMaxBitrate(), playlistItem.TargetAudioChannels, playlistItem.TargetAudioCodec, audioStream);
playlistItem.AudioBitrate = Math.Min(playlistItem.AudioBitrate ?? audioBitrate, audioBitrate);
int? maxBitrateSetting = options.GetMaxBitrate();
@@ -479,17 +479,35 @@ namespace MediaBrowser.Model.Dlna
return playlistItem;
}
- private int GetAudioBitrate(int? channels, string codec)
+ private int GetAudioBitrate(int? maxTotalBitrate, int? targetAudioChannels, string targetAudioCodec, MediaStream audioStream)
{
- if (channels.HasValue)
+ var defaultBitrate = 128000;
+
+ if (targetAudioChannels.HasValue)
{
- if (channels.Value >= 5)
+ if (targetAudioChannels.Value >= 5 && (maxTotalBitrate ?? 0) >= 1500000)
{
- return 320000;
+ defaultBitrate = 320000;
}
}
- return 128000;
+ int encoderAudioBitrateLimit = int.MaxValue;
+
+ if (audioStream != null)
+ {
+ // Seeing webm encoding failures when source has 1 audio channel and 22k bitrate.
+ // Any attempts to transcode over 64k will fail
+ if (audioStream.Channels.HasValue &&
+ audioStream.Channels.Value == 1)
+ {
+ if ((audioStream.BitRate ?? 0) < 64000)
+ {
+ encoderAudioBitrateLimit = 64000;
+ }
+ }
+ }
+
+ return Math.Min(defaultBitrate, encoderAudioBitrateLimit);
}
private PlayMethod? GetVideoDirectPlayProfile(DeviceProfile profile,
@@ -560,7 +578,7 @@ namespace MediaBrowser.Model.Dlna
// Check container conditions
foreach (ProfileCondition i in conditions)
{
- if (!conditionProcessor.IsVideoConditionSatisfied(i, audioBitrate, audioChannels, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams))
+ if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams))
{
LogConditionFailure(profile, "VideoContainerProfile", i, mediaSource);
@@ -593,7 +611,7 @@ namespace MediaBrowser.Model.Dlna
foreach (ProfileCondition i in conditions)
{
- if (!conditionProcessor.IsVideoConditionSatisfied(i, audioBitrate, audioChannels, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams))
+ if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams))
{
LogConditionFailure(profile, "VideoCodecProfile", i, mediaSource);
diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs
index b062bc240..645c1c7d0 100644
--- a/MediaBrowser.Model/Dlna/StreamInfo.cs
+++ b/MediaBrowser.Model/Dlna/StreamInfo.cs
@@ -233,6 +233,11 @@ namespace MediaBrowser.Model.Dlna
string liveStreamId = item.MediaSource == null ? null : item.MediaSource.LiveStreamId;
list.Add(new NameValuePair("LiveStreamId", liveStreamId ?? string.Empty));
+ if (isDlna)
+ {
+ list.Add(new NameValuePair("ItemId", item.ItemId));
+ }
+
return list;
}
diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj
index af0cbb166..340bd9462 100644
--- a/MediaBrowser.Model/MediaBrowser.Model.csproj
+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj
@@ -130,7 +130,6 @@
-
diff --git a/MediaBrowser.Model/Querying/ItemFields.cs b/MediaBrowser.Model/Querying/ItemFields.cs
index 77b3dc0ee..0362b7aed 100644
--- a/MediaBrowser.Model/Querying/ItemFields.cs
+++ b/MediaBrowser.Model/Querying/ItemFields.cs
@@ -199,11 +199,6 @@
/// The series studio
///
SeriesStudio,
-
- ///
- /// The soundtrack ids
- ///
- SoundtrackIds,
///
/// The sort name of the item
diff --git a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs
index 92327c9bc..69b78b5f1 100644
--- a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs
+++ b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs
@@ -38,10 +38,6 @@ namespace MediaBrowser.Providers.BoxSets
list.AddRange(target.LinkedChildren.Where(i => i.Type == LinkedChildType.Manual));
target.LinkedChildren = list;
- }
-
- if (replaceData || target.Shares.Count == 0)
- {
target.Shares = source.Shares;
}
}
diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs
index 334e14850..71bc9c065 100644
--- a/MediaBrowser.Providers/Manager/MetadataService.cs
+++ b/MediaBrowser.Providers/Manager/MetadataService.cs
@@ -360,7 +360,7 @@ namespace MediaBrowser.Providers.Manager
// If replacing all metadata, run internet providers first
if (options.ReplaceAllMetadata)
{
- var remoteResult = await ExecuteRemoteProviders(item, temp, logName, id, providers.OfType>(), cancellationToken)
+ var remoteResult = await ExecuteRemoteProviders(temp, logName, id, providers.OfType>(), cancellationToken)
.ConfigureAwait(false);
refreshResult.UpdateType = refreshResult.UpdateType | remoteResult.UpdateType;
@@ -372,9 +372,8 @@ namespace MediaBrowser.Providers.Manager
var hasLocalMetadata = false;
var userDataList = new List();
- var localProviders = providers.OfType>().ToList();
- foreach (var provider in localProviders)
+ foreach (var provider in providers.OfType>().ToList())
{
var providerName = provider.GetType().Name;
Logger.Debug("Running {0} for {1}", providerName, logName);
@@ -433,7 +432,7 @@ namespace MediaBrowser.Providers.Manager
// Local metadata is king - if any is found don't run remote providers
if (!options.ReplaceAllMetadata && (!hasLocalMetadata || options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh))
{
- var remoteResult = await ExecuteRemoteProviders(item, temp, logName, id, providers.OfType>(), cancellationToken)
+ var remoteResult = await ExecuteRemoteProviders(temp, logName, id, providers.OfType>(), cancellationToken)
.ConfigureAwait(false);
refreshResult.UpdateType = refreshResult.UpdateType | remoteResult.UpdateType;
@@ -447,17 +446,15 @@ namespace MediaBrowser.Providers.Manager
if (providers.Any(i => !(i is ICustomMetadataProvider)))
{
- // If no local providers and doing a full refresh, take data from item itself
- if (options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh &&
- localProviders.Count == 0 &&
- refreshResult.UpdateType > ItemUpdateType.None)
- {
- // TODO: If the new metadata from above has some blank data, this can cause old data to get filled into those empty fields
- MergeData(item, temp, new List(), false, true);
- }
-
if (refreshResult.UpdateType > ItemUpdateType.None)
{
+ // If no local metadata, take data from item itself
+ if (!hasLocalMetadata)
+ {
+ // TODO: If the new metadata from above has some blank data, this can cause old data to get filled into those empty fields
+ MergeData(item, temp, new List(), false, true);
+ }
+
MergeData(temp, item, item.LockedFields, true, true);
}
}
@@ -529,7 +526,7 @@ namespace MediaBrowser.Providers.Manager
return new TItemType();
}
- private async Task ExecuteRemoteProviders(TItemType item, TItemType temp, string logName, TIdType id, IEnumerable> providers, CancellationToken cancellationToken)
+ private async Task ExecuteRemoteProviders(TItemType temp, string logName, TIdType id, IEnumerable> providers, CancellationToken cancellationToken)
{
var refreshResult = new RefreshResult();
diff --git a/MediaBrowser.Providers/Music/MusicBrainzArtistProvider.cs b/MediaBrowser.Providers/Music/MusicBrainzArtistProvider.cs
index 9741b772a..c04f80549 100644
--- a/MediaBrowser.Providers/Music/MusicBrainzArtistProvider.cs
+++ b/MediaBrowser.Providers/Music/MusicBrainzArtistProvider.cs
@@ -122,7 +122,7 @@ namespace MediaBrowser.Providers.Music
if (singleResult != null)
{
musicBrainzId = singleResult.GetProviderId(MetadataProviders.MusicBrainzArtist);
- result.Item.Name = singleResult.Name;
+ //result.Item.Name = singleResult.Name;
}
}
diff --git a/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs b/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs
index 2e407f10c..c53a89db7 100644
--- a/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs
+++ b/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs
@@ -33,14 +33,10 @@ namespace MediaBrowser.Providers.Playlists
target.PlaylistMediaType = source.PlaylistMediaType;
}
- if (replaceData || target.Shares.Count == 0)
- {
- target.Shares = source.Shares;
- }
-
if (mergeMetadataSettings)
{
target.LinkedChildren = source.LinkedChildren;
+ target.Shares = source.Shares;
}
}
}
diff --git a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs
index faf73c059..796d5f651 100644
--- a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs
+++ b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs
@@ -81,7 +81,8 @@ namespace MediaBrowser.Server.Implementations.Collections
ProviderIds = options.ProviderIds,
Shares = options.UserIds.Select(i => new Share
{
- UserId = i.ToString("N")
+ UserId = i.ToString("N"),
+ CanEdit = true
}).ToList()
};
diff --git a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs
index bb9e9057a..bf199503b 100644
--- a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs
+++ b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs
@@ -101,9 +101,22 @@ namespace MediaBrowser.Server.Implementations.Configuration
///
private void UpdateMetadataPath()
{
- ((ServerApplicationPaths)ApplicationPaths).InternalMetadataPath = string.IsNullOrEmpty(Configuration.MetadataPath) ?
- GetInternalMetadataPath() :
- Configuration.MetadataPath;
+ string metadataPath;
+
+ if (string.IsNullOrWhiteSpace(Configuration.MetadataPath))
+ {
+ metadataPath = GetInternalMetadataPath();
+ }
+ else if (Configuration.EnableCustomPathSubFolders)
+ {
+ metadataPath = Path.Combine(Configuration.MetadataPath, "metadata");
+ }
+ else
+ {
+ metadataPath = Configuration.MetadataPath;
+ }
+
+ ((ServerApplicationPaths)ApplicationPaths).InternalMetadataPath = metadataPath;
if (Configuration.MergeMetadataAndImagesByName)
{
@@ -130,7 +143,7 @@ namespace MediaBrowser.Server.Implementations.Configuration
((ServerApplicationPaths)ApplicationPaths).TranscodingTempPath = string.IsNullOrEmpty(encodingConfig.TranscodingTempPath) ?
null :
- encodingConfig.TranscodingTempPath;
+ Path.Combine(encodingConfig.TranscodingTempPath, "transcoding-temp");
}
protected override void OnNamedConfigurationUpdated(string key, object configuration)
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
index f44b7b5a8..402bd4d98 100644
--- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs
+++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
@@ -325,18 +325,6 @@ namespace MediaBrowser.Server.Implementations.Dto
AttachBasicFields(dto, item, owner, options);
- if (fields.Contains(ItemFields.SoundtrackIds))
- {
- var hasSoundtracks = item as IHasSoundtracks;
-
- if (hasSoundtracks != null)
- {
- dto.SoundtrackIds = hasSoundtracks.SoundtrackIds
- .Select(i => i.ToString("N"))
- .ToArray();
- }
- }
-
var playlist = item as Playlist;
if (playlist != null)
{
diff --git a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
index 3fa0df760..b5b63181a 100644
--- a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
+++ b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
@@ -1,5 +1,6 @@
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.Logging;
using Mono.Nat;
@@ -7,6 +8,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
+using System.Net;
using System.Text;
using System.Threading;
@@ -17,15 +19,17 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
private readonly IServerApplicationHost _appHost;
private readonly ILogger _logger;
private readonly IServerConfigurationManager _config;
+ private readonly ISsdpHandler _ssdp;
private Timer _timer;
private bool _isStarted;
- public ExternalPortForwarding(ILogManager logmanager, IServerApplicationHost appHost, IServerConfigurationManager config)
+ public ExternalPortForwarding(ILogManager logmanager, IServerApplicationHost appHost, IServerConfigurationManager config, ISsdpHandler ssdp)
{
_logger = logmanager.GetLogger("PortMapper");
_appHost = appHost;
_config = config;
+ _ssdp = ssdp;
}
private string _lastConfigIdentifier;
@@ -75,7 +79,10 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
private void Start()
{
_logger.Debug("Starting NAT discovery");
-
+ NatUtility.EnabledProtocols = new List
+ {
+ NatProtocol.Pmp
+ };
NatUtility.DeviceFound += NatUtility_DeviceFound;
// Mono.Nat does never rise this event. The event is there however it is useless.
@@ -88,26 +95,38 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
NatUtility.UnhandledException += NatUtility_UnhandledException;
NatUtility.StartDiscovery();
- _timer = new Timer(s => _createdRules = new List(), null, TimeSpan.FromMinutes(3), TimeSpan.FromMinutes(3));
+ _timer = new Timer(s => _createdRules = new List(), null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5));
+
+ _ssdp.MessageReceived += _ssdp_MessageReceived;
_lastConfigIdentifier = GetConfigIdentifier();
_isStarted = true;
}
+ void _ssdp_MessageReceived(object sender, SsdpMessageEventArgs e)
+ {
+ var endpoint = e.EndPoint as IPEndPoint;
+
+ if (endpoint != null && e.LocalIp != null)
+ {
+ NatUtility.Handle(e.LocalIp, e.Message, endpoint, NatProtocol.Upnp);
+ }
+ }
+
void NatUtility_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
- //var ex = e.ExceptionObject as Exception;
+ var ex = e.ExceptionObject as Exception;
- //if (ex == null)
- //{
- // _logger.Error("Unidentified error reported by Mono.Nat");
- //}
- //else
- //{
- // // Seeing some blank exceptions coming through here
- // _logger.ErrorException("Error reported by Mono.Nat: ", ex);
- //}
+ if (ex == null)
+ {
+ //_logger.Error("Unidentified error reported by Mono.Nat");
+ }
+ else
+ {
+ // Seeing some blank exceptions coming through here
+ //_logger.ErrorException("Error reported by Mono.Nat: ", ex);
+ }
}
void NatUtility_DeviceFound(object sender, DeviceEventArgs e)
@@ -180,6 +199,8 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
_timer = null;
}
+ _ssdp.MessageReceived -= _ssdp_MessageReceived;
+
try
{
// This is not a significant improvement
diff --git a/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs b/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs
index 106e3c76b..e134670e3 100644
--- a/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs
+++ b/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs
@@ -8,7 +8,6 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.FileOrganization;
using MediaBrowser.Model.Logging;
-using MediaBrowser.Naming.IO;
using MediaBrowser.Server.Implementations.Library;
using MediaBrowser.Server.Implementations.Logging;
using System;
@@ -60,7 +59,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
var namingOptions = ((LibraryManager) _libraryManager).GetNamingOptions();
var resolver = new Naming.TV.EpisodeResolver(namingOptions, new PatternsLogger());
- var episodeInfo = resolver.Resolve(path, FileInfoType.File) ??
+ var episodeInfo = resolver.Resolve(path, false) ??
new Naming.TV.EpisodeInfo();
var seriesName = episodeInfo.SeriesName;
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index dcdf2aa7d..bafbecbc5 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -1,4 +1,5 @@
-using MediaBrowser.Common.Extensions;
+using Interfaces.IO;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO;
using MediaBrowser.Common.Progress;
using MediaBrowser.Common.ScheduledTasks;
@@ -17,7 +18,6 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Naming.Audio;
using MediaBrowser.Naming.Common;
-using MediaBrowser.Naming.IO;
using MediaBrowser.Naming.TV;
using MediaBrowser.Naming.Video;
using MediaBrowser.Server.Implementations.Library.Validators;
@@ -1767,14 +1767,13 @@ namespace MediaBrowser.Server.Implementations.Library
var resolver = new EpisodeResolver(GetNamingOptions(),
new PatternsLogger());
- var fileType = episode.VideoType == VideoType.BluRay || episode.VideoType == VideoType.Dvd || episode.VideoType == VideoType.HdDvd ?
- FileInfoType.Directory :
- FileInfoType.File;
+ var isFolder = episode.VideoType == VideoType.BluRay || episode.VideoType == VideoType.Dvd ||
+ episode.VideoType == VideoType.HdDvd;
var locationType = episode.LocationType;
var episodeInfo = locationType == LocationType.FileSystem || locationType == LocationType.Offline ?
- resolver.Resolve(episode.Path, fileType) :
+ resolver.Resolve(episode.Path, isFolder) :
new Naming.TV.EpisodeInfo();
if (episodeInfo == null)
@@ -1928,10 +1927,10 @@ namespace MediaBrowser.Server.Implementations.Library
var videoListResolver = new VideoListResolver(GetNamingOptions(), new PatternsLogger());
- var videos = videoListResolver.Resolve(fileSystemChildren.Select(i => new PortableFileInfo
+ var videos = videoListResolver.Resolve(fileSystemChildren.Select(i => new FileMetadata
{
- FullName = i.FullName,
- Type = GetFileType(i)
+ Id = i.FullName,
+ IsFolder = ((i.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
}).ToList());
@@ -1962,16 +1961,6 @@ namespace MediaBrowser.Server.Implementations.Library
}).OrderBy(i => i.Path).ToList();
}
- private FileInfoType GetFileType(FileSystemInfo info)
- {
- if ((info.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
- {
- return FileInfoType.Directory;
- }
-
- return FileInfoType.File;
- }
-
public IEnumerable