added HasUpdateAvailable

This commit is contained in:
Luke Pulverenti 2014-01-05 01:50:48 -05:00
parent 178d216b28
commit a01ee815fb
6 changed files with 46 additions and 3 deletions

View file

@ -864,7 +864,7 @@ namespace MediaBrowser.Api.Playback
/// </summary> /// </summary>
/// <param name="process">The process.</param> /// <param name="process">The process.</param>
/// <param name="state">The state.</param> /// <param name="state">The state.</param>
protected void OnFfMpegProcessExited(Process process, StreamState state) protected async void OnFfMpegProcessExited(Process process, StreamState state)
{ {
if (state.IsoMount != null) if (state.IsoMount != null)
{ {
@ -889,6 +889,18 @@ namespace MediaBrowser.Api.Playback
{ {
Logger.Info("FFMpeg exited with an error for {0}", outputFilePath); Logger.Info("FFMpeg exited with an error for {0}", outputFilePath);
} }
if (!string.IsNullOrEmpty(state.LiveTvStreamId))
{
try
{
await LiveTvManager.CloseLiveStream(state.LiveTvStreamId, CancellationToken.None).ConfigureAwait(false);
}
catch (Exception ex)
{
Logger.ErrorException("Error closing live tv stream", ex);
}
}
} }
/// <summary> /// <summary>
@ -936,6 +948,8 @@ namespace MediaBrowser.Api.Playback
{ {
var streamInfo = await LiveTvManager.GetRecordingStream(request.Id, cancellationToken).ConfigureAwait(false); var streamInfo = await LiveTvManager.GetRecordingStream(request.Id, cancellationToken).ConfigureAwait(false);
state.LiveTvStreamId = streamInfo.Id;
if (!string.IsNullOrEmpty(streamInfo.Path) && File.Exists(streamInfo.Path)) if (!string.IsNullOrEmpty(streamInfo.Path) && File.Exists(streamInfo.Path))
{ {
state.MediaPath = streamInfo.Path; state.MediaPath = streamInfo.Path;
@ -961,6 +975,8 @@ namespace MediaBrowser.Api.Playback
var streamInfo = await LiveTvManager.GetChannelStream(request.Id, cancellationToken).ConfigureAwait(false); var streamInfo = await LiveTvManager.GetChannelStream(request.Id, cancellationToken).ConfigureAwait(false);
state.LiveTvStreamId = streamInfo.Id;
if (!string.IsNullOrEmpty(streamInfo.Path) && File.Exists(streamInfo.Path)) if (!string.IsNullOrEmpty(streamInfo.Path) && File.Exists(streamInfo.Path))
{ {
state.MediaPath = streamInfo.Path; state.MediaPath = streamInfo.Path;

View file

@ -52,5 +52,7 @@ namespace MediaBrowser.Api.Playback
public bool SendInputOverStandardInput { get; set; } public bool SendInputOverStandardInput { get; set; }
public CancellationTokenSource StandardInputCancellationTokenSource { get; set; } public CancellationTokenSource StandardInputCancellationTokenSource { get; set; }
public string LiveTvStreamId { get; set; }
} }
} }

View file

@ -227,5 +227,13 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{QueryResult{RecordingGroupDto}}.</returns> /// <returns>Task{QueryResult{RecordingGroupDto}}.</returns>
Task<QueryResult<RecordingGroupDto>> GetRecordingGroups(RecordingGroupQuery query, CancellationToken cancellationToken); Task<QueryResult<RecordingGroupDto>> GetRecordingGroups(RecordingGroupQuery query, CancellationToken cancellationToken);
/// <summary>
/// Closes the live stream.
/// </summary>
/// <param name="id">The identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task CloseLiveStream(string id, CancellationToken cancellationToken);
} }
} }

View file

@ -122,6 +122,12 @@ namespace MediaBrowser.Model.System
/// <value>The wan address.</value> /// <value>The wan address.</value>
public string WanAddress { get; set; } public string WanAddress { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance has update available.
/// </summary>
/// <value><c>true</c> if this instance has update available; otherwise, <c>false</c>.</value>
public bool HasUpdateAvailable { get; set; }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="SystemInfo" /> class. /// Initializes a new instance of the <see cref="SystemInfo" /> class.
/// </summary> /// </summary>

View file

@ -945,5 +945,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
TotalRecordCount = groups.Count TotalRecordCount = groups.Count
}; };
} }
public Task CloseLiveStream(string id, CancellationToken cancellationToken)
{
return ActiveService.CloseLiveStream(id, cancellationToken);
}
} }
} }

View file

@ -293,7 +293,7 @@ namespace MediaBrowser.ServerApplication
await Task.WhenAll(itemsTask, displayPreferencesTask, userdataTask).ConfigureAwait(false); await Task.WhenAll(itemsTask, displayPreferencesTask, userdataTask).ConfigureAwait(false);
progress.Report(100); progress.Report(100);
await ((UserManager) UserManager).Initialize().ConfigureAwait(false); await ((UserManager)UserManager).Initialize().ConfigureAwait(false);
SetKernelProperties(); SetKernelProperties();
} }
@ -628,7 +628,8 @@ namespace MediaBrowser.ServerApplication
OperatingSystem = Environment.OSVersion.ToString(), OperatingSystem = Environment.OSVersion.ToString(),
CanSelfRestart = CanSelfRestart, CanSelfRestart = CanSelfRestart,
CanSelfUpdate = CanSelfUpdate, CanSelfUpdate = CanSelfUpdate,
WanAddress = GetWanAddress() WanAddress = GetWanAddress(),
HasUpdateAvailable = _hasUpdateAvailable
}; };
} }
@ -699,6 +700,7 @@ namespace MediaBrowser.ServerApplication
} }
} }
private bool _hasUpdateAvailable;
/// <summary> /// <summary>
/// Checks for update. /// Checks for update.
/// </summary> /// </summary>
@ -712,6 +714,8 @@ namespace MediaBrowser.ServerApplication
var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, Constants.MbServerPkgName, null, ApplicationVersion, var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, Constants.MbServerPkgName, null, ApplicationVersion,
ConfigurationManager.CommonConfiguration.SystemUpdateLevel); ConfigurationManager.CommonConfiguration.SystemUpdateLevel);
_hasUpdateAvailable = version != null;
return version != null ? new CheckForUpdateResult { AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version } : return version != null ? new CheckForUpdateResult { AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version } :
new CheckForUpdateResult { AvailableVersion = ApplicationVersion, IsUpdateAvailable = false }; new CheckForUpdateResult { AvailableVersion = ApplicationVersion, IsUpdateAvailable = false };
} }
@ -727,6 +731,8 @@ namespace MediaBrowser.ServerApplication
{ {
await InstallationManager.InstallPackage(package, progress, cancellationToken).ConfigureAwait(false); await InstallationManager.InstallPackage(package, progress, cancellationToken).ConfigureAwait(false);
_hasUpdateAvailable = false;
OnApplicationUpdated(package.version); OnApplicationUpdated(package.version);
} }