history feature can be configured

This commit is contained in:
Frank Skare
2020-12-28 02:30:45 +01:00
parent 6e54286a60
commit 636d28ac54
8 changed files with 45 additions and 39 deletions

View File

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

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

View File

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

View File

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

View File

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

View File

@@ -141,8 +141,9 @@ namespace mpvnet
protected override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);
if (e.Key == Key.Escape)
Close();
}
}
}
}

View File

@@ -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<T> 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<T1, T2> 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)