diff --git a/MediaBrowser.Api/PackageService.cs b/MediaBrowser.Api/PackageService.cs
index 698d7e47fb..a45b11e269 100644
--- a/MediaBrowser.Api/PackageService.cs
+++ b/MediaBrowser.Api/PackageService.cs
@@ -123,10 +123,7 @@ namespace MediaBrowser.Api
if (updateCheckResult.IsUpdateAvailable)
{
- result.Add(new PackageVersionInfo
- {
- versionStr = updateCheckResult.AvailableVersion.ToString()
- });
+ result.Add(updateCheckResult.Package);
}
}
diff --git a/MediaBrowser.Common/Constants/Constants.cs b/MediaBrowser.Common/Constants/Constants.cs
index e8a347829b..676518737d 100644
--- a/MediaBrowser.Common/Constants/Constants.cs
+++ b/MediaBrowser.Common/Constants/Constants.cs
@@ -8,6 +8,6 @@ namespace MediaBrowser.Common.Constants
{
public static class Constants
{
- public const string MBAdminUrl = "http://mb3admin.com/admin/";
+ public const string MBAdminUrl = "http://www.mb3admin.com/admin/";
}
}
diff --git a/MediaBrowser.Installer/MainWindow.xaml.cs b/MediaBrowser.Installer/MainWindow.xaml.cs
index fe672ec07c..63e1f5dbd6 100644
--- a/MediaBrowser.Installer/MainWindow.xaml.cs
+++ b/MediaBrowser.Installer/MainWindow.xaml.cs
@@ -112,31 +112,59 @@ namespace MediaBrowser.Installer
// Determine Package version
var version = await GetPackageVersion();
- lblStatus.Content = string.Format("Downloading {0} (version {1})...", FriendlyName, version.versionStr);
- // Now in the background - try and shut down the server if that is what we are installing
- if (PackageName == "MBServer")
+ // Now try and shut down the server if that is what we are installing and it is running
+ if (PackageName == "MBServer" && Process.GetProcessesByName("mediabrowser.serverapplication").Length != 0)
{
- Task.Run(async () =>
- {
- using (var client = new WebClient())
- {
- try
- {
- await client.UploadStringTaskAsync("http://localhost:8096/mediabrowser/system/shutdown", "").ConfigureAwait(false);
- }
- catch (WebException e)
- {
- if (e.GetStatus() == HttpStatusCode.NotFound || e.Message.StartsWith("Unable to connect",StringComparison.OrdinalIgnoreCase)) return; // just wasn't running
+ lblStatus.Content = "Shutting Down Media Browser Server...";
+ using (var client = new WebClient())
+ {
+ try
+ {
+ client.UploadString("http://localhost:8096/mediabrowser/System/Shutdown", "");
+ }
+ catch (WebException e)
+ {
+ if (e.GetStatus() == HttpStatusCode.NotFound || e.Message.StartsWith("Unable to connect",StringComparison.OrdinalIgnoreCase)) return; // just wasn't running
- MessageBox.Show("Error shutting down server.\n\n" + e.GetStatus() + "\n\n" + e.Message);
- }
- }
- });
+ MessageBox.Show("Error shutting down server. Please be sure it is not running before hitting OK.\n\n" + e.GetStatus() + "\n\n" + e.Message);
+ }
+ }
+ }
+ else
+ {
+ if (PackageName == "MBTheater")
+ {
+ // Uninstalling MBT - shut it down if it is running
+ var processes = Process.GetProcessesByName("mediabrowser.ui");
+ if (processes.Length > 0)
+ {
+ lblStatus.Content = "Shutting Down Media Browser Theater...";
+ try
+ {
+ processes[0].Kill();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Unable to shutdown Media Browser Theater. Please ensure it is not running before hitting OK.\n\n" + ex.Message, "Error");
+ }
+ }
+
+ }
}
// Download
- var archive = await DownloadPackage(version);
+ string archive = null;
+ lblStatus.Content = string.Format("Downloading {0} (version {1})...", FriendlyName, version.versionStr);
+ try
+ {
+ archive = await DownloadPackage(version);
+ }
+ catch (Exception e)
+ {
+ SystemClose("Error Downloading Package - " + e.GetType().FullName + "\n\n" + e.Message);
+ }
+
dlAnimation.StopAnimation();
prgProgress.Visibility = btnCancel.Visibility = Visibility.Hidden;
diff --git a/MediaBrowser.Installer/MediaBrowser.Installer.csproj b/MediaBrowser.Installer/MediaBrowser.Installer.csproj
index 36769fdb28..4149a8ab18 100644
--- a/MediaBrowser.Installer/MediaBrowser.Installer.csproj
+++ b/MediaBrowser.Installer/MediaBrowser.Installer.csproj
@@ -29,7 +29,7 @@
Media Browser Team
Media Browser
false
- 21
+ 28
0.1.1.%2a
false
true
diff --git a/MediaBrowser.Model/Updates/CheckForUpdateResult.cs b/MediaBrowser.Model/Updates/CheckForUpdateResult.cs
index 48c0b398c1..c9bc2d6b9d 100644
--- a/MediaBrowser.Model/Updates/CheckForUpdateResult.cs
+++ b/MediaBrowser.Model/Updates/CheckForUpdateResult.cs
@@ -17,6 +17,15 @@ namespace MediaBrowser.Model.Updates
/// Gets or sets the available version.
///
/// The available version.
- public Version AvailableVersion { get; set; }
+ public Version AvailableVersion
+ {
+ get { return Package != null ? Package.version : new Version(0, 0); }
+ set { } // need this for the serializer
+ }
+
+ ///
+ /// Get or sets package information for an available update
+ ///
+ public PackageVersionInfo Package { get; set; }
}
}
diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs
index d97f4b53fc..0ed3b228e4 100644
--- a/MediaBrowser.ServerApplication/ApplicationHost.cs
+++ b/MediaBrowser.ServerApplication/ApplicationHost.cs
@@ -11,6 +11,7 @@ using MediaBrowser.Common.IO;
using MediaBrowser.Common.Kernel;
using MediaBrowser.Common.Net;
using MediaBrowser.Common.ScheduledTasks;
+using MediaBrowser.Common.Updates;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Library;
using MediaBrowser.IsoMounter;
@@ -148,7 +149,7 @@ namespace MediaBrowser.ServerApplication
/// true if this instance can self update; otherwise, false.
public bool CanSelfUpdate
{
- get { return ClickOnceHelper.IsNetworkDeployed; }
+ get { return true; }
}
///
@@ -157,10 +158,14 @@ namespace MediaBrowser.ServerApplication
/// The cancellation token.
/// The progress.
/// Task{CheckForUpdateResult}.
- public Task CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress progress)
+ public async Task CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress progress)
{
- // Get package manager using Resolve()
- return new ApplicationUpdateCheck().CheckForApplicationUpdate(cancellationToken, progress);
+ var pkgManager = Resolve();
+ var availablePackages = await pkgManager.GetAvailablePackages(Resolve(), Resolve(), Kernel.SecurityManager, Kernel.ResourcePools, Resolve(), CancellationToken.None).ConfigureAwait(false);
+ var version = Kernel.InstallationManager.GetLatestCompatibleVersion(availablePackages, "MBServer", Kernel.Configuration.SystemUpdateLevel);
+
+ return version != null ? new CheckForUpdateResult {AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version} :
+ new CheckForUpdateResult();
}
///
diff --git a/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs b/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs
index 9937177a7c..934ff284bd 100644
--- a/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs
+++ b/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs
@@ -1,5 +1,6 @@
using System;
using System.Diagnostics;
+using System.Net;
using System.Reflection;
using System.IO;
using System.Threading;
@@ -78,6 +79,41 @@ namespace MediaBrowser.Uninstaller.Execute
if (Product == "Server")
{
RemoveShortcut(Path.Combine(startMenu, "MB Dashboard.lnk"));
+ if (Process.GetProcessesByName("mediabrowser.serverapplication").Length != 0)
+ {
+ using (var client = new WebClient())
+ {
+ lblHeading.Content = "Shutting Down Media Browser Server...";
+ try
+ {
+ client.UploadString("http://localhost:8096/mediabrowser/system/shutdown", "");
+ }
+ catch (WebException ex)
+ {
+ if (ex.Status != WebExceptionStatus.ConnectFailure && !ex.Message.StartsWith("Unable to connect", StringComparison.OrdinalIgnoreCase))
+ {
+ MessageBox.Show("Error shutting down server. Please be sure it is not running before hitting OK.\n\n" + ex.Status + "\n\n" + ex.Message);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ // Installing MBT - shut it down if it is running
+ var processes = Process.GetProcessesByName("mediabrowser.ui");
+ if (processes.Length > 0)
+ {
+ lblHeading.Content = "Shutting Down Media Browser Theater...";
+ try
+ {
+ processes[0].Kill();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Unable to shutdown Media Browser Theater. Please ensure it is not running before hitting OK.\n\n" + ex.Message, "Error");
+ }
+ }
}
// if the startmenu item is empty now - delete it too
if (Directory.GetFiles(startMenu).Length == 0)
@@ -99,6 +135,7 @@ namespace MediaBrowser.Uninstaller.Execute
var rootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MediaBrowser" + RootSuffix);
+ lblHeading.Content = "Removing System Files...";
if (cbxRemoveAll.IsChecked == true)
{
// Just remove our whole directory
@@ -107,7 +144,6 @@ namespace MediaBrowser.Uninstaller.Execute
else
{
// First remove the system
- lblHeading.Content = "Removing System Files...";
RemovePath(Path.Combine(rootPath, "System"));
RemovePath(Path.Combine(rootPath, "MediaTools"));