|
|
@ -7,6 +7,7 @@ using SharpCompress.Archive.SevenZip;
|
|
|
|
using SharpCompress.Common;
|
|
|
|
using SharpCompress.Common;
|
|
|
|
using SharpCompress.Reader;
|
|
|
|
using SharpCompress.Reader;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.IO;
|
|
|
|
using System.IO;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
@ -54,19 +55,16 @@ namespace MediaBrowser.ServerApplication.Implementations
|
|
|
|
Directory.CreateDirectory(versionedDirectoryPath);
|
|
|
|
Directory.CreateDirectory(versionedDirectoryPath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tasks = new List<Task>();
|
|
|
|
|
|
|
|
|
|
|
|
if (!File.Exists(info.ProbePath) || !File.Exists(info.Path))
|
|
|
|
if (!File.Exists(info.ProbePath) || !File.Exists(info.Path))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await DownloadFFMpeg(info).ConfigureAwait(false);
|
|
|
|
tasks.Add(DownloadFFMpeg(info));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
tasks.Add(DownloadFonts(versionedDirectoryPath));
|
|
|
|
{
|
|
|
|
|
|
|
|
await DownloadFonts(versionedDirectoryPath).ConfigureAwait(false);
|
|
|
|
await Task.WhenAll(tasks).ConfigureAwait(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.ErrorException("Error getting ffmpeg font files", ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return info;
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -87,6 +85,8 @@ namespace MediaBrowser.ServerApplication.Implementations
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw new ApplicationException("Unable to download required components. Please try again later.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Task<string> DownloadFFMpeg(FFMpegInfo info, string url)
|
|
|
|
private Task<string> DownloadFFMpeg(FFMpegInfo info, string url)
|
|
|
@ -160,23 +160,36 @@ namespace MediaBrowser.ServerApplication.Implementations
|
|
|
|
/// <param name="targetPath">The target path.</param>
|
|
|
|
/// <param name="targetPath">The target path.</param>
|
|
|
|
private async Task DownloadFonts(string targetPath)
|
|
|
|
private async Task DownloadFonts(string targetPath)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var fontsDirectory = Path.Combine(targetPath, "fonts");
|
|
|
|
try
|
|
|
|
|
|
|
|
|
|
|
|
if (!Directory.Exists(fontsDirectory))
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Directory.CreateDirectory(fontsDirectory);
|
|
|
|
var fontsDirectory = Path.Combine(targetPath, "fonts");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const string fontFilename = "ARIALUNI.TTF";
|
|
|
|
if (!Directory.Exists(fontsDirectory))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Directory.CreateDirectory(fontsDirectory);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const string fontFilename = "ARIALUNI.TTF";
|
|
|
|
|
|
|
|
|
|
|
|
var fontFile = Path.Combine(fontsDirectory, fontFilename);
|
|
|
|
var fontFile = Path.Combine(fontsDirectory, fontFilename);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!File.Exists(fontFile))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await DownloadFontFile(fontsDirectory, fontFilename).ConfigureAwait(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!File.Exists(fontFile))
|
|
|
|
await WriteFontConfigFile(fontsDirectory).ConfigureAwait(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (HttpException ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await DownloadFontFile(fontsDirectory, fontFilename).ConfigureAwait(false);
|
|
|
|
// Don't let the server crash because of this
|
|
|
|
|
|
|
|
_logger.ErrorException("Error downloading ffmpeg font files", ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Don't let the server crash because of this
|
|
|
|
|
|
|
|
_logger.ErrorException("Error writing ffmpeg font files", ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await WriteFontConfigFile(fontsDirectory).ConfigureAwait(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|