diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-05-07 13:07:57 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-05-07 13:07:57 -0400 |
| commit | 8295f15ab83709e73da5507d74a4fd8d819b9de9 (patch) | |
| tree | 14b103a18c24e16ca4504e38ff1e7fca0743a8cc | |
| parent | 9024add3999e5045cf0b8b4fb3d9a924954420c5 (diff) | |
fixes #110 - Edit .ass file style
| -rw-r--r-- | MediaBrowser.Server.Implementations/MediaEncoder/MediaEncoder.cs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/MediaEncoder/MediaEncoder.cs b/MediaBrowser.Server.Implementations/MediaEncoder/MediaEncoder.cs index d02031fe6..f42e9c6ae 100644 --- a/MediaBrowser.Server.Implementations/MediaEncoder/MediaEncoder.cs +++ b/MediaBrowser.Server.Implementations/MediaEncoder/MediaEncoder.cs @@ -682,6 +682,7 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder throw new ApplicationException(msg); } + await SetAssFont(outputPath).ConfigureAwait(false); } /// <summary> @@ -843,6 +844,33 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder throw new ApplicationException(msg); } + + await SetAssFont(outputPath).ConfigureAwait(false); + } + + /// <summary> + /// Sets the ass font. + /// </summary> + /// <param name="file">The file.</param> + /// <returns>Task.</returns> + private async Task SetAssFont(string file) + { + string text; + Encoding encoding; + + using (var reader = new StreamReader(file, detectEncodingFromByteOrderMarks: true)) + { + encoding = reader.CurrentEncoding; + + text = await reader.ReadToEndAsync().ConfigureAwait(false); + } + + text = text.Replace(",Arial,", ",Arial Unicode MS,"); + + using (var writer = new StreamWriter(file, false, encoding)) + { + writer.Write(text); + } } /// <summary> |
