drag & drop support for subtitles added

This commit is contained in:
Frank Skare
2019-05-31 04:18:05 +02:00
parent 270559c3f7
commit e041908f04
4 changed files with 16 additions and 4 deletions

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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"

View File

@@ -562,6 +562,18 @@ namespace mpvnet
{
if (files is null || files.Length == 0) return;
HideLogo();
List<string> 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)