Explorar el Código

fixes #110 - Edit .ass file style

Luke Pulverenti hace 12 años
padre
commit
8295f15ab8
Se han modificado 1 ficheros con 28 adiciones y 0 borrados
  1. 28 0
      MediaBrowser.Server.Implementations/MediaEncoder/MediaEncoder.cs

+ 28 - 0
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>