diff --git a/mpv.net/Misc/Command.cs b/mpv.net/Misc/Command.cs index 2908958..93d980a 100644 --- a/mpv.net/Misc/Command.cs +++ b/mpv.net/Misc/Command.cs @@ -203,7 +203,6 @@ namespace mpvnet { d.InitialDirectory = Path.GetDirectoryName(mp.get_property_string("path", false)); d.Multiselect = true; - if (d.ShowDialog() == DialogResult.OK) foreach (string i in d.FileNames) mp.commandv("sub-add", i); diff --git a/mpv.net/Misc/Misc.cs b/mpv.net/Misc/Misc.cs index dfd920d..10c701b 100644 --- a/mpv.net/Misc/Misc.cs +++ b/mpv.net/Misc/Misc.cs @@ -17,8 +17,9 @@ namespace mpvnet { public class App { - public static string[] VideoTypes { get; } = "mkv mp4 mpg avi mov webm vob wmv flv avs 264 h264 asf webm mpeg mpv y4m avc hevc 265 h265 m2v m2ts vpy mts m4v".Split(" ".ToCharArray()); - public static string[] AudioTypes { get; } = "mp3 mp2 ac3 ogg opus flac wav w64 m4a dts dtsma dtshr dtshd eac3 thd thd+ac3 mka aac mpa".Split(" ".ToCharArray()); + public static string[] VideoTypes { get; } = "mkv mp4 mpg avi mov webm vob wmv flv avs 264 h264 asf webm mpeg mpv y4m avc hevc 265 h265 m2v m2ts vpy mts m4v".Split(' '); + public static string[] AudioTypes { get; } = "mp3 mp2 ac3 ogg opus flac wav w64 m4a dts dtsma dtshr dtshd eac3 thd thd+ac3 mka aac mpa".Split(' '); + public static string[] SubtitleTypes { get; } = "srt ass idx sup ttxt ssa smi".Split(' '); public static bool IsDarkMode { get { diff --git a/mpv.net/Resources/mpvConfToml.txt b/mpv.net/Resources/mpvConfToml.txt index 2671cc3..92d6c3a 100644 --- a/mpv.net/Resources/mpvConfToml.txt +++ b/mpv.net/Resources/mpvConfToml.txt @@ -202,7 +202,7 @@ name = "sub-border-color" default = "" type = "color" filter = "Subtitle" -help = "See --sub-color. Color used for the sub font border. Ignored when sub-back-color is specified (or more exactly: when that option is not set to completely transparent)." +help = "See sub-color. Color used for the sub font border. Ignored when sub-back-color is specified (or more exactly: when that option is not set to completely transparent)." [[settings]] name = "sub-back-color" diff --git a/mpv.net/mpv/mp.cs b/mpv.net/mpv/mp.cs index d6c60a2..b3c0b21 100644 --- a/mpv.net/mpv/mp.cs +++ b/mpv.net/mpv/mp.cs @@ -562,6 +562,18 @@ namespace mpvnet { if (files is null || files.Length == 0) return; HideLogo(); + List fileList = files.ToList(); + + foreach (string file in files) { + string ext = Path.GetExtension(file).TrimStart('.').ToLower(); + if (App.SubtitleTypes.Contains(ext)) { + mp.commandv("sub-add", file); + fileList.Remove(file); + } + } + + if (fileList.Count == 0) return; + files = fileList.ToArray(); int count = mp.get_property_int("playlist-count"); foreach (string file in files)