drag & drop support for subtitles added
This commit is contained in:
@@ -203,7 +203,6 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
d.InitialDirectory = Path.GetDirectoryName(mp.get_property_string("path", false));
|
d.InitialDirectory = Path.GetDirectoryName(mp.get_property_string("path", false));
|
||||||
d.Multiselect = true;
|
d.Multiselect = true;
|
||||||
|
|
||||||
if (d.ShowDialog() == DialogResult.OK)
|
if (d.ShowDialog() == DialogResult.OK)
|
||||||
foreach (string i in d.FileNames)
|
foreach (string i in d.FileNames)
|
||||||
mp.commandv("sub-add", i);
|
mp.commandv("sub-add", i);
|
||||||
|
|||||||
@@ -17,8 +17,9 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
public class App
|
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[] 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(" ".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(' ');
|
||||||
|
public static string[] SubtitleTypes { get; } = "srt ass idx sup ttxt ssa smi".Split(' ');
|
||||||
|
|
||||||
public static bool IsDarkMode {
|
public static bool IsDarkMode {
|
||||||
get {
|
get {
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ name = "sub-border-color"
|
|||||||
default = ""
|
default = ""
|
||||||
type = "color"
|
type = "color"
|
||||||
filter = "Subtitle"
|
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]]
|
[[settings]]
|
||||||
name = "sub-back-color"
|
name = "sub-back-color"
|
||||||
|
|||||||
@@ -562,6 +562,18 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
if (files is null || files.Length == 0) return;
|
if (files is null || files.Length == 0) return;
|
||||||
HideLogo();
|
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");
|
int count = mp.get_property_int("playlist-count");
|
||||||
|
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
|
|||||||
Reference in New Issue
Block a user