mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-09 23:30:50 +02:00
update startup wizard
This commit is contained in:
parent
b48ccef62e
commit
02b0734029
|
@ -112,9 +112,18 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
// If the path was passed in, save it into config now.
|
// If the path was passed in, save it into config now.
|
||||||
var encodingOptions = GetEncodingOptions();
|
var encodingOptions = GetEncodingOptions();
|
||||||
var appPath = encodingOptions.EncoderAppPath;
|
var appPath = encodingOptions.EncoderAppPath;
|
||||||
if (!string.IsNullOrWhiteSpace(FFMpegPath) && !string.Equals(FFMpegPath, appPath, StringComparison.Ordinal))
|
|
||||||
|
var valueToSave = FFMpegPath;
|
||||||
|
|
||||||
|
// if using system variable, don't save this.
|
||||||
|
if (string.Equals(valueToSave, "ffmpeg", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
encodingOptions.EncoderAppPath = FFMpegPath;
|
valueToSave = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.Equals(valueToSave, appPath, StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
encodingOptions.EncoderAppPath = valueToSave;
|
||||||
ConfigurationManager.SaveConfiguration("encoding", encodingOptions);
|
ConfigurationManager.SaveConfiguration("encoding", encodingOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,7 +170,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
{
|
{
|
||||||
appPath = Path.Combine(ConfigurationManager.ApplicationPaths.ProgramDataPath, "ffmpeg");
|
appPath = Path.Combine(ConfigurationManager.ApplicationPaths.ProgramDataPath, "ffmpeg");
|
||||||
}
|
}
|
||||||
|
|
||||||
var newPaths = GetEncoderPaths(appPath);
|
var newPaths = GetEncoderPaths(appPath);
|
||||||
|
if (string.IsNullOrWhiteSpace(newPaths.Item1) || string.IsNullOrWhiteSpace(newPaths.Item2))
|
||||||
|
{
|
||||||
|
newPaths = TestForInstalledVersions();
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(newPaths.Item1) && !string.IsNullOrWhiteSpace(newPaths.Item2))
|
if (!string.IsNullOrWhiteSpace(newPaths.Item1) && !string.IsNullOrWhiteSpace(newPaths.Item2))
|
||||||
{
|
{
|
||||||
|
@ -192,6 +206,52 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
return new Tuple<string, string>(null, null);
|
return new Tuple<string, string>(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Tuple<string, string> TestForInstalledVersions()
|
||||||
|
{
|
||||||
|
string encoderPath = null;
|
||||||
|
string probePath = null;
|
||||||
|
|
||||||
|
if (TestSystemInstalled("ffmpeg"))
|
||||||
|
{
|
||||||
|
encoderPath = "ffmpeg";
|
||||||
|
}
|
||||||
|
if (TestSystemInstalled("ffprobe"))
|
||||||
|
{
|
||||||
|
probePath = "ffprobe";
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Tuple<string, string>(encoderPath, probePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TestSystemInstalled(string app)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var startInfo = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = app,
|
||||||
|
Arguments = "-v",
|
||||||
|
UseShellExecute = false,
|
||||||
|
CreateNoWindow = true,
|
||||||
|
WindowStyle = ProcessWindowStyle.Hidden,
|
||||||
|
ErrorDialog = false
|
||||||
|
};
|
||||||
|
|
||||||
|
using (var process = Process.Start(startInfo))
|
||||||
|
{
|
||||||
|
process.WaitForExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.Debug("System app installed: " + app);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
_logger.Debug("System app not installed: " + app);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Tuple<string,string> GetPathsFromDirectory(string path)
|
private Tuple<string,string> GetPathsFromDirectory(string path)
|
||||||
{
|
{
|
||||||
// Since we can't predict the file extension, first try directly within the folder
|
// Since we can't predict the file extension, first try directly within the folder
|
||||||
|
|
|
@ -248,6 +248,7 @@ namespace MediaBrowser.Server.Mono.Native
|
||||||
|
|
||||||
switch (environment.OperatingSystem)
|
switch (environment.OperatingSystem)
|
||||||
{
|
{
|
||||||
|
case OperatingSystem.Osx:
|
||||||
case OperatingSystem.Bsd:
|
case OperatingSystem.Bsd:
|
||||||
break;
|
break;
|
||||||
case OperatingSystem.Linux:
|
case OperatingSystem.Linux:
|
||||||
|
@ -255,20 +256,6 @@ namespace MediaBrowser.Server.Mono.Native
|
||||||
info.ArchiveType = "7z";
|
info.ArchiveType = "7z";
|
||||||
info.Version = "20160215";
|
info.Version = "20160215";
|
||||||
break;
|
break;
|
||||||
case OperatingSystem.Osx:
|
|
||||||
|
|
||||||
info.ArchiveType = "7z";
|
|
||||||
|
|
||||||
switch (environment.SystemArchitecture)
|
|
||||||
{
|
|
||||||
case Architecture.X64:
|
|
||||||
info.Version = "20160124";
|
|
||||||
break;
|
|
||||||
case Architecture.X86:
|
|
||||||
info.Version = "20150110";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
info.DownloadUrls = GetDownloadUrls(environment);
|
info.DownloadUrls = GetDownloadUrls(environment);
|
||||||
|
@ -280,23 +267,6 @@ namespace MediaBrowser.Server.Mono.Native
|
||||||
{
|
{
|
||||||
switch (environment.OperatingSystem)
|
switch (environment.OperatingSystem)
|
||||||
{
|
{
|
||||||
case OperatingSystem.Osx:
|
|
||||||
|
|
||||||
switch (environment.SystemArchitecture)
|
|
||||||
{
|
|
||||||
case Architecture.X64:
|
|
||||||
return new[]
|
|
||||||
{
|
|
||||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x64-2.8.5.7z"
|
|
||||||
};
|
|
||||||
case Architecture.X86:
|
|
||||||
return new[]
|
|
||||||
{
|
|
||||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x86-2.5.3.7z"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OperatingSystem.Linux:
|
case OperatingSystem.Linux:
|
||||||
|
|
||||||
switch (environment.SystemArchitecture)
|
switch (environment.SystemArchitecture)
|
||||||
|
@ -311,11 +281,6 @@ namespace MediaBrowser.Server.Mono.Native
|
||||||
{
|
{
|
||||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-32bit-static.7z"
|
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-32bit-static.7z"
|
||||||
};
|
};
|
||||||
case Architecture.Arm:
|
|
||||||
return new[]
|
|
||||||
{
|
|
||||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-arm.7z"
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue