Fix #424 media title issues

This commit is contained in:
stax76
2022-05-26 11:36:24 +02:00
parent 6fc546c69c
commit 7e834cea6d
4 changed files with 35 additions and 10 deletions

View File

@@ -8,9 +8,10 @@
is created with defaults for osc and console. is created with defaults for osc and console.
- Support mpv idle property, see manual for remarks. - Support mpv idle property, see manual for remarks.
- Fix crash choosing Matroska edition in the menu. - Fix crash choosing Matroska edition in the menu.
- Fix auto-play and auto-load-folder not working - Fix auto-play and auto-load-folder not working with user scripts.
with user scripts.
- Fix slow startup using osd-scale-by-window=no. - Fix slow startup using osd-scale-by-window=no.
- Fix URL shown instead of media title on file change OSD,
in recent menu and in recent command palette.
- Fix chapter time display in menu. - Fix chapter time display in menu.
- libmpv shinchiro 2022-05-17 with idle fix - libmpv shinchiro 2022-05-17 with idle fix

View File

@@ -564,13 +564,20 @@ namespace mpvnet
{ {
List<CommandPaletteItem> items = new List<CommandPaletteItem>(); List<CommandPaletteItem> items = new List<CommandPaletteItem>();
foreach (string i in App.Settings.RecentFiles) foreach (string path in App.Settings.RecentFiles)
{ {
string file = i; string file = path;
string title = path;
if (title.Contains("|"))
{
title = title.Substring(title.IndexOf("|") + 1);
file = file.Substring(0, file.IndexOf("|"));
}
CommandPaletteItem item = new CommandPaletteItem() CommandPaletteItem item = new CommandPaletteItem()
{ {
Text = file.ShortPath(60), Text = title.ShortPath(60),
Action = () => Core.LoadFiles(new[] { file }, true, Control.ModifierKeys.HasFlag(Keys.Control)) Action = () => Core.LoadFiles(new[] { file }, true, Control.ModifierKeys.HasFlag(Keys.Control))
}; };

View File

@@ -322,11 +322,20 @@ namespace mpvnet
foreach (string path in App.Settings.RecentFiles) foreach (string path in App.Settings.RecentFiles)
{ {
var mi = MenuHelp.Add(recentMenuItem.Items, path.ShortPath(100)); string file = path;
string title = path;
if (title.Contains("|"))
{
title = title.Substring(title.IndexOf("|") + 1);
file = file.Substring(0, file.IndexOf("|"));
}
var mi = MenuHelp.Add(recentMenuItem.Items, title.ShortPath(100));
if (mi != null) if (mi != null)
mi.Click += (sender, args) => mi.Click += (sender, args) =>
Core.LoadFiles(new[] { path }, true, ModifierKeys.HasFlag(Keys.Control)); Core.LoadFiles(new[] { file }, true, ModifierKeys.HasFlag(Keys.Control));
} }
recentMenuItem.Items.Add(new WpfControls.Separator()); recentMenuItem.Items.Add(new WpfControls.Separator());
@@ -703,8 +712,6 @@ namespace mpvnet
void Core_FileLoaded() void Core_FileLoaded()
{ {
string path = Core.GetPropertyString("path");
BeginInvoke(new Action(() => { BeginInvoke(new Action(() => {
Text = Core.Expand(Title); Text = Core.Expand(Title);
@@ -720,6 +727,16 @@ namespace mpvnet
UpdateProgressBar(); UpdateProgressBar();
})); }));
string path = Core.GetPropertyString("path");
if (path.Contains("://"))
{
string title = Core.GetPropertyString("media-title");
if (!string.IsNullOrEmpty(title) && path != title)
path = path + "|" + title;
}
if (App.Settings.RecentFiles.Contains(path)) if (App.Settings.RecentFiles.Contains(path))
App.Settings.RecentFiles.Remove(path); App.Settings.RecentFiles.Remove(path);

View File

@@ -136,7 +136,7 @@ namespace mpvnet
SetPropertyString("watch-later-options", "mute"); SetPropertyString("watch-later-options", "mute");
SetPropertyString("screenshot-directory", "~~desktop/"); SetPropertyString("screenshot-directory", "~~desktop/");
SetPropertyString("osd-playing-msg", "${filename}"); SetPropertyString("osd-playing-msg", "${media-title}");
SetPropertyString("osc", "yes"); SetPropertyString("osc", "yes");
SetPropertyString("force-window", "yes"); SetPropertyString("force-window", "yes");
SetPropertyString("config-dir", ConfigFolder); SetPropertyString("config-dir", ConfigFolder);