aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ServerApplication/Native/WindowsApp.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.ServerApplication/Native/WindowsApp.cs')
-rw-r--r--MediaBrowser.ServerApplication/Native/WindowsApp.cs72
1 files changed, 65 insertions, 7 deletions
diff --git a/MediaBrowser.ServerApplication/Native/WindowsApp.cs b/MediaBrowser.ServerApplication/Native/WindowsApp.cs
index 146a4372b..f5abcf336 100644
--- a/MediaBrowser.ServerApplication/Native/WindowsApp.cs
+++ b/MediaBrowser.ServerApplication/Native/WindowsApp.cs
@@ -1,13 +1,18 @@
-using MediaBrowser.Common.Net;
+using System;
+using MediaBrowser.Common.Net;
using MediaBrowser.Model.Logging;
using MediaBrowser.Server.Startup.Common;
using MediaBrowser.ServerApplication.Networking;
using System.Collections.Generic;
+using System.Diagnostics;
using System.IO;
using System.Reflection;
+using System.Windows.Forms;
using CommonIO;
using MediaBrowser.Controller.Power;
+using MediaBrowser.Server.Implementations.Persistence;
using MediaBrowser.Server.Startup.Common.FFMpeg;
+using OperatingSystem = MediaBrowser.Server.Startup.Common.OperatingSystem;
namespace MediaBrowser.ServerApplication.Native
{
@@ -134,7 +139,12 @@ namespace MediaBrowser.ServerApplication.Native
public void PreventSystemStandby()
{
- Standby.PreventSystemStandby();
+ MainStartup.Invoke(Standby.PreventSleep);
+ }
+
+ public void AllowSystemStandby()
+ {
+ MainStartup.Invoke(Standby.AllowSleep);
}
public IPowerManagement GetPowerManagement()
@@ -148,24 +158,72 @@ namespace MediaBrowser.ServerApplication.Native
info.FFMpegFilename = "ffmpeg.exe";
info.FFProbeFilename = "ffprobe.exe";
- info.Version = "20160401";
+ info.Version = "20160410";
info.ArchiveType = "7z";
- info.IsEmbedded = true;
+ info.IsEmbedded = false;
info.DownloadUrls = GetDownloadUrls();
return info;
}
+ public void LaunchUrl(string url)
+ {
+ var process = new Process
+ {
+ StartInfo = new ProcessStartInfo
+ {
+ FileName = url
+ },
+
+ EnableRaisingEvents = true,
+ };
+
+ process.Exited += ProcessExited;
+
+ try
+ {
+ process.Start();
+ }
+ catch (Exception ex)
+ {
+ _logger.ErrorException("Error launching url: {0}", ex, url);
+
+ throw;
+ }
+ }
+
+ public IDbConnector GetDbConnector()
+ {
+ return new DbConnector(_logger);
+ }
+
+ /// <summary>
+ /// Processes the exited.
+ /// </summary>
+ /// <param name="sender">The sender.</param>
+ /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
+ private static void ProcessExited(object sender, EventArgs e)
+ {
+ ((Process)sender).Dispose();
+ }
+
private string[] GetDownloadUrls()
{
switch (Environment.SystemArchitecture)
{
case Architecture.X86_X64:
- return new[] { "MediaBrowser.ServerApplication.ffmpeg.ffmpegx64.7z" };
+ return new[]
+ {
+ "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win64.7z",
+ "https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20160409-git-0c90b2e-win64-static.7z"
+ };
case Architecture.X86:
- return new[] { "MediaBrowser.ServerApplication.ffmpeg.ffmpegx86.7z" };
+ return new[]
+ {
+ "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win32.7z",
+ "https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20160409-git-0c90b2e-win32-static.7z"
+ };
}
-
return new string[] { };
}
}