diff --git a/Changelog.md b/Changelog.md index f9a3cc9..a2ec649 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,10 @@ 5.4.8.7 Beta (202?-??-??) ========================= +- history feature can be configured to ingore defined paths/keywords: + script-opt = history-discard=path1;path2 + + 5.4.8.6 Beta (2020-12-24) ========================= diff --git a/Manual.md b/Manual.md index 3bb528a..9709b8f 100644 --- a/Manual.md +++ b/Manual.md @@ -1090,8 +1090,14 @@ Shows the command palette window which allows to quickly find and execute comman ### Tools > Show History -Shows a text file that contains the file history. If the file don't exist it asks if the file should be created in the settings folder. Once the file exist then the history is logged. It logges the playback history containing the time and filename. +Shows a text file that contains the file history. If the file don't exist +it asks if the file should be created in the settings folder. Once the file +exist then the history is logged. It logges the playback history containing +the time and filename. +To ignore certain paths: + +script-opt = history-discard=path1;path2 ### Tools > Set/clear A-B loop points diff --git a/img/Avatar.png b/img/Avatar.png deleted file mode 100644 index 98ad90c..0000000 Binary files a/img/Avatar.png and /dev/null differ diff --git a/mpv.net/Misc/App.cs b/mpv.net/Misc/App.cs index cf19162..2448c90 100644 --- a/mpv.net/Misc/App.cs +++ b/mpv.net/Misc/App.cs @@ -91,13 +91,9 @@ namespace mpvnet public static void RunAction(Action action) { Task.Run(() => { - try - { + try { action.Invoke(); - Debug.WriteLine(Environment.TickCount); - } - catch (Exception e) - { + } catch (Exception e) { ShowException(e); } }); diff --git a/mpv.net/Misc/PowerShell.cs b/mpv.net/Misc/PowerShell.cs index b693a68..d88124d 100644 --- a/mpv.net/Misc/PowerShell.cs +++ b/mpv.net/Misc/PowerShell.cs @@ -138,19 +138,19 @@ namespace mpvnet switch (type) { case "bool": case "boolean": - core.observe_property_bool(name, (value) => Task.Run(() => PropertyChanged.Invoke(name, value))); + core.observe_property_bool(name, (value) => App.RunAction(() => PropertyChanged.Invoke(name, value))); break; case "string": - core.observe_property_string(name, (value) => Task.Run(() => PropertyChanged.Invoke(name, value))); + core.observe_property_string(name, (value) => App.RunAction(() => PropertyChanged.Invoke(name, value))); break; case "int": case "integer": - core.observe_property_int(name, (value) => Task.Run(() => PropertyChanged.Invoke(name, value))); + core.observe_property_int(name, (value) => App.RunAction(() => PropertyChanged.Invoke(name, value))); break; case "float": case "double": - core.observe_property_double(name, (value) => Task.Run(() => PropertyChanged.Invoke(name, value))); + core.observe_property_double(name, (value) => App.RunAction(() => PropertyChanged.Invoke(name, value))); break; case "nil": case "none": case "native": - core.observe_property(name, () => Task.Run(() => PropertyChanged.Invoke(name, null))); + core.observe_property(name, () => App.RunAction(() => PropertyChanged.Invoke(name, null))); break; default: App.ShowError("Invalid Type", "Valid types are: bool or boolean, string, int or integer, float or double, nil or none or native"); diff --git a/mpv.net/WPF/EverythingWindow.xaml.cs b/mpv.net/WPF/EverythingWindow.xaml.cs index 20b2761..20dc175 100644 --- a/mpv.net/WPF/EverythingWindow.xaml.cs +++ b/mpv.net/WPF/EverythingWindow.xaml.cs @@ -119,7 +119,7 @@ namespace mpvnet void FilterTextBox_TextChanged(object sender, TextChangedEventArgs e) { string searchtext = FilterTextBox.Text; - Task.Run(() => Search(searchtext)); + App.RunAction(() => Search(searchtext)); } object LockObject = new object(); diff --git a/mpv.net/WPF/InputWindow.xaml.cs b/mpv.net/WPF/InputWindow.xaml.cs index 2406459..c1ecf8d 100644 --- a/mpv.net/WPF/InputWindow.xaml.cs +++ b/mpv.net/WPF/InputWindow.xaml.cs @@ -141,8 +141,9 @@ namespace mpvnet protected override void OnKeyDown(KeyEventArgs e) { base.OnKeyDown(e); + if (e.Key == Key.Escape) Close(); } } -} \ No newline at end of file +} diff --git a/mpv.net/mpv/Core.cs b/mpv.net/mpv/Core.cs index e526e7e..eed6747 100644 --- a/mpv.net/mpv/Core.cs +++ b/mpv.net/mpv/Core.cs @@ -123,7 +123,7 @@ namespace mpvnet mpv_request_log_messages(Handle, "terminal-default"); - Task.Run(() => EventLoop()); + App.RunAction(() => EventLoop()); if (App.IsStartedFromTerminal) { @@ -472,9 +472,9 @@ namespace mpvnet VideoSizeAutoResetEvent.Set(); - Task.Run(new Action(() => ReadMetaData())); + App.RunAction(new Action(() => ReadMetaData())); - Task.Run(new Action(() => { + App.RunAction(new Action(() => { string path = core.get_property_string("path"); if (path.Contains("://")) @@ -652,16 +652,7 @@ namespace mpvnet foreach (Action a in action.GetInvocationList()) { var a2 = a; - Task.Run(() => { - try - { - a2.Invoke(t); - } - catch (Exception e) - { - App.ShowException(e); - } - }); + App.RunAction(() => a2.Invoke(t)); } } } @@ -673,16 +664,7 @@ namespace mpvnet foreach (Action a in action.GetInvocationList()) { var a2 = a; - Task.Run(() => { - try - { - a2.Invoke(t1, t2); - } - catch (Exception e) - { - App.ShowException(e); - } - }); + App.RunAction(() => a2.Invoke(t1, t2)); } } } @@ -1112,7 +1094,7 @@ namespace mpvnet set_property_int("playlist-pos", 0); if (loadFolder && !append) - Task.Run(() => LoadFolder()); + App.RunAction(() => LoadFolder()); } public void LoadISO(string path) @@ -1214,7 +1196,7 @@ namespace mpvnet int totalMinutes = Convert.ToInt32((DateTime.Now - LastHistoryStartDateTime).TotalMinutes); - if (LastHistoryPath != null && totalMinutes > 1) + if (LastHistoryPath != null && totalMinutes > 1 && !HistoryDiscard()) File.AppendAllText(ConfigFolder + "history.txt", DateTime.Now.ToString().Substring(0, 16) + " " + totalMinutes.ToString().PadLeft(3) + " " + LastHistoryPath + "\r\n"); @@ -1222,6 +1204,23 @@ namespace mpvnet LastHistoryStartDateTime = DateTime.Now; } + string HistoryDiscardOption; + + bool HistoryDiscard() + { + if (HistoryDiscardOption == null) + HistoryDiscardOption = core.get_opt("history-discard"); + + if (string.IsNullOrEmpty(HistoryDiscardOption)) + return false; + + foreach (string i in HistoryDiscardOption.Split(';')) + if (LastHistoryPath.Contains(i)) + return true; + + return false; + } + public void ShowLogo() { if (MainForm.Instance is null)