diff --git a/README.md b/README.md index 1a1d915..11bf8ba 100644 --- a/README.md +++ b/README.md @@ -192,7 +192,7 @@ mpv.net bugs and requests: - when the main windows gets activated and the clipboard content starts with http mpv.net will ask to play the URL, previously this was restricted to YouTube URLs -- Python script errors didn't show line and column +- Python script errors show line and column whenever it is supported by IronPython ### 3.4 (2019-05-03) diff --git a/mpv.net/Command.cs b/mpv.net/Command.cs index ca34273..a1631d4 100644 --- a/mpv.net/Command.cs +++ b/mpv.net/Command.cs @@ -26,7 +26,7 @@ namespace mpvnet Type type = typeof(Command); MethodInfo[] methods = type.GetMethods(System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public); - foreach (var i in methods) + foreach (MethodInfo i in methods) { ParameterInfo[] parameters = i.GetParameters(); diff --git a/mpv.net/MainForm.cs b/mpv.net/MainForm.cs index 3916de3..75ee3eb 100644 --- a/mpv.net/MainForm.cs +++ b/mpv.net/MainForm.cs @@ -311,12 +311,12 @@ namespace mpvnet Dictionary commandInputDic = new Dictionary(); if (content.Contains("#menu:")) - lines = content.Split("\r\n".ToCharArray()).ToList(); + lines = content.Split('\r', '\n').ToList(); else { - lines = Properties.Resources.inputConf.Split("\r\n".ToCharArray()).ToList(); + lines = Properties.Resources.inputConf.Split('\r', '\n').ToList(); - foreach (string i in content.Split("\r\n".ToCharArray())) + foreach (string i in content.Split('\r', '\n')) { string line = i.Trim(); if (line.StartsWith("#") || !line.Contains(" ")) continue; diff --git a/mpv.net/Misc.cs b/mpv.net/Misc.cs index 821b346..5d11914 100644 --- a/mpv.net/Misc.cs +++ b/mpv.net/Misc.cs @@ -17,16 +17,13 @@ namespace mpvnet { public class App { - public static string[] VideoTypes { get; } = "mpg avi vob mp4 mkv avs 264 mov wmv flv h264 asf webm mpeg mpv y4m avc hevc 265 h265 m2v m2ts vpy mts webm m4v".Split(" ".ToCharArray()); - public static string[] AudioTypes { get; } = "mp2 mp3 ac3 wav w64 m4a dts dtsma dtshr dtshd eac3 thd thd+ac3 ogg mka aac opus flac 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(" ".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 bool IsDarkMode { get { string darkMode = MainForm.Instance.MpvNetDarkMode; - object value = Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", 1); - if (value is null) value = 1; - bool isDarkTheme = (int)value == 0; - return (darkMode == "system" && isDarkTheme) || darkMode == "always"; + return (darkMode == "system" && Sys.IsDarkTheme) || darkMode == "always"; } } } @@ -175,7 +172,6 @@ namespace mpvnet public int ID { get; set; } } - [Serializable] public class CommandItem : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; diff --git a/mpv.net/Resources/inputConf.txt b/mpv.net/Resources/inputConf.txt index e8efb2e..166f59d 100644 --- a/mpv.net/Resources/inputConf.txt +++ b/mpv.net/Resources/inputConf.txt @@ -90,8 +90,8 @@ KP7 script-message mpv.net cycle-audio #menu: Audio > Cycle/Next _ ignore #menu: Audio > - - KP6 add audio-delay 0.100 #menu: Audio > Delay +0.1 - KP9 add audio-delay -0.100 #menu: Audio > Delay -0.1 + KP6 add audio-delay 0.1 #menu: Audio > Delay +0.1 + KP9 add audio-delay -0.1 #menu: Audio > Delay -0.1 KP8 cycle sub #menu: Subtitle > Cycle/Next v cycle sub-visibility #menu: Subtitle > Toggle Visibility @@ -174,4 +174,6 @@ Wheel_Up add volume 10 Wheel_Down add volume -10 Prev playlist-prev - Next playlist-next \ No newline at end of file + Next playlist-next + + MBTN_LEFT_DBL cycle fullscreen \ No newline at end of file diff --git a/mpv.net/Windows/ConfWindow.xaml.cs b/mpv.net/Windows/ConfWindow.xaml.cs index ac00366..03ea5b2 100644 --- a/mpv.net/Windows/ConfWindow.xaml.cs +++ b/mpv.net/Windows/ConfWindow.xaml.cs @@ -114,7 +114,7 @@ namespace mpvnet if (left.StartsWith("#")) { - Comments[filePath][left.TrimStart("#".ToCharArray())] = right; + Comments[filePath][left.TrimStart('#')] = right; continue; } diff --git a/mpv.net/mp.cs b/mpv.net/mp.cs index 247ecad..4b5be15 100644 --- a/mpv.net/mp.cs +++ b/mpv.net/mp.cs @@ -21,7 +21,7 @@ namespace mpvnet public class mp { public static event Action VideoSizeChanged; - // Lua/JS evens libmpv events + // Lua/JS event libmpv event // MPV_EVENT_NONE public static event Action Shutdown; // shutdown MPV_EVENT_SHUTDOWN @@ -562,9 +562,9 @@ namespace mpvnet { string path = get_property_string("path"); if (!Directory.Exists(Path.GetDirectoryName(path))) return; - string[] types = "264 265 3gp aac ac3 avc avi avs bmp divx dts dtshd dtshr dtsma eac3 evo flac flv h264 h265 hevc hvc jpg jpeg m2t m2ts m2v m4a m4v mka mkv mlp mov mp2 mp3 mp4 mpa mpeg mpg mpv mts ogg ogm opus pcm png pva raw rmvb thd thd+ac3 true-hd truehd ts vdr vob vpy w64 wav webm wmv y4m".Split(' '); List files = Directory.GetFiles(Path.GetDirectoryName(path)).ToList(); - files = files.Where((file) => types.Contains(Path.GetExtension(file).TrimStart(".".ToCharArray()).ToLower())).ToList(); + files = files.Where((file) => App.VideoTypes.Contains(Path.GetExtension(file).TrimStart('.').ToLower()) || + App.AudioTypes.Contains(Path.GetExtension(file).TrimStart('.').ToLower())).ToList(); files.Sort(new StringLogicalComparer()); int index = files.IndexOf(path); files.Remove(path); @@ -661,7 +661,7 @@ namespace mpvnet Add(track, mi.GetVideo(i, "Forced") == "Yes" ? "Forced" : ""); Add(track, mi.GetVideo(i, "Default") == "Yes" ? "Default" : ""); Add(track, mi.GetVideo(i, "Title")); - track.Text = "V: " + track.Text.Trim(" ,".ToCharArray()); + track.Text = "V: " + track.Text.Trim(' ', ','); track.Type = "v"; track.ID = i + 1; MediaTracks.Add(track); @@ -681,7 +681,7 @@ namespace mpvnet Add(track, mi.GetAudio(i, "Forced") == "Yes" ? "Forced" : ""); Add(track, mi.GetAudio(i, "Default") == "Yes" ? "Default" : ""); Add(track, mi.GetAudio(i, "Title")); - track.Text = "A: " + track.Text.Trim(" ,".ToCharArray()); + track.Text = "A: " + track.Text.Trim(' ', ','); track.Type = "a"; track.ID = i + 1; MediaTracks.Add(track); @@ -698,7 +698,7 @@ namespace mpvnet Add(track, mi.GetText(i, "Forced") == "Yes" ? "Forced" : ""); Add(track, mi.GetText(i, "Default") == "Yes" ? "Default" : ""); Add(track, mi.GetText(i, "Title")); - track.Text = "S: " + track.Text.Trim(" ,".ToCharArray()); + track.Text = "S: " + track.Text.Trim(' ', ','); track.Type = "s"; track.ID = i + 1; MediaTracks.Add(track);