diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs index 7da11a405..639c1f54b 100644 --- a/MediaBrowser.Api/Images/ImageService.cs +++ b/MediaBrowser.Api/Images/ImageService.cs @@ -648,10 +648,8 @@ namespace MediaBrowser.Api.Images var serverFormats = _imageProcessor.GetSupportedImageOutputFormats(); - var clientFormats = GetClientSupportedFormats(); - if (serverFormats.Contains(ImageFormat.Webp) && - clientFormats.Contains(ImageFormat.Webp)) + GetClientSupportedFormats().Contains(ImageFormat.Webp)) { return ImageFormat.Webp; } diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs index f89a70340..269f4cb20 100644 --- a/MediaBrowser.Api/Library/LibraryService.cs +++ b/MediaBrowser.Api/Library/LibraryService.cs @@ -617,36 +617,14 @@ namespace MediaBrowser.Api.Library : (Folder)_libraryManager.RootFolder) : _libraryManager.GetItemById(request.Id); - var originalItem = item; - while (GetThemeSongIds(item).Count == 0 && request.InheritFromParent && item.Parent != null) { item = item.Parent; } - var themeSongIds = GetThemeSongIds(item); - - if (themeSongIds.Count == 0 && request.InheritFromParent) - { - var album = originalItem as MusicAlbum; - - if (album != null) - { - var linkedItemWithThemes = album.SoundtrackIds - .Select(i => _libraryManager.GetItemById(i)) - .FirstOrDefault(i => GetThemeSongIds(i).Count > 0); - - if (linkedItemWithThemes != null) - { - themeSongIds = GetThemeSongIds(linkedItemWithThemes); - item = linkedItemWithThemes; - } - } - } - var dtoOptions = GetDtoOptions(request); - var dtos = themeSongIds.Select(_libraryManager.GetItemById) + var dtos = GetThemeSongIds(item).Select(_libraryManager.GetItemById) .OrderBy(i => i.SortName) .Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, item)); @@ -682,41 +660,14 @@ namespace MediaBrowser.Api.Library : (Folder)_libraryManager.RootFolder) : _libraryManager.GetItemById(request.Id); - var originalItem = item; - while (GetThemeVideoIds(item).Count == 0 && request.InheritFromParent && item.Parent != null) { item = item.Parent; } - var themeVideoIds = GetThemeVideoIds(item); - - if (themeVideoIds.Count == 0 && request.InheritFromParent) - { - var album = originalItem as MusicAlbum; - - if (album == null) - { - album = originalItem.Parents.OfType().FirstOrDefault(); - } - - if (album != null) - { - var linkedItemWithThemes = album.SoundtrackIds - .Select(i => _libraryManager.GetItemById(i)) - .FirstOrDefault(i => GetThemeVideoIds(i).Count > 0); - - if (linkedItemWithThemes != null) - { - themeVideoIds = GetThemeVideoIds(linkedItemWithThemes); - item = linkedItemWithThemes; - } - } - } - var dtoOptions = GetDtoOptions(request); - var dtos = themeVideoIds.Select(_libraryManager.GetItemById) + var dtos = GetThemeVideoIds(item).Select(_libraryManager.GetItemById) .OrderBy(i => i.SortName) .Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, item)); diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index dc085dab9..5e06ab1d0 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -23,6 +23,7 @@ using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Model.Serialization; namespace MediaBrowser.Api.Playback { @@ -68,12 +69,14 @@ namespace MediaBrowser.Api.Playback protected ISubtitleEncoder SubtitleEncoder { get; private set; } protected IMediaSourceManager MediaSourceManager { get; private set; } protected IZipClient ZipClient { get; private set; } + protected IJsonSerializer JsonSerializer { get; private set; } /// /// Initializes a new instance of the class. /// - protected BaseStreamingService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient) + protected BaseStreamingService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer) { + JsonSerializer = jsonSerializer; ZipClient = zipClient; MediaSourceManager = mediaSourceManager; DeviceManager = deviceManager; @@ -598,7 +601,7 @@ namespace MediaBrowser.Api.Playback var maxWidthParam = request.MaxWidth.Value.ToString(UsCulture); var maxHeightParam = request.MaxHeight.Value.ToString(UsCulture); - filters.Add(string.Format("scale=trunc(min(iw\\,{0})/2)*2:trunc(min((iw/dar)\\,{1})/2)*2", maxWidthParam, maxHeightParam)); + filters.Add(string.Format("scale=trunc(min(max(iw\\,ih*dar)\\,min({0}\\,{1}*dar))/2)*2:trunc(min(max(iw/dar\\,ih)\\,min({0}/dar\\,{1}))/2)*2", maxWidthParam, maxHeightParam)); } // If a fixed width was requested @@ -618,7 +621,7 @@ namespace MediaBrowser.Api.Playback } // If a max width was requested - else if (request.MaxWidth.HasValue && (!request.MaxHeight.HasValue || state.VideoStream == null)) + else if (request.MaxWidth.HasValue) { var maxWidthParam = request.MaxWidth.Value.ToString(UsCulture); @@ -626,35 +629,13 @@ namespace MediaBrowser.Api.Playback } // If a max height was requested - else if (request.MaxHeight.HasValue && (!request.MaxWidth.HasValue || state.VideoStream == null)) + else if (request.MaxHeight.HasValue) { var maxHeightParam = request.MaxHeight.Value.ToString(UsCulture); filters.Add(string.Format("scale=trunc(oh*a*2)/2:min(ih\\,{0})", maxHeightParam)); } - else if (request.MaxWidth.HasValue || - request.MaxHeight.HasValue || - request.Width.HasValue || - request.Height.HasValue) - { - if (state.VideoStream != null) - { - // Need to perform calculations manually - - // Try to account for bad media info - var currentHeight = state.VideoStream.Height ?? request.MaxHeight ?? request.Height ?? 0; - var currentWidth = state.VideoStream.Width ?? request.MaxWidth ?? request.Width ?? 0; - - var outputSize = DrawingUtils.Resize(currentWidth, currentHeight, request.Width, request.Height, request.MaxWidth, request.MaxHeight); - - var manualWidthParam = outputSize.Width.ToString(UsCulture); - var manualHeightParam = outputSize.Height.ToString(UsCulture); - - filters.Add(string.Format("scale=trunc({0}/2)*2:trunc({1}/2)*2", manualWidthParam, manualHeightParam)); - } - } - if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase)) { filters[filters.Count - 1] += ":flags=fast_bilinear"; @@ -1027,7 +1008,7 @@ namespace MediaBrowser.Api.Playback // FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory. state.LogFileStream = FileSystem.GetFileStream(logFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, true); - var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(Request.AbsoluteUri + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine); + var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(Request.AbsoluteUri + Environment.NewLine + Environment.NewLine + JsonSerializer.SerializeToString(state.MediaSource) + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine); await state.LogFileStream.WriteAsync(commandLineLogMessageBytes, 0, commandLineLogMessageBytes.Length, cancellationTokenSource.Token).ConfigureAwait(false); process.Exited += (sender, args) => OnFfMpegProcessExited(process, transcodingJob, state); @@ -1105,6 +1086,10 @@ namespace MediaBrowser.Api.Playback } } } + catch (ObjectDisposedException) + { + // Don't spam the log. This doesn't seem to throw in windows, but sometimes under linux + } catch (Exception ex) { Logger.ErrorException("Error reading ffmpeg log", ex); @@ -2033,8 +2018,6 @@ namespace MediaBrowser.Api.Playback profile.GetVideoMediaProfile(state.OutputContainer, audioCodec, videoCodec, - state.OutputAudioBitrate, - state.OutputAudioChannels, state.OutputWidth, state.OutputHeight, state.TargetVideoBitDepth, @@ -2121,8 +2104,6 @@ namespace MediaBrowser.Api.Playback state.OutputHeight, state.TargetVideoBitDepth, state.OutputVideoBitrate, - state.OutputAudioBitrate, - state.OutputAudioChannels, state.TargetTimestamp, isStaticallyStreamed, state.RunTimeTicks, diff --git a/MediaBrowser.Api/Playback/Dash/MpegDashService.cs b/MediaBrowser.Api/Playback/Dash/MpegDashService.cs index 0692c4863..1a90dbb53 100644 --- a/MediaBrowser.Api/Playback/Dash/MpegDashService.cs +++ b/MediaBrowser.Api/Playback/Dash/MpegDashService.cs @@ -8,6 +8,7 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.Net; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Serialization; using ServiceStack; using System; using System.Collections.Generic; @@ -53,7 +54,7 @@ namespace MediaBrowser.Api.Playback.Dash public class MpegDashService : BaseHlsService { - public MpegDashService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, INetworkManager networkManager) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient) + public MpegDashService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, INetworkManager networkManager) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer) { NetworkManager = networkManager; } diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs index 78dee4c44..b10c02e17 100644 --- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs @@ -13,6 +13,7 @@ using System.IO; using System.Text; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Model.Serialization; namespace MediaBrowser.Api.Playback.Hls { @@ -21,7 +22,7 @@ namespace MediaBrowser.Api.Playback.Hls /// public abstract class BaseHlsService : BaseStreamingService { - protected BaseHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient) + protected BaseHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer) { } diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs index 4f938dc41..1f6bc242d 100644 --- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs @@ -10,6 +10,7 @@ using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Extensions; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Serialization; using ServiceStack; using System; using System.Collections.Generic; @@ -61,7 +62,7 @@ namespace MediaBrowser.Api.Playback.Hls public class DynamicHlsService : BaseHlsService { - public DynamicHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, INetworkManager networkManager) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient) + public DynamicHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, INetworkManager networkManager) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer) { NetworkManager = networkManager; } diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs index 8e2854c5e..626df59f2 100644 --- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs @@ -5,6 +5,7 @@ using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Serialization; using ServiceStack; using System; @@ -40,7 +41,7 @@ namespace MediaBrowser.Api.Playback.Hls /// public class VideoHlsService : BaseHlsService { - public VideoHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient) + public VideoHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer) { } diff --git a/MediaBrowser.Api/Playback/MediaInfoService.cs b/MediaBrowser.Api/Playback/MediaInfoService.cs index 69fb6f43f..72d4961cd 100644 --- a/MediaBrowser.Api/Playback/MediaInfoService.cs +++ b/MediaBrowser.Api/Playback/MediaInfoService.cs @@ -18,16 +18,6 @@ using System.Threading.Tasks; namespace MediaBrowser.Api.Playback { - [Route("/Items/{Id}/MediaInfo", "GET", Summary = "Gets live playback media info for an item")] - public class GetLiveMediaInfo : IReturn - { - [ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] - public string Id { get; set; } - - [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] - public string UserId { get; set; } - } - [Route("/Items/{Id}/PlaybackInfo", "GET", Summary = "Gets live playback media info for an item")] public class GetPlaybackInfo : IReturn { @@ -55,6 +45,19 @@ namespace MediaBrowser.Api.Playback public string LiveStreamId { get; set; } } + [Route("/Playback/BitrateTest", "GET")] + public class GetBitrateTestBytes : IReturn + { + [ApiMember(Name = "Size", Description = "Size", IsRequired = true, DataType = "int", ParameterType = "query", Verb = "GET")] + public long Size { get; set; } + + public GetBitrateTestBytes() + { + // 100k + Size = 102400; + } + } + [Authenticated] public class MediaInfoService : BaseApiService { @@ -73,13 +76,19 @@ namespace MediaBrowser.Api.Playback _networkManager = networkManager; } - public async Task Get(GetPlaybackInfo request) + public object Get(GetBitrateTestBytes request) { - var result = await GetPlaybackInfo(request.Id, request.UserId, new[] { MediaType.Audio, MediaType.Video }).ConfigureAwait(false); - return ToOptimizedResult(result); + var bytes = new byte[request.Size]; + + for (var i = 0; i < bytes.Length; i++) + { + bytes[i] = 0; + } + + return ResultFactory.GetResult(bytes, "application/octet-stream"); } - public async Task Get(GetLiveMediaInfo request) + public async Task Get(GetPlaybackInfo request) { var result = await GetPlaybackInfo(request.Id, request.UserId, new[] { MediaType.Audio, MediaType.Video }).ConfigureAwait(false); return ToOptimizedResult(result); diff --git a/MediaBrowser.Api/Playback/Progressive/AudioService.cs b/MediaBrowser.Api/Playback/Progressive/AudioService.cs index fee501159..67a9cab58 100644 --- a/MediaBrowser.Api/Playback/Progressive/AudioService.cs +++ b/MediaBrowser.Api/Playback/Progressive/AudioService.cs @@ -8,6 +8,7 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Serialization; using ServiceStack; using System.Collections.Generic; @@ -31,7 +32,7 @@ namespace MediaBrowser.Api.Playback.Progressive /// public class AudioService : BaseProgressiveStreamingService { - public AudioService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, imageProcessor, httpClient) + public AudioService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer, imageProcessor, httpClient) { } diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs index 8ed17ca17..835f3357e 100644 --- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs +++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs @@ -10,6 +10,7 @@ using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.Net; using MediaBrowser.Model.IO; using MediaBrowser.Model.MediaInfo; +using MediaBrowser.Model.Serialization; using ServiceStack.Web; using System; using System.Collections.Generic; @@ -27,7 +28,7 @@ namespace MediaBrowser.Api.Playback.Progressive protected readonly IImageProcessor ImageProcessor; protected readonly IHttpClient HttpClient; - protected BaseProgressiveStreamingService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient) + protected BaseProgressiveStreamingService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer) { ImageProcessor = imageProcessor; HttpClient = httpClient; diff --git a/MediaBrowser.Api/Playback/Progressive/VideoService.cs b/MediaBrowser.Api/Playback/Progressive/VideoService.cs index 0ded108b1..27482c50c 100644 --- a/MediaBrowser.Api/Playback/Progressive/VideoService.cs +++ b/MediaBrowser.Api/Playback/Progressive/VideoService.cs @@ -7,6 +7,7 @@ using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Serialization; using ServiceStack; using System; using System.IO; @@ -61,7 +62,7 @@ namespace MediaBrowser.Api.Playback.Progressive /// public class VideoService : BaseProgressiveStreamingService { - public VideoService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, imageProcessor, httpClient) + public VideoService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IImageProcessor imageProcessor, IHttpClient httpClient) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer, imageProcessor, httpClient) { } diff --git a/MediaBrowser.Api/Subtitles/SubtitleService.cs b/MediaBrowser.Api/Subtitles/SubtitleService.cs index a70118d3c..c9280b6f6 100644 --- a/MediaBrowser.Api/Subtitles/SubtitleService.cs +++ b/MediaBrowser.Api/Subtitles/SubtitleService.cs @@ -100,6 +100,7 @@ namespace MediaBrowser.Api.Subtitles } [Route("/Videos/{Id}/{MediaSourceId}/Subtitles/{Index}/subtitles.m3u8", "GET", Summary = "Gets an HLS subtitle playlist.")] + [Authenticated] public class GetSubtitlePlaylist { /// diff --git a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj index d7e5886d5..e603ea373 100644 --- a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj +++ b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj @@ -48,9 +48,9 @@ Always - + False - ..\packages\NLog.3.2.0.0\lib\net45\NLog.dll + ..\packages\NLog.3.2.1\lib\net45\NLog.dll False @@ -58,11 +58,8 @@ False - ..\packages\SimpleInjector.2.7.0\lib\net45\SimpleInjector.dll - - - False - ..\packages\SimpleInjector.2.7.0\lib\net45\SimpleInjector.Diagnostics.dll + ..\packages\SimpleInjector.2.8.0\lib\net45\SimpleInjector.dll + True diff --git a/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs b/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs index 0fd4e2787..c27dfd68d 100644 --- a/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs +++ b/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs @@ -6,16 +6,29 @@ using System.Linq; using System.Net; using System.Net.NetworkInformation; using System.Net.Sockets; +using System.Threading; namespace MediaBrowser.Common.Implementations.Networking { public abstract class BaseNetworkManager { protected ILogger Logger { get; private set; } + private Timer _clearCacheTimer; protected BaseNetworkManager(ILogger logger) { Logger = logger; + + // Can't use network change events due to a crash in Linux + _clearCacheTimer = new Timer(ClearCacheTimerCallback, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1)); + } + + private void ClearCacheTimerCallback(object state) + { + lock (_localIpAddressSyncLock) + { + _localIpAddresses = null; + } } private volatile List _localIpAddresses; @@ -36,7 +49,6 @@ namespace MediaBrowser.Common.Implementations.Networking var addresses = GetLocalIpAddressesInternal().ToList(); _localIpAddresses = addresses; - BindEvents(); return addresses; } @@ -46,35 +58,6 @@ namespace MediaBrowser.Common.Implementations.Networking return _localIpAddresses; } - private void BindEvents() - { - NetworkChange.NetworkAddressChanged -= NetworkChange_NetworkAddressChanged; - NetworkChange.NetworkAvailabilityChanged -= NetworkChange_NetworkAvailabilityChanged; - - NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged; - NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged; - } - - void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e) - { - Logger.Debug("NetworkAvailabilityChanged fired. Resetting cached network info."); - - lock (_localIpAddressSyncLock) - { - _localIpAddresses = null; - } - } - - void NetworkChange_NetworkAddressChanged(object sender, EventArgs e) - { - Logger.Debug("NetworkAddressChanged fired. Resetting cached network info."); - - lock (_localIpAddressSyncLock) - { - _localIpAddresses = null; - } - } - private IEnumerable GetLocalIpAddressesInternal() { var list = GetIPsDefault() diff --git a/MediaBrowser.Common.Implementations/packages.config b/MediaBrowser.Common.Implementations/packages.config index 825b6662b..e57c874f2 100644 --- a/MediaBrowser.Common.Implementations/packages.config +++ b/MediaBrowser.Common.Implementations/packages.config @@ -1,5 +1,5 @@  - - + + diff --git a/MediaBrowser.Controller/Dlna/ISsdpHandler.cs b/MediaBrowser.Controller/Dlna/ISsdpHandler.cs new file mode 100644 index 000000000..e4126ddcf --- /dev/null +++ b/MediaBrowser.Controller/Dlna/ISsdpHandler.cs @@ -0,0 +1,9 @@ +using System; + +namespace MediaBrowser.Controller.Dlna +{ + public interface ISsdpHandler + { + event EventHandler MessageReceived; + } +} diff --git a/MediaBrowser.Dlna/Ssdp/SsdpMessageEventArgs.cs b/MediaBrowser.Controller/Dlna/SsdpMessageEventArgs.cs similarity index 85% rename from MediaBrowser.Dlna/Ssdp/SsdpMessageEventArgs.cs rename to MediaBrowser.Controller/Dlna/SsdpMessageEventArgs.cs index 602a5bfc1..63f3a67aa 100644 --- a/MediaBrowser.Dlna/Ssdp/SsdpMessageEventArgs.cs +++ b/MediaBrowser.Controller/Dlna/SsdpMessageEventArgs.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Net; -namespace MediaBrowser.Dlna.Ssdp +namespace MediaBrowser.Controller.Dlna { public class SsdpMessageEventArgs { @@ -13,6 +13,7 @@ namespace MediaBrowser.Dlna.Ssdp public Dictionary Headers { get; set; } public IPAddress LocalIp { get; set; } + public byte[] Message { get; set; } public SsdpMessageEventArgs() { diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index 100633d7f..623329ca6 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -52,34 +52,6 @@ namespace MediaBrowser.Controller.Entities.Audio /// true if this instance has embedded image; otherwise, false. public bool HasEmbeddedImage { get; set; } - /// - /// Override this to true if class should be grouped under a container in indicies - /// The container class should be defined via IndexContainer - /// - /// true if [group in index]; otherwise, false. - [IgnoreDataMember] - public override bool GroupInIndex - { - get - { - return true; - } - } - - /// - /// Override this to return the folder that should be used to construct a container - /// for this item in an index. GroupInIndex should be true as well. - /// - /// The index container. - [IgnoreDataMember] - public override Folder IndexContainer - { - get - { - return LatestItemsIndexContainer ?? new MusicAlbum { Name = "Unknown Album" }; - } - } - [IgnoreDataMember] protected override bool SupportsOwnedItems { @@ -94,7 +66,7 @@ namespace MediaBrowser.Controller.Entities.Audio { get { - return Parents.OfType().FirstOrDefault(); + return AlbumEntity; } } @@ -148,6 +120,12 @@ namespace MediaBrowser.Controller.Entities.Audio /// The album. public string Album { get; set; } + [IgnoreDataMember] + public MusicAlbum AlbumEntity + { + get { return FindParent(); } + } + /// /// Gets the type of the media. /// @@ -177,7 +155,7 @@ namespace MediaBrowser.Controller.Entities.Audio /// System.String. protected override string CreateUserDataKey() { - var parent = FindParent(); + var parent = AlbumEntity; if (parent != null) { diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index dc3f13b01..c060f53a6 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -2,7 +2,6 @@ using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Users; -using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; @@ -14,11 +13,8 @@ namespace MediaBrowser.Controller.Entities.Audio /// public class MusicAlbum : Folder, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasLookupInfo { - public List SoundtrackIds { get; set; } - public MusicAlbum() { - SoundtrackIds = new List(); Artists = new List(); AlbumArtists = new List(); } @@ -77,49 +73,6 @@ namespace MediaBrowser.Controller.Entities.Audio return Tracks; } - /// - /// Songs will group into us so don't also include us in the index - /// - /// true if [include in index]; otherwise, false. - [IgnoreDataMember] - public override bool IncludeInIndex - { - get - { - return false; - } - } - - /// - /// Override this to true if class should be grouped under a container in indicies - /// The container class should be defined via IndexContainer - /// - /// true if [group in index]; otherwise, false. - [IgnoreDataMember] - public override bool GroupInIndex - { - get - { - return true; - } - } - - /// - /// The unknwon artist - /// - private static readonly MusicArtist UnknwonArtist = new MusicArtist { Name = "" }; - - /// - /// Override this to return the folder that should be used to construct a container - /// for this item in an index. GroupInIndex should be true as well. - /// - /// The index container. - [IgnoreDataMember] - public override Folder IndexContainer - { - get { return Parent as MusicArtist ?? UnknwonArtist; } - } - public List Artists { get; set; } /// diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 3313f45fd..8b6cbdc93 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -906,38 +906,6 @@ namespace MediaBrowser.Controller.Entities /// The provider ids. public Dictionary ProviderIds { get; set; } - /// - /// Override this to false if class should be ignored for indexing purposes - /// - /// true if [include in index]; otherwise, false. - [IgnoreDataMember] - public virtual bool IncludeInIndex - { - get { return true; } - } - - /// - /// Override this to true if class should be grouped under a container in indicies - /// The container class should be defined via IndexContainer - /// - /// true if [group in index]; otherwise, false. - [IgnoreDataMember] - public virtual bool GroupInIndex - { - get { return false; } - } - - /// - /// Override this to return the folder that should be used to construct a container - /// for this item in an index. GroupInIndex should be true as well. - /// - /// The index container. - [IgnoreDataMember] - public virtual Folder IndexContainer - { - get { return null; } - } - [IgnoreDataMember] public virtual Folder LatestItemsIndexContainer { diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index c8408365d..8f5b8f6cf 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -45,16 +45,6 @@ namespace MediaBrowser.Controller.Entities.TV /// The index number. public int? IndexNumberEnd { get; set; } - /// - /// We want to group into series not show individually in an index - /// - /// true if [group in index]; otherwise, false. - [IgnoreDataMember] - public override bool GroupInIndex - { - get { return true; } - } - [IgnoreDataMember] protected override bool SupportsOwnedItems { @@ -91,19 +81,6 @@ namespace MediaBrowser.Controller.Entities.TV } } - /// - /// We roll up into series - /// - /// The index container. - [IgnoreDataMember] - public override Folder IndexContainer - { - get - { - return Season; - } - } - [IgnoreDataMember] public override Folder LatestItemsIndexContainer { diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index a99b8c659..cfd6b46e0 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Controller.Localization; -using MediaBrowser.Controller.Providers; +using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; using MediaBrowser.Model.Users; @@ -15,20 +14,6 @@ namespace MediaBrowser.Controller.Entities.TV /// public class Season : Folder, IHasSeries, IHasLookupInfo { - - /// - /// Seasons are just containers - /// - /// true if [include in index]; otherwise, false. - [IgnoreDataMember] - public override bool IncludeInIndex - { - get - { - return false; - } - } - [IgnoreDataMember] public override bool SupportsAddingToPlaylist { @@ -50,33 +35,6 @@ namespace MediaBrowser.Controller.Entities.TV get { return Series ?? Parent; } } - /// - /// We want to group into our Series - /// - /// true if [group in index]; otherwise, false. - [IgnoreDataMember] - public override bool GroupInIndex - { - get - { - return true; - } - } - - /// - /// Override this to return the folder that should be used to construct a container - /// for this item in an index. GroupInIndex should be true as well. - /// - /// The index container. - [IgnoreDataMember] - public override Folder IndexContainer - { - get - { - return Series; - } - } - // Genre, Rating and Stuido will all be the same protected override IEnumerable GetIndexByOptions() { diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index 4696afeb6..2663d19e8 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -94,19 +94,6 @@ namespace MediaBrowser.Controller.Entities.TV } } - /// - /// Series aren't included directly in indices - Their Episodes will roll up to them - /// - /// true if [include in index]; otherwise, false. - [IgnoreDataMember] - public override bool IncludeInIndex - { - get - { - return false; - } - } - /// /// Gets the user data key. /// diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs index 01a7486b3..5b70ee5f4 100644 --- a/MediaBrowser.Controller/Entities/User.cs +++ b/MediaBrowser.Controller/Entities/User.cs @@ -283,5 +283,17 @@ namespace MediaBrowser.Controller.Entities return hour >= schedule.StartHour && hour <= schedule.EndHour; } + + public bool IsFolderGrouped(Guid id) + { + var config = Configuration; + + if (config.ExcludeFoldersFromGrouping != null) + { + return !config.ExcludeFoldersFromGrouping.Select(i => new Guid(i)).Contains(id); + } + + return config.GroupedFolders.Select(i => new Guid(i)).Contains(id); + } } } diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs index 1672bda92..3e4dff033 100644 --- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs +++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs @@ -1754,12 +1754,10 @@ namespace MediaBrowser.Controller.Entities private IEnumerable GetMediaFolders(User user) { - var excludeFolderIds = user.Configuration.ExcludeFoldersFromGrouping.Select(i => new Guid(i)).ToList(); - return user.RootFolder .GetChildren(user, true, true) .OfType() - .Where(i => !excludeFolderIds.Contains(i.Id) && !UserView.IsExcludedFromGrouping(i)); + .Where(i => user.IsFolderGrouped(i.Id) && !UserView.IsExcludedFromGrouping(i)); } private IEnumerable GetMediaFolders(User user, IEnumerable viewTypes) diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 64490a74f..b66e6b9c8 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -116,7 +116,9 @@ + + diff --git a/MediaBrowser.Dlna/Channels/DlnaChannelFactory.cs b/MediaBrowser.Dlna/Channels/DlnaChannelFactory.cs index 78db68f63..7e896492d 100644 --- a/MediaBrowser.Dlna/Channels/DlnaChannelFactory.cs +++ b/MediaBrowser.Dlna/Channels/DlnaChannelFactory.cs @@ -2,6 +2,7 @@ using MediaBrowser.Common.Net; using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Providers; using MediaBrowser.Dlna.ContentDirectory; using MediaBrowser.Dlna.PlayTo; diff --git a/MediaBrowser.Dlna/Didl/DidlBuilder.cs b/MediaBrowser.Dlna/Didl/DidlBuilder.cs index 52791822b..08f770735 100644 --- a/MediaBrowser.Dlna/Didl/DidlBuilder.cs +++ b/MediaBrowser.Dlna/Didl/DidlBuilder.cs @@ -149,8 +149,6 @@ namespace MediaBrowser.Dlna.Didl targetHeight, streamInfo.TargetVideoBitDepth, streamInfo.TargetVideoBitrate, - streamInfo.TargetAudioChannels, - streamInfo.TargetAudioBitrate, streamInfo.TargetTimestamp, streamInfo.IsDirectStream, streamInfo.RunTimeTicks, @@ -276,11 +274,9 @@ namespace MediaBrowser.Dlna.Didl streamInfo.AudioCodec, streamInfo.VideoCodec, streamInfo.TargetAudioBitrate, - targetChannels, targetWidth, targetHeight, streamInfo.TargetVideoBitDepth, - streamInfo.TargetVideoBitrate, streamInfo.TargetVideoProfile, streamInfo.TargetVideoLevel, streamInfo.TargetFramerate, diff --git a/MediaBrowser.Dlna/DlnaManager.cs b/MediaBrowser.Dlna/DlnaManager.cs index bdc8beb98..2d2525919 100644 --- a/MediaBrowser.Dlna/DlnaManager.cs +++ b/MediaBrowser.Dlna/DlnaManager.cs @@ -482,7 +482,7 @@ namespace MediaBrowser.Dlna var profile = GetProfile(headers) ?? GetDefaultProfile(); - return new DescriptionXmlBuilder(profile, serverUuId, serverAddress, _appHost.FriendlyName).GetXml(); + return new DescriptionXmlBuilder(profile, serverUuId, serverAddress, _appHost.FriendlyName, serverUuId.GetMD5().ToString("N")).GetXml(); } public ImageStream GetIcon(string filename) @@ -544,7 +544,9 @@ namespace MediaBrowser.Dlna new DirectTvProfile(), new DishHopperJoeyProfile(), new DefaultProfile(), - new PopcornHourProfile() + new PopcornHourProfile(), + new VlcProfile(), + new BubbleUpnpProfile() }; foreach (var item in list) diff --git a/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs b/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs index 4a8baf0fe..f9f9c3f18 100644 --- a/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs +++ b/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs @@ -37,13 +37,26 @@ namespace MediaBrowser.Dlna.Main private readonly ILocalizationManager _localization; private readonly IMediaSourceManager _mediaSourceManager; - private SsdpHandler _ssdpHandler; + private readonly SsdpHandler _ssdpHandler; private DeviceDiscovery _deviceDiscovery; private readonly List _registeredServerIds = new List(); private bool _dlnaServerStarted; - public DlnaEntryPoint(IServerConfigurationManager config, ILogManager logManager, IServerApplicationHost appHost, INetworkManager network, ISessionManager sessionManager, IHttpClient httpClient, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IImageProcessor imageProcessor, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager) + public DlnaEntryPoint(IServerConfigurationManager config, + ILogManager logManager, + IServerApplicationHost appHost, + INetworkManager network, + ISessionManager sessionManager, + IHttpClient httpClient, + ILibraryManager libraryManager, + IUserManager userManager, + IDlnaManager dlnaManager, + IImageProcessor imageProcessor, + IUserDataManager userDataManager, + ILocalizationManager localization, + IMediaSourceManager mediaSourceManager, + ISsdpHandler ssdpHandler) { _config = config; _appHost = appHost; @@ -57,6 +70,7 @@ namespace MediaBrowser.Dlna.Main _userDataManager = userDataManager; _localization = localization; _mediaSourceManager = mediaSourceManager; + _ssdpHandler = (SsdpHandler)ssdpHandler; _logger = logManager.GetLogger("Dlna"); } @@ -109,8 +123,6 @@ namespace MediaBrowser.Dlna.Main { try { - _ssdpHandler = new SsdpHandler(_logger, _config, GenerateServerSignature()); - _ssdpHandler.Start(); _deviceDiscovery = new DeviceDiscovery(_logger, _config, _ssdpHandler, _appHost); @@ -123,7 +135,7 @@ namespace MediaBrowser.Dlna.Main } } - private void DisposeSsdpHandler() + private void DisposeDeviceDiscovery() { try { @@ -133,15 +145,6 @@ namespace MediaBrowser.Dlna.Main { _logger.ErrorException("Error disposing device discovery", ex); } - - try - { - _ssdpHandler.Dispose(); - } - catch (Exception ex) - { - _logger.ErrorException("Error disposing ssdp handler", ex); - } } public void StartDlnaServer() @@ -184,29 +187,6 @@ namespace MediaBrowser.Dlna.Main } } - 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 - ); - } - private readonly object _syncLock = new object(); private void StartPlayToManager() { @@ -260,7 +240,7 @@ namespace MediaBrowser.Dlna.Main { DisposeDlnaServer(); DisposePlayToManager(); - DisposeSsdpHandler(); + DisposeDeviceDiscovery(); } public void DisposeDlnaServer() diff --git a/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj b/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj index adb096ec7..204872e7b 100644 --- a/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj +++ b/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj @@ -77,10 +77,12 @@ + + @@ -135,7 +137,6 @@ - @@ -205,6 +206,10 @@ + + + +