new config setting recent-count added

This commit is contained in:
Frank Skare
2019-08-11 04:58:42 +02:00
parent a8c2409ed1
commit 2177308b02
7 changed files with 24 additions and 15 deletions

View File

@@ -6,6 +6,8 @@
profile=gpu-hq is not used in the defaults because it starts very slow profile=gpu-hq is not used in the defaults because it starts very slow
- new menu items have been added to navigate to the first and - new menu items have been added to navigate to the first and
last playlist position, key bindings: Home, End last playlist position, key bindings: Home, End
- new config setting recent-count added, amount of menu items
shown under 'Open > Recent'
### 5.2.1.3 ### 5.2.1.3

View File

@@ -30,6 +30,7 @@ namespace mpvnet
public static bool ThemedMenu { get; set; } public static bool ThemedMenu { get; set; }
public static int StartThreshold { get; set; } = 1500; public static int StartThreshold { get; set; } = 1500;
public static int RecentCount { get; set; } = 15;
public static float MinimumAspectRatio { get; set; } = 1.3f; public static float MinimumAspectRatio { get; set; } = 1.3f;
@@ -117,6 +118,7 @@ namespace mpvnet
case "minimum-aspect-ratio": MinimumAspectRatio = value.Float(); return true; case "minimum-aspect-ratio": MinimumAspectRatio = value.Float(); return true;
case "auto-load-folder": AutoLoadFolder = value == "yes"; return true; case "auto-load-folder": AutoLoadFolder = value == "yes"; return true;
case "themed-menu": ThemedMenu = value == "yes"; return true; case "themed-menu": ThemedMenu = value == "yes"; return true;
case "recent-count": RecentCount = value.Int(); return true;
} }
return false; return false;
} }

View File

@@ -1,12 +1,12 @@
input-default-bindings = no input-default-bindings = no
input-ar-delay = 500 input-ar-delay = 500
input-ar-rate = 20 input-ar-rate = 20
hwdec = yes
keep-open = yes keep-open = yes
keep-open-pause = no keep-open-pause = no
osd-playing-msg = '${filename}' osd-playing-msg = '${filename}'
screenshot-directory = '~~desktop/'
script-opts=osc-scalewindowed=1.5 script-opts=osc-scalewindowed=1.5
screenshot-directory = '~~desktop/'
cscale = spline36 cscale = spline36
dscale = spline36 dscale = spline36
scale = spline36 scale = spline36
hwdec = yes

View File

@@ -22,6 +22,11 @@ help = "Enable this only when a developer asks for it. (mpv.net specific setting
options = [{ name = "yes" }, options = [{ name = "yes" },
{ name = "no" }] { name = "no" }]
[[settings]]
name = "recent-count"
filter = "General"
help = "<int> Amount of recent files to be remembered. Default: 15"
[[settings]] [[settings]]
name = "start-size" name = "start-size"
default = "previous" default = "previous"

View File

@@ -96,7 +96,7 @@ namespace mpvnet
public Delegate Delegate { get; set; } public Delegate Delegate { get; set; }
public string FilePath { get; set; } public string FilePath { get; set; }
public void Invoke() => Task.Run(() => { PowerShellScript.Execute(File.ReadAllText(FilePath), null); }); public void Invoke() => Task.Run(() => PowerShellScript.Execute(File.ReadAllText(FilePath), null));
public void InvokeEndFileEventMode(EndFileEventMode arg) public void InvokeEndFileEventMode(EndFileEventMode arg)
{ {

View File

@@ -126,7 +126,7 @@ namespace mpvnet
foreach (MediaTrack track in vidTracks) foreach (MediaTrack track in vidTracks)
{ {
MenuItem mi = new MenuItem(track.Text); MenuItem mi = new MenuItem(track.Text);
mi.Action = () => { mp.commandv("set", "vid", track.ID.ToString()); }; mi.Action = () => mp.commandv("set", "vid", track.ID.ToString());
mi.Checked = mp.Vid == track.ID.ToString(); mi.Checked = mp.Vid == track.ID.ToString();
trackMenuItem.DropDownItems.Add(mi); trackMenuItem.DropDownItems.Add(mi);
} }
@@ -137,7 +137,7 @@ namespace mpvnet
foreach (MediaTrack track in audTracks) foreach (MediaTrack track in audTracks)
{ {
MenuItem mi = new MenuItem(track.Text); MenuItem mi = new MenuItem(track.Text);
mi.Action = () => { mp.commandv("set", "aid", track.ID.ToString()); }; mi.Action = () => mp.commandv("set", "aid", track.ID.ToString());
mi.Checked = mp.Aid == track.ID.ToString(); mi.Checked = mp.Aid == track.ID.ToString();
trackMenuItem.DropDownItems.Add(mi); trackMenuItem.DropDownItems.Add(mi);
} }
@@ -148,7 +148,7 @@ namespace mpvnet
foreach (MediaTrack track in subTracks) foreach (MediaTrack track in subTracks)
{ {
MenuItem mi = new MenuItem(track.Text); MenuItem mi = new MenuItem(track.Text);
mi.Action = () => { mp.commandv("set", "sid", track.ID.ToString()); }; mi.Action = () => mp.commandv("set", "sid", track.ID.ToString());
mi.Checked = mp.Sid == track.ID.ToString(); mi.Checked = mp.Sid == track.ID.ToString();
trackMenuItem.DropDownItems.Add(mi); trackMenuItem.DropDownItems.Add(mi);
} }
@@ -156,7 +156,7 @@ namespace mpvnet
if (subTracks.Length > 0) if (subTracks.Length > 0)
{ {
MenuItem mi = new MenuItem("S: No subtitles"); MenuItem mi = new MenuItem("S: No subtitles");
mi.Action = () => { mp.commandv("set", "sid", "no"); }; mi.Action = () => mp.commandv("set", "sid", "no");
mi.Checked = mp.Sid == "no"; mi.Checked = mp.Sid == "no";
trackMenuItem.DropDownItems.Add(mi); trackMenuItem.DropDownItems.Add(mi);
} }
@@ -167,7 +167,7 @@ namespace mpvnet
foreach (MediaTrack track in ediTracks) foreach (MediaTrack track in ediTracks)
{ {
MenuItem mi = new MenuItem(track.Text); MenuItem mi = new MenuItem(track.Text);
mi.Action = () => { mp.commandv("set", "edition", track.ID.ToString()); }; mi.Action = () => mp.commandv("set", "edition", track.ID.ToString());
mi.Checked = mp.Edition == track.ID; mi.Checked = mp.Edition == track.ID;
trackMenuItem.DropDownItems.Add(mi); trackMenuItem.DropDownItems.Add(mi);
} }
@@ -186,7 +186,7 @@ namespace mpvnet
{ {
MenuItem mi = new MenuItem(i.Key); MenuItem mi = new MenuItem(i.Key);
mi.ShortcutKeyDisplayString = TimeSpan.FromSeconds(i.Value).ToString().Substring(0, 8) + " "; mi.ShortcutKeyDisplayString = TimeSpan.FromSeconds(i.Value).ToString().Substring(0, 8) + " ";
mi.Action = () => { mp.commandv("seek", i.Value.ToString(CultureInfo.InvariantCulture), "absolute"); }; mi.Action = () => mp.commandv("seek", i.Value.ToString(CultureInfo.InvariantCulture), "absolute");
chaptersMenuItem.DropDownItems.Add(mi); chaptersMenuItem.DropDownItems.Add(mi);
} }
} }
@@ -377,7 +377,7 @@ namespace mpvnet
})); }));
if (RecentFiles.Contains(path)) RecentFiles.Remove(path); if (RecentFiles.Contains(path)) RecentFiles.Remove(path);
RecentFiles.Insert(0, path); RecentFiles.Insert(0, path);
if (RecentFiles.Count > 15) RecentFiles.RemoveAt(15); while (RecentFiles.Count > App.RecentCount) RecentFiles.RemoveAt(App.RecentCount);
} }
protected override CreateParams CreateParams { protected override CreateParams CreateParams {
@@ -530,8 +530,8 @@ namespace mpvnet
CheckClipboardForURL(); CheckClipboardForURL();
Cursor.Position = new Point(Cursor.Position.X + 1, Cursor.Position.Y); Cursor.Position = new Point(Cursor.Position.X + 1, Cursor.Position.Y);
WasShown = true; WasShown = true;
Task.Run(() => { mp.LoadScripts(); }); Task.Run(() => mp.LoadScripts());
Task.Run(() => { mp.Extension = new Extension(); }); Task.Run(() => mp.Extension = new Extension());
} }
protected override void OnActivated(EventArgs e) protected override void OnActivated(EventArgs e)

View File

@@ -93,7 +93,7 @@ namespace mpvnet
{ {
LoadLibrary("mpv-1.dll"); LoadLibrary("mpv-1.dll");
Handle = mpv_create(); Handle = mpv_create();
Task.Run(() => { EventLoop(); }); Task.Run(() => EventLoop());
if (App.IsStartedFromTerminal) if (App.IsStartedFromTerminal)
{ {
@@ -676,7 +676,7 @@ namespace mpvnet
string path = get_property_string("path"); string path = get_property_string("path");
if (!File.Exists(path) || get_property_int("playlist-count") != 1) return; if (!File.Exists(path) || get_property_int("playlist-count") != 1) return;
List<string> files = Directory.GetFiles(Path.GetDirectoryName(path)).ToList(); List<string> files = Directory.GetFiles(Path.GetDirectoryName(path)).ToList();
files = files.Where((file) => files = files.Where(file =>
App.VideoTypes.Contains(file.ShortExt()) || App.VideoTypes.Contains(file.ShortExt()) ||
App.AudioTypes.Contains(file.ShortExt()) || App.AudioTypes.Contains(file.ShortExt()) ||
App.ImageTypes.Contains(file.ShortExt())).ToList(); App.ImageTypes.Contains(file.ShortExt())).ToList();