expose more dlna profile properties

pull/702/head
Luke Pulverenti 10 years ago
parent 20507355eb
commit 0f4c28c120

@ -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);

@ -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;
}

@ -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:

@ -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;

@ -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),

@ -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,

Loading…
Cancel
Save