mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 19:37:55 +02:00
Add shutdown logic to server installer
This commit is contained in:
parent
94b6168e27
commit
187e1a4424
2 changed files with 22 additions and 1 deletions
|
@ -103,6 +103,27 @@ namespace MediaBrowser.Installer
|
||||||
var version = await GetPackageVersion();
|
var version = await GetPackageVersion();
|
||||||
lblStatus.Content = string.Format("Downloading {0} (version {1})...", FriendlyName, version.versionStr);
|
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")
|
||||||
|
{
|
||||||
|
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
|
||||||
|
|
||||||
|
MessageBox.Show("Error shutting down server.\n\n" + e.GetStatus() + "\n\n" + e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Download
|
// Download
|
||||||
var archive = await DownloadPackage(version);
|
var archive = await DownloadPackage(version);
|
||||||
dlAnimation.StopAnimation();
|
dlAnimation.StopAnimation();
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<PublisherName>Media Browser Team</PublisherName>
|
<PublisherName>Media Browser Team</PublisherName>
|
||||||
<SuiteName>Media Browser</SuiteName>
|
<SuiteName>Media Browser</SuiteName>
|
||||||
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
|
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
|
||||||
<ApplicationRevision>17</ApplicationRevision>
|
<ApplicationRevision>21</ApplicationRevision>
|
||||||
<ApplicationVersion>0.1.1.%2a</ApplicationVersion>
|
<ApplicationVersion>0.1.1.%2a</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||||
|
|
Loading…
Reference in a new issue