The Free Software Media System - Server Backend & API
expose more dlna profile properties
Luke Pulverenti0f4c28c12075
diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/SystemUpdateTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/SystemUpdateTask.csindex cf22f8e9a3..641d402bda 100644--- a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/SystemUpdateTask.cs+++ b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/SystemUpdateTask.cs@@ -67,9 +67,6 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks/// <returns>Task.</returns>public async Task Execute(CancellationToken cancellationToken, IProgress<double> progress){- if (!_appHost.CanSelfUpdate) return;- if (!ConfigurationManager.CommonConfiguration.EnableAutoUpdate) return;-EventHandler<double> innerProgressHandler = (sender, e) => progress.Report(e * .1);// Create a progress object for the update check@@ -92,6 +89,8 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.TaskscancellationToken.ThrowIfCancellationRequested();+ if (!_appHost.CanSelfUpdate) return;+if (ConfigurationManager.CommonConfiguration.EnableAutoUpdate){Logger.Info("Update Revision {0} available. Updating...", updateInfo.AvailableVersion);diff --git a/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs b/MediaBrowser.Dlna/Ssdp/SsdpHandler.csindex 14643f4683..c6d1b70539 100644--- a/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs+++ b/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs@@ -40,6 +40,13 @@ namespace MediaBrowser.Dlna.Ssdp_logger = logger;_config = config;_serverSignature = serverSignature;++ _config.ConfigurationUpdated += _config_ConfigurationUpdated;+ }++ void _config_ConfigurationUpdated(object sender, EventArgs e)+ {+ ReloadAliveNotifier();}public event EventHandler<SsdpMessageEventArgs> MessageReceived;@@ -69,7 +76,7 @@ namespace MediaBrowser.Dlna.Ssdp_logger.Info("SSDP service started");Receive();- StartNotificationTimer();+ ReloadAliveNotifier();}public void SendDatagram(string header,@@ -249,6 +256,8 @@ namespace MediaBrowser.Dlna.Ssdppublic void Dispose(){+ _config.ConfigurationUpdated -= _config_ConfigurationUpdated;+_isDisposed = true;while (_messageQueue.Count != 0){@@ -365,25 +374,34 @@ namespace MediaBrowser.Dlna.Ssdp}private readonly object _notificationTimerSyncLock = new object();- private void StartNotificationTimer()+ private int _aliveNotifierIntervalMs;+ private void ReloadAliveNotifier(){if (!_config.Configuration.DlnaOptions.BlastAliveMessages){+ DisposeNotificationTimer();return;}- const int initialDelayMs = 3000;var intervalMs = _config.Configuration.DlnaOptions.BlastAliveMessageIntervalSeconds * 1000;- lock (_notificationTimerSyncLock)+ if (_notificationTimer == null || _aliveNotifierIntervalMs != intervalMs){- if (_notificationTimer == null)- {- _notificationTimer = new Timer(state => NotifyAll(), null, initialDelayMs, intervalMs);- }- else+ lock (_notificationTimerSyncLock){- _notificationTimer.Change(initialDelayMs, intervalMs);+ if (_notificationTimer == null)+ {+ _logger.Debug("Starting alive notifier");+ const int initialDelayMs = 3000;+ _notificationTimer = new Timer(state => NotifyAll(), null, initialDelayMs, intervalMs);+ }+ else+ {+ _logger.Debug("Updating alive notifier");+ _notificationTimer.Change(intervalMs, intervalMs);+ }++ _aliveNotifierIntervalMs = intervalMs;}}}@@ -394,6 +412,7 @@ namespace MediaBrowser.Dlna.Ssdp{if (_notificationTimer != null){+ _logger.Debug("Stopping alive notifier");_notificationTimer.Dispose();_notificationTimer = null;}diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.csindex 3577c6f018..d5e1f6686f 100644--- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs+++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs@@ -87,6 +87,9 @@ namespace MediaBrowser.Model.Dlna{switch (condition.Property){+ case ProfileConditionValue.AudioProfile:+ // TODO: Implement+ return true;case ProfileConditionValue.AudioBitrate:return IsConditionSatisfied(condition, audioBitrate);case ProfileConditionValue.AudioChannels:diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.csindex b6bf9b183d..fe49227e40 100644--- a/MediaBrowser.Model/Dlna/StreamInfo.cs+++ b/MediaBrowser.Model/Dlna/StreamInfo.cs@@ -267,10 +267,11 @@ namespace MediaBrowser.Model.Dlnaget{var stream = TargetAudioStream;+ var streamChannels = stream == null ? null : stream.Channels;return MaxAudioChannels.HasValue && !IsDirectStream- ? (stream.Channels.HasValue ? Math.Min(MaxAudioChannels.Value, stream.Channels.Value) : MaxAudioChannels.Value)- : stream == null ? null : stream.Channels;+ ? (streamChannels.HasValue ? Math.Min(MaxAudioChannels.Value, streamChannels.Value) : MaxAudioChannels.Value)+ : stream == null ? null : streamChannels;}}@@ -303,24 +304,14 @@ namespace MediaBrowser.Model.Dlnaif (RunTimeTicks.HasValue){- var totalBitrate = 0;+ var totalBitrate = TargetTotalBitrate;- if (AudioBitrate.HasValue)- {- totalBitrate += AudioBitrate.Value;- }- if (VideoBitrate.HasValue)- {- totalBitrate += VideoBitrate.Value;- }-- return Convert.ToInt64(totalBitrate * TimeSpan.FromTicks(RunTimeTicks.Value).TotalSeconds);+ return totalBitrate.HasValue ?+ Convert.ToInt64(totalBitrate * TimeSpan.FromTicks(RunTimeTicks.Value).TotalSeconds) :+ (long?)null;}- var stream = TargetAudioStream;- return MaxAudioChannels.HasValue && !IsDirectStream- ? (stream.Channels.HasValue ? Math.Min(MaxAudioChannels.Value, stream.Channels.Value) : MaxAudioChannels.Value)- : stream == null ? null : stream.Channels;+ return null;}}@@ -343,7 +334,7 @@ namespace MediaBrowser.Model.Dlnavar defaultValue = string.Equals(Container, "m2ts", StringComparison.OrdinalIgnoreCase)? TransportStreamTimestamp.Valid: TransportStreamTimestamp.None;-+return !IsDirectStream? defaultValue: MediaSource == null ? defaultValue : MediaSource.Timestamp ?? TransportStreamTimestamp.None;diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.csindex 217b068bf1..9aa28809fd 100644--- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs+++ b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs@@ -147,6 +147,13 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notificationsvar item = e.MediaInfo;+ if (e.Item !=null && e.Item.Parent == null)+ {+ // Don't report theme song or local trailer playback+ // TODO: This will also cause movie specials to not be reported+ return;+ }+var notification = new NotificationRequest{NotificationType = GetPlaybackNotificationType(item.MediaType),diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.csindex 157f397550..ce85a0964f 100644--- a/MediaBrowser.ServerApplication/ApplicationHost.cs+++ b/MediaBrowser.ServerApplication/ApplicationHost.cs@@ -1026,6 +1026,10 @@ namespace MediaBrowser.ServerApplication/// <returns>Task{CheckForUpdateResult}.</returns>public override async Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress){+#if DEBUG+ return new CheckForUpdateResult { AvailableVersion = ApplicationVersion, IsUpdateAvailable = false };+#endif+var availablePackages = await InstallationManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, Constants.MbServerPkgName, null, ApplicationVersion,