|
|
@ -236,6 +236,32 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
|
|
|
|
|
|
|
|
|
|
|
|
if (!File.Exists(fontFile))
|
|
|
|
if (!File.Exists(fontFile))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
await DownloadFontFile(fontsDirectory, fontFilename).ConfigureAwait(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await WriteFontConfigFile(fontsDirectory).ConfigureAwait(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task DownloadFontFile(string fontsDirectory, string fontFilename)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var existingFile = Directory
|
|
|
|
|
|
|
|
.EnumerateFiles(_appPaths.ProgramDataPath, fontFilename, SearchOption.AllDirectories)
|
|
|
|
|
|
|
|
.FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (existingFile != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
File.Copy(existingFile, Path.Combine(fontsDirectory, fontFilename), true);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (IOException ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Log this, but don't let it fail the operation
|
|
|
|
|
|
|
|
_logger.ErrorException("Error copying file", ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var tempFile = await _httpClient.GetTempFile(new HttpRequestOptions
|
|
|
|
var tempFile = await _httpClient.GetTempFile(new HttpRequestOptions
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Url = FontUrl,
|
|
|
|
Url = FontUrl,
|
|
|
@ -255,9 +281,6 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await WriteFontConfigFile(fontsDirectory).ConfigureAwait(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task WriteFontConfigFile(string fontsDirectory)
|
|
|
|
private async Task WriteFontConfigFile(string fontsDirectory)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const string fontConfigFilename = "fonts.conf";
|
|
|
|
const string fontConfigFilename = "fonts.conf";
|
|
|
|