diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-04-28 11:05:28 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-04-28 11:05:28 -0400 |
| commit | 0f4c28c120751e1cf6e0562ef0445c7fa46cf0a4 (patch) | |
| tree | 3688a8a031542fee4e31a52ee20df1057c69eb43 | |
| parent | 20507355eb045bc8337ca4697e3a8b906feb82be (diff) | |
expose more dlna profile properties
6 files changed, 54 insertions, 31 deletions
diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/SystemUpdateTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/SystemUpdateTask.cs index cf22f8e9a..641d402bd 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.Tasks cancellationToken.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.cs index 14643f468..c6d1b7053 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.Ssdp public 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.cs index 3577c6f01..d5e1f6686 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.cs index b6bf9b183..fe49227e4 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -267,10 +267,11 @@ namespace MediaBrowser.Model.Dlna get { 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.Dlna if (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.Dlna var 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.cs index 217b068bf..9aa28809f 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.Notifications var 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.cs index 157f39755..ce85a0964 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, |
