From 156a047cfefaffedc11d35f758f3f92720b30a91 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 29 Feb 2016 23:23:58 -0500 Subject: [PATCH 1/6] add null check to ScheduleDirect --- .../LiveTv/Listings/SchedulesDirect.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index 87d7ff3eba..4499432290 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -951,6 +951,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings public string stationID { get; set; } public List programs { get; set; } public MetadataSchedule metadata { get; set; } + + public Day() + { + programs = new List(); + } } // From c3eb571d1de4c06ded892284a79047deb5c567f7 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 29 Feb 2016 23:24:14 -0500 Subject: [PATCH 2/6] add null check to SyncJobProcessor --- MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs index e2e54e0569..7086735c09 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs @@ -308,6 +308,11 @@ namespace MediaBrowser.Server.Implementations.Sync throw new ArgumentException("Unrecognized category: " + category); } + if (parent == null) + { + return new List(); + } + query.User = user; var result = await parent.GetItems(query).ConfigureAwait(false); From 2eb492f86597bf9e19368b59426ac2805522603c Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 29 Feb 2016 23:24:42 -0500 Subject: [PATCH 3/6] update recording stoppage --- .../LiveTv/EmbyTV/DirectRecorder.cs | 7 +- .../LiveTv/EmbyTV/EmbyTV.cs | 71 +++++++++++++------ .../LiveTv/EmbyTV/EncodedRecorder.cs | 10 +-- .../LiveTv/EmbyTV/IRecorder.cs | 11 ++- .../LiveTv/EmbyTV/RecordingHelper.cs | 10 +-- 5 files changed, 73 insertions(+), 36 deletions(-) diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs index 9ac96165f7..d33b2c51df 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs @@ -23,7 +23,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV _fileSystem = fileSystem; } - public async Task Record(MediaSourceInfo mediaSource, string targetFile, Action onStarted, CancellationToken cancellationToken) + public async Task Record(MediaSourceInfo mediaSource, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken) { var httpRequestOptions = new HttpRequestOptions() { @@ -42,7 +42,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV _logger.Info("Copying recording stream to file stream"); - await response.Content.CopyToAsync(output, StreamDefaults.DefaultCopyToBufferSize, cancellationToken).ConfigureAwait(false); + var durationToken = new CancellationTokenSource(duration); + var linkedToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, durationToken.Token).Token; + + await response.Content.CopyToAsync(output, StreamDefaults.DefaultCopyToBufferSize, linkedToken).ConfigureAwait(false); } } } diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index e534d8c675..3ab08274c7 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -103,8 +103,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV public event EventHandler RecordingStatusChanged; - private readonly ConcurrentDictionary _activeRecordings = - new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase); + private readonly ConcurrentDictionary _activeRecordings = + new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase); public string Name { @@ -268,11 +268,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV { _timerProvider.Delete(remove); } - CancellationTokenSource cancellationTokenSource; + ActiveRecordingInfo activeRecordingInfo; - if (_activeRecordings.TryGetValue(timerId, out cancellationTokenSource)) + if (_activeRecordings.TryGetValue(timerId, out activeRecordingInfo)) { - cancellationTokenSource.Cancel(); + activeRecordingInfo.CancellationTokenSource.Cancel(); } } @@ -653,11 +653,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV return; } - var cancellationTokenSource = new CancellationTokenSource(); - - if (_activeRecordings.TryAdd(timer.Id, cancellationTokenSource)) + var activeRecordingInfo = new ActiveRecordingInfo { - await RecordStream(timer, recordingEndDate, cancellationTokenSource.Token).ConfigureAwait(false); + CancellationTokenSource = new CancellationTokenSource(), + TimerId = timer.Id + }; + + if (_activeRecordings.TryAdd(timer.Id, activeRecordingInfo)) + { + await RecordStream(timer, recordingEndDate, activeRecordingInfo, activeRecordingInfo.CancellationTokenSource.Token).ConfigureAwait(false); } else { @@ -674,7 +678,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV } } - private async Task RecordStream(TimerInfo timer, DateTime recordingEndDate, CancellationToken cancellationToken) + private async Task RecordStream(TimerInfo timer, DateTime recordingEndDate, ActiveRecordingInfo activeRecordingInfo, CancellationToken cancellationToken) { if (timer == null) { @@ -729,8 +733,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV var recordingFileName = _fileSystem.GetValidFilename(RecordingHelper.GetRecordingName(timer, info)).Trim() + ".ts"; recordPath = Path.Combine(recordPath, recordingFileName); - recordPath = EnsureFileUnique(recordPath); - _fileSystem.CreateDirectory(Path.GetDirectoryName(recordPath)); var recordingId = info.Id.GetMD5().ToString("N"); var recording = _recordingProvider.GetAll().FirstOrDefault(x => string.Equals(x.Id, recordingId, StringComparison.OrdinalIgnoreCase)); @@ -788,6 +790,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV { recordPath = Path.ChangeExtension(recordPath, ".mp4"); } + recordPath = EnsureFileUnique(recordPath, timer.Id); + _fileSystem.CreateDirectory(Path.GetDirectoryName(recordPath)); + activeRecordingInfo.Path = recordPath; _libraryMonitor.ReportFileSystemChangeBeginning(recordPath); @@ -798,9 +803,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV _logger.Info("Beginning recording. Will record for {0} minutes.", duration.TotalMinutes.ToString(CultureInfo.InvariantCulture)); - var durationToken = new CancellationTokenSource(duration); - var linkedToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, durationToken.Token).Token; - _logger.Info("Writing file to path: " + recordPath); _logger.Info("Opening recording stream from tuner provider"); @@ -810,10 +812,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV isResourceOpen = false; }; - await recorder.Record(mediaStreamInfo, recordPath, onStarted, linkedToken).ConfigureAwait(false); + await recorder.Record(mediaStreamInfo, recordPath, duration, onStarted, cancellationToken).ConfigureAwait(false); recording.Status = RecordingStatus.Completed; - _logger.Info("Recording completed"); + _logger.Info("Recording completed: {0}", recordPath); } finally { @@ -827,17 +829,17 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV } catch (OperationCanceledException) { - _logger.Info("Recording stopped"); + _logger.Info("Recording stopped: {0}", recordPath); recording.Status = RecordingStatus.Completed; } catch (Exception ex) { - _logger.ErrorException("Error recording", ex); + _logger.ErrorException("Error recording to {0}", ex, recordPath); recording.Status = RecordingStatus.Error; } finally { - CancellationTokenSource removed; + ActiveRecordingInfo removed; _activeRecordings.TryRemove(timer.Id, out removed); } @@ -863,12 +865,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV } } - private string EnsureFileUnique(string path) + private string EnsureFileUnique(string path, string timerId) { var originalPath = path; var index = 1; - while (_fileSystem.FileExists(path)) + while (FileExists(path, timerId)) { var parent = Path.GetDirectoryName(originalPath); var name = Path.GetFileNameWithoutExtension(originalPath); @@ -881,6 +883,22 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV return path; } + private bool FileExists(string path, string timerId) + { + if (_fileSystem.FileExists(path)) + { + return true; + } + + var hasRecordingAtPath = _activeRecordings.Values.ToList().Any(i => string.Equals(i.Path, path, StringComparison.OrdinalIgnoreCase) && !string.Equals(i.TimerId, timerId, StringComparison.OrdinalIgnoreCase)); + + if (hasRecordingAtPath) + { + return true; + } + return false; + } + private async Task GetRecorder() { if (GetConfiguration().EnableRecordingEncoding) @@ -1064,7 +1082,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV { foreach (var pair in _activeRecordings.ToList()) { - pair.Value.Cancel(); + pair.Value.CancellationTokenSource.Cancel(); } } @@ -1081,5 +1099,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV IsRegistered = true }); } + + class ActiveRecordingInfo + { + public string Path { get; set; } + public string TimerId { get; set; } + public CancellationTokenSource CancellationTokenSource { get; set; } + } } } \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs index 8b7bd897b9..62c9cd171e 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs @@ -38,7 +38,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV _json = json; } - public async Task Record(MediaSourceInfo mediaSource, string targetFile, Action onStarted, CancellationToken cancellationToken) + public async Task Record(MediaSourceInfo mediaSource, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken) { _targetPath = targetFile; _fileSystem.CreateDirectory(Path.GetDirectoryName(targetFile)); @@ -56,7 +56,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV RedirectStandardInput = true, FileName = _mediaEncoder.EncoderPath, - Arguments = GetCommandLineArgs(mediaSource, targetFile), + Arguments = GetCommandLineArgs(mediaSource, targetFile, duration), WindowStyle = ProcessWindowStyle.Hidden, ErrorDialog = false @@ -100,7 +100,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV } } - private string GetCommandLineArgs(MediaSourceInfo mediaSource, string targetFile) + private string GetCommandLineArgs(MediaSourceInfo mediaSource, string targetFile, TimeSpan duration) { string videoArgs; if (EncodeVideo(mediaSource)) @@ -116,14 +116,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV videoArgs = "-codec:v:0 copy"; } - var commandLineArgs = "-fflags +genpts -async 1 -vsync -1 -i \"{0}\" -sn {2} -map_metadata -1 -threads 0 {3} -y \"{1}\""; + var commandLineArgs = "-fflags +genpts -async 1 -vsync -1 -i \"{0}\" -t {4} -sn {2} -map_metadata -1 -threads 0 {3} -y \"{1}\""; if (mediaSource.ReadAtNativeFramerate) { commandLineArgs = "-re " + commandLineArgs; } - commandLineArgs = string.Format(commandLineArgs, mediaSource.Path, targetFile, videoArgs, GetAudioArgs(mediaSource)); + commandLineArgs = string.Format(commandLineArgs, mediaSource.Path, targetFile, videoArgs, GetAudioArgs(mediaSource), _mediaEncoder.GetTimeParameter(duration.Ticks)); return commandLineArgs; } diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/IRecorder.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/IRecorder.cs index 12e73c1f30..268a4f7512 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/IRecorder.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/IRecorder.cs @@ -7,6 +7,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV { public interface IRecorder { - Task Record(MediaSourceInfo mediaSource, string targetFile, Action onStarted, CancellationToken cancellationToken); + /// + /// Records the specified media source. + /// + /// The media source. + /// The target file. + /// The duration. + /// The on started. + /// The cancellation token. + /// Task. + Task Record(MediaSourceInfo mediaSource, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken); } } diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs index a5c869d457..37e10d9255 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs @@ -56,13 +56,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV name += " " + info.OriginalAirDate.Value.ToString("yyyy-MM-dd"); } - if (addHyphen) - { - name += " -"; - } - if (!string.IsNullOrWhiteSpace(info.EpisodeTitle)) { + if (addHyphen) + { + name += " -"; + } + name += " " + info.EpisodeTitle; } } From 60b2165414a32a0341426ffbaa3da9cd21e6acaf Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 1 Mar 2016 01:02:03 -0500 Subject: [PATCH 4/6] unify appSettings --- MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj | 3 --- 1 file changed, 3 deletions(-) diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 3feb98b929..b8bb397fc4 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -481,9 +481,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest From 9d20e298e12103604e851c99c7041025fc01c631 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 1 Mar 2016 01:02:55 -0500 Subject: [PATCH 5/6] exclude recordings from CleanDatabaseScheduledTask --- .../Persistence/CleanDatabaseScheduledTask.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs b/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs index 6ca1bae6db..5f1bf0216a 100644 --- a/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs +++ b/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs @@ -239,7 +239,11 @@ namespace MediaBrowser.Server.Implementations.Persistence typeof(Year).Name, typeof(Channel).Name, typeof(AggregateFolder).Name, - typeof(CollectionFolder).Name + typeof(CollectionFolder).Name, + + // LiveTVManager handles recordings + typeof(LiveTvAudioRecording).Name, + typeof(LiveTvVideoRecording).Name } }); From aa66c1defe4b4255e119e167f2ed928d8ff21ee3 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 1 Mar 2016 11:17:03 -0500 Subject: [PATCH 6/6] dlna fixes --- MediaBrowser.Dlna/PlayTo/PlayToManager.cs | 3 +- MediaBrowser.Dlna/Profiles/DefaultProfile.cs | 4 +-- MediaBrowser.Dlna/Profiles/Xml/BubbleUPnp.xml | 4 +-- MediaBrowser.Dlna/Profiles/Xml/Default.xml | 4 +-- MediaBrowser.Dlna/Profiles/Xml/Denon AVR.xml | 4 +-- .../Profiles/Xml/DirecTV HD-DVR.xml | 4 +-- .../Profiles/Xml/Dish Hopper-Joey.xml | 4 +-- .../Profiles/Xml/LG Smart TV.xml | 4 +-- .../Profiles/Xml/Linksys DMA2100.xml | 4 +-- .../Profiles/Xml/MediaMonkey.xml | 4 +-- .../Profiles/Xml/Panasonic Viera.xml | 4 +-- .../Profiles/Xml/Popcorn Hour.xml | 4 +-- .../Profiles/Xml/Samsung Smart TV.xml | 4 +-- .../Profiles/Xml/Sony Blu-ray Player 2013.xml | 4 +-- .../Profiles/Xml/Sony Blu-ray Player.xml | 4 +-- .../Profiles/Xml/Sony Bravia (2010).xml | 4 +-- .../Profiles/Xml/Sony Bravia (2011).xml | 4 +-- .../Profiles/Xml/Sony Bravia (2012).xml | 4 +-- .../Profiles/Xml/Sony Bravia (2013).xml | 4 +-- .../Profiles/Xml/Sony Bravia (2014).xml | 4 +-- .../Profiles/Xml/Sony PlayStation 3.xml | 4 +-- .../Profiles/Xml/Sony PlayStation 4.xml | 4 +-- MediaBrowser.Dlna/Profiles/Xml/Vlc.xml | 4 +-- MediaBrowser.Dlna/Profiles/Xml/WDTV Live.xml | 4 +-- MediaBrowser.Dlna/Profiles/Xml/Xbox 360.xml | 4 +-- MediaBrowser.Dlna/Profiles/Xml/Xbox One.xml | 4 +-- MediaBrowser.Dlna/Profiles/Xml/foobar2000.xml | 4 +-- MediaBrowser.Dlna/Ssdp/SsdpHandler.cs | 28 ++++--------------- 28 files changed, 59 insertions(+), 76 deletions(-) diff --git a/MediaBrowser.Dlna/PlayTo/PlayToManager.cs b/MediaBrowser.Dlna/PlayTo/PlayToManager.cs index 06697dee6e..0328111c58 100644 --- a/MediaBrowser.Dlna/PlayTo/PlayToManager.cs +++ b/MediaBrowser.Dlna/PlayTo/PlayToManager.cs @@ -85,8 +85,6 @@ namespace MediaBrowser.Dlna.PlayTo try { - var uri = new Uri(location); - lock (_nonRendererUrls) { if ((DateTime.UtcNow - _lastRendererClear).TotalMinutes >= 10) @@ -101,6 +99,7 @@ namespace MediaBrowser.Dlna.PlayTo } } + var uri = new Uri(location); var device = await Device.CreateuPnpDeviceAsync(uri, _httpClient, _config, _logger).ConfigureAwait(false); if (device.RendererCommands == null) diff --git a/MediaBrowser.Dlna/Profiles/DefaultProfile.cs b/MediaBrowser.Dlna/Profiles/DefaultProfile.cs index 37ce0ce679..09e10cecfc 100644 --- a/MediaBrowser.Dlna/Profiles/DefaultProfile.cs +++ b/MediaBrowser.Dlna/Profiles/DefaultProfile.cs @@ -31,8 +31,8 @@ namespace MediaBrowser.Dlna.Profiles MaxIconWidth = 48; MaxIconHeight = 48; - MaxStreamingBitrate = 10000000; - MaxStaticBitrate = 10000000; + MaxStreamingBitrate = 12000000; + MaxStaticBitrate = 12000000; MusicStreamingTranscodingBitrate = 128000; MusicSyncBitrate = 128000; diff --git a/MediaBrowser.Dlna/Profiles/Xml/BubbleUPnp.xml b/MediaBrowser.Dlna/Profiles/Xml/BubbleUPnp.xml index 5b8268f22b..409fe95e8c 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/BubbleUPnp.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/BubbleUPnp.xml @@ -23,8 +23,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Default.xml b/MediaBrowser.Dlna/Profiles/Xml/Default.xml index 6f68f8bd6c..ad378b01c4 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Default.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Default.xml @@ -17,8 +17,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Denon AVR.xml b/MediaBrowser.Dlna/Profiles/Xml/Denon AVR.xml index 24356b99a6..ea0ea81433 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Denon AVR.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Denon AVR.xml @@ -22,8 +22,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/DirecTV HD-DVR.xml b/MediaBrowser.Dlna/Profiles/Xml/DirecTV HD-DVR.xml index 782e0ae1b6..7ce7668a11 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/DirecTV HD-DVR.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/DirecTV HD-DVR.xml @@ -23,8 +23,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Dish Hopper-Joey.xml b/MediaBrowser.Dlna/Profiles/Xml/Dish Hopper-Joey.xml index 309eb72612..49f0dde8c2 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Dish Hopper-Joey.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Dish Hopper-Joey.xml @@ -24,8 +24,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/LG Smart TV.xml b/MediaBrowser.Dlna/Profiles/Xml/LG Smart TV.xml index f82f4aaf92..95aed7c1de 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/LG Smart TV.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/LG Smart TV.xml @@ -23,8 +23,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Linksys DMA2100.xml b/MediaBrowser.Dlna/Profiles/Xml/Linksys DMA2100.xml index d8f80de484..c7dbc62f9f 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Linksys DMA2100.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Linksys DMA2100.xml @@ -21,8 +21,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/MediaMonkey.xml b/MediaBrowser.Dlna/Profiles/Xml/MediaMonkey.xml index 58021a247c..2f28f67a1e 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/MediaMonkey.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/MediaMonkey.xml @@ -23,8 +23,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Panasonic Viera.xml b/MediaBrowser.Dlna/Profiles/Xml/Panasonic Viera.xml index b3a5b9c3b8..044e32eb4a 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Panasonic Viera.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Panasonic Viera.xml @@ -24,8 +24,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Popcorn Hour.xml b/MediaBrowser.Dlna/Profiles/Xml/Popcorn Hour.xml index 635ccce079..10944c3ac6 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Popcorn Hour.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Popcorn Hour.xml @@ -17,8 +17,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Samsung Smart TV.xml b/MediaBrowser.Dlna/Profiles/Xml/Samsung Smart TV.xml index 6fbc5f913c..4dd7db809a 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Samsung Smart TV.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Samsung Smart TV.xml @@ -23,8 +23,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml index 633c8a4012..5dd426a517 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml @@ -23,8 +23,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player.xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player.xml index 44d50a0337..ac4ce57a09 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player.xml @@ -25,8 +25,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2010).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2010).xml index c3592c320b..1f2ebc86da 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2010).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2010).xml @@ -24,8 +24,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2011).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2011).xml index f19c028fc5..5dc86c32e9 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2011).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2011).xml @@ -24,8 +24,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2012).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2012).xml index 8256750c82..b348283666 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2012).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2012).xml @@ -24,8 +24,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2013).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2013).xml index aa758e2139..e94b0058bd 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2013).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2013).xml @@ -24,8 +24,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2014).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2014).xml index 6875e65b22..653702b4aa 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2014).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2014).xml @@ -24,8 +24,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 3.xml b/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 3.xml index 8de5bc79fd..8f78626b2c 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 3.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 3.xml @@ -24,8 +24,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 4.xml b/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 4.xml index e94020a349..d4277d1557 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 4.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 4.xml @@ -24,8 +24,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Vlc.xml b/MediaBrowser.Dlna/Profiles/Xml/Vlc.xml index ef732e5311..433db1958c 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Vlc.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Vlc.xml @@ -23,8 +23,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/WDTV Live.xml b/MediaBrowser.Dlna/Profiles/Xml/WDTV Live.xml index 0bfca9fe13..0bbb3f2f19 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/WDTV Live.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/WDTV Live.xml @@ -24,8 +24,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Xbox 360.xml b/MediaBrowser.Dlna/Profiles/Xml/Xbox 360.xml index beabc4d0f9..969bcb563b 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Xbox 360.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Xbox 360.xml @@ -24,8 +24,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/Xbox One.xml b/MediaBrowser.Dlna/Profiles/Xml/Xbox One.xml index b68dce6dbb..8dbbf19e96 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Xbox One.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Xbox One.xml @@ -24,8 +24,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Profiles/Xml/foobar2000.xml b/MediaBrowser.Dlna/Profiles/Xml/foobar2000.xml index e865c4558c..b59ce5f2a3 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/foobar2000.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/foobar2000.xml @@ -23,8 +23,8 @@ 480 48 48 - 10000000 - 10000000 + 12000000 + 12000000 128000 128000 DMS-1.50 diff --git a/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs b/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs index 1c705803cf..e48471e341 100644 --- a/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs +++ b/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs @@ -132,11 +132,6 @@ namespace MediaBrowser.Dlna.Ssdp internal bool IgnoreMessage(SsdpMessageEventArgs args, bool isMulticast) { - if (!isMulticast) - { - return false; - } - string usn; if (args.Headers.TryGetValue("USN", out usn)) { @@ -243,7 +238,7 @@ namespace MediaBrowser.Dlna.Ssdp { if (i > 0) { - await Task.Delay(200).ConfigureAwait(false); + await Task.Delay(500).ConfigureAwait(false); } var dgram = new Datagram(endpoint, localAddress, _logger, msg, isBroadcast, enableDebugLogging); @@ -308,17 +303,9 @@ namespace MediaBrowser.Dlna.Ssdp var msg = new SsdpMessageBuilder().BuildMessage(header, values); - var ipEndPoint = endpoint as IPEndPoint; - if (ipEndPoint != null) - { - SendUnicastRequest(msg, ipEndPoint); - } - else - { - SendDatagram(msg, endpoint, null, false, 2); - SendDatagram(msg, endpoint, new IPEndPoint(d.Address, 0), false, 2); - //SendDatagram(header, values, endpoint, null, true); - } + SendDatagram(msg, endpoint, null, false, 2); + SendDatagram(msg, endpoint, new IPEndPoint(d.Address, 0), false, 2); + //SendDatagram(header, values, endpoint, null, true); if (enableDebugLogging) { @@ -481,7 +468,6 @@ namespace MediaBrowser.Dlna.Ssdp values["NTS"] = "ssdp:" + type; values["NT"] = dev.Type; values["USN"] = dev.USN; - values["X-EMBY-SERVERID"] = _appHost.SystemId; if (logMessage) { @@ -490,7 +476,7 @@ namespace MediaBrowser.Dlna.Ssdp var msg = new SsdpMessageBuilder().BuildMessage(header, values); - SendDatagram(msg, _ssdpEndp, new IPEndPoint(dev.Address, 0), true); + SendDatagram(msg, _ssdpEndp, new IPEndPoint(dev.Address, 0), true, 1); //SendUnicastRequest(msg, 1); } @@ -612,8 +598,6 @@ namespace MediaBrowser.Dlna.Ssdp return; } - _logger.Debug("Sending unicast search request"); - var ipSsdp = IPAddress.Parse(SSDPAddr); var ipTxEnd = new IPEndPoint(ipSsdp, SSDPPort); @@ -627,7 +611,7 @@ namespace MediaBrowser.Dlna.Ssdp return; } - _logger.Debug("Sending unicast search request"); + //_logger.Debug("Sending unicast request"); byte[] req = Encoding.ASCII.GetBytes(request);