diff --git a/MediaBrowser.Controller/IServerApplicationPaths.cs b/MediaBrowser.Controller/IServerApplicationPaths.cs
index f88d7a5f6a..aa6ff4d97a 100644
--- a/MediaBrowser.Controller/IServerApplicationPaths.cs
+++ b/MediaBrowser.Controller/IServerApplicationPaths.cs
@@ -76,13 +76,6 @@ namespace MediaBrowser.Controller
/// The FF MPEG stream cache path.
string EncodedMediaCachePath { get; }
- ///
- /// Gets the folder path to tools
- ///
- /// The media tools path.
- string MediaToolsPath { get; }
-
- ///
/// Gets the downloaded images data path.
///
/// The downloaded images data path.
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index 02f15b94ab..1c03e11ddd 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -202,6 +202,8 @@
+
+
diff --git a/MediaBrowser.Controller/MediaInfo/FFMpegManager.cs b/MediaBrowser.Controller/MediaInfo/FFMpegManager.cs
index d6fc8eb94a..3a4f3cae7e 100644
--- a/MediaBrowser.Controller/MediaInfo/FFMpegManager.cs
+++ b/MediaBrowser.Controller/MediaInfo/FFMpegManager.cs
@@ -1,4 +1,5 @@
-using MediaBrowser.Common.IO;
+using System.Text;
+using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Model.Entities;
@@ -285,6 +286,32 @@ namespace MediaBrowser.Controller.MediaInfo
}
}
+ ///
+ /// The _media tools path
+ ///
+ private string _mediaToolsPath;
+ ///
+ /// Gets the folder path to tools
+ ///
+ /// The media tools path.
+ private string MediaToolsPath
+ {
+ get
+ {
+ if (_mediaToolsPath == null)
+ {
+ _mediaToolsPath = Path.Combine(_appPaths.ProgramDataPath, "ffmpeg");
+
+ if (!Directory.Exists(_mediaToolsPath))
+ {
+ Directory.CreateDirectory(_mediaToolsPath);
+ }
+ }
+
+ return _mediaToolsPath;
+ }
+ }
+
///
/// Gets the versioned directory path.
///
@@ -300,7 +327,7 @@ namespace MediaBrowser.Controller.MediaInfo
var filename = resource.Substring(resource.IndexOf(prefix, StringComparison.OrdinalIgnoreCase) + prefix.Length);
- var versionedDirectoryPath = Path.Combine(_appPaths.MediaToolsPath, Path.GetFileNameWithoutExtension(filename));
+ var versionedDirectoryPath = Path.Combine(MediaToolsPath, Path.GetFileNameWithoutExtension(filename));
if (!Directory.Exists(versionedDirectoryPath))
{
@@ -324,6 +351,71 @@ namespace MediaBrowser.Controller.MediaInfo
{
_zipClient.ExtractAll(resourceStream, targetPath, false);
}
+
+ ExtractFonts(assembly, targetPath);
+ }
+
+ ///
+ /// Extracts the fonts.
+ ///
+ /// The assembly.
+ /// The target path.
+ private async void ExtractFonts(Assembly assembly, string targetPath)
+ {
+ var fontsDirectory = Path.Combine(targetPath, "fonts");
+
+ if (!Directory.Exists(fontsDirectory))
+ {
+ Directory.CreateDirectory(fontsDirectory);
+ }
+
+ const string fontFilename = "ARIALUNI.TTF";
+
+ var fontFile = Path.Combine(fontsDirectory, fontFilename);
+
+ if (!File.Exists(fontFile))
+ {
+ using (var stream = assembly.GetManifestResourceStream("MediaBrowser.Controller.MediaInfo.fonts." + fontFilename))
+ {
+ using (var fileStream = new FileStream(fontFile, FileMode.Create, FileAccess.Write, FileShare.Read, StreamDefaults.DefaultFileStreamBufferSize, FileOptions.Asynchronous))
+ {
+ await stream.CopyToAsync(fileStream).ConfigureAwait(false);
+ }
+ }
+ }
+
+ await ExtractFontConfigFile(assembly, fontsDirectory).ConfigureAwait(false);
+ }
+
+ ///
+ /// Extracts the font config file.
+ ///
+ /// The assembly.
+ /// The fonts directory.
+ private async Task ExtractFontConfigFile(Assembly assembly, string fontsDirectory)
+ {
+ const string fontConfigFilename = "fonts.conf";
+ var fontConfigFile = Path.Combine(fontsDirectory, fontConfigFilename);
+
+ if (!File.Exists(fontConfigFile))
+ {
+ using (var stream = assembly.GetManifestResourceStream("MediaBrowser.Controller.MediaInfo.fonts." + fontConfigFilename))
+ {
+ using (var streamReader = new StreamReader(stream))
+ {
+ var contents = await streamReader.ReadToEndAsync().ConfigureAwait(false);
+
+ contents = contents.Replace("", "" + fontsDirectory + "");
+
+ var bytes = Encoding.UTF8.GetBytes(contents);
+
+ using (var fileStream = new FileStream(fontConfigFile, FileMode.Create, FileAccess.Write, FileShare.Read, StreamDefaults.DefaultFileStreamBufferSize, FileOptions.Asynchronous))
+ {
+ await fileStream.WriteAsync(bytes, 0, bytes.Length);
+ }
+ }
+ }
+ }
}
///
diff --git a/MediaBrowser.Controller/MediaInfo/fonts/fonts.conf b/MediaBrowser.Controller/MediaInfo/fonts/fonts.conf
new file mode 100644
index 0000000000..648bdb7b28
--- /dev/null
+++ b/MediaBrowser.Controller/MediaInfo/fonts/fonts.conf
@@ -0,0 +1,9 @@
+
+
+
+
+
+ Arial
+ Arial Unicode MS
+
+
\ No newline at end of file
diff --git a/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs b/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs
index 429c893cab..0863e592ba 100644
--- a/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs
+++ b/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs
@@ -320,32 +320,6 @@ namespace MediaBrowser.Server.Implementations
}
}
- ///
- /// The _media tools path
- ///
- private string _mediaToolsPath;
- ///
- /// Gets the folder path to tools
- ///
- /// The media tools path.
- public string MediaToolsPath
- {
- get
- {
- if (_mediaToolsPath == null)
- {
- _mediaToolsPath = Path.Combine(ProgramDataPath, "MediaTools");
-
- if (!Directory.Exists(_mediaToolsPath))
- {
- Directory.CreateDirectory(_mediaToolsPath);
- }
- }
-
- return _mediaToolsPath;
- }
- }
-
///
/// The _images data path
///