diff --git a/docs/Changelog.md b/docs/Changelog.md index 113d749..77c9c63 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -8,9 +8,10 @@ is created with defaults for osc and console. - Support mpv idle property, see manual for remarks. - Fix crash choosing Matroska edition in the menu. -- Fix auto-play and auto-load-folder not working - with user scripts. +- Fix auto-play and auto-load-folder not working with user scripts. - 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. - libmpv shinchiro 2022-05-17 with idle fix diff --git a/src/Misc/Commands.cs b/src/Misc/Commands.cs index 3ac5ac4..11155ff 100644 --- a/src/Misc/Commands.cs +++ b/src/Misc/Commands.cs @@ -564,13 +564,20 @@ namespace mpvnet { List items = new List(); - 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() { - Text = file.ShortPath(60), + Text = title.ShortPath(60), Action = () => Core.LoadFiles(new[] { file }, true, Control.ModifierKeys.HasFlag(Keys.Control)) }; diff --git a/src/Misc/MainForm.cs b/src/Misc/MainForm.cs index fefbb41..dcc5eaf 100644 --- a/src/Misc/MainForm.cs +++ b/src/Misc/MainForm.cs @@ -322,11 +322,20 @@ namespace mpvnet 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) 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()); @@ -703,8 +712,6 @@ namespace mpvnet void Core_FileLoaded() { - string path = Core.GetPropertyString("path"); - BeginInvoke(new Action(() => { Text = Core.Expand(Title); @@ -720,6 +727,16 @@ namespace mpvnet 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)) App.Settings.RecentFiles.Remove(path); diff --git a/src/Misc/Player.cs b/src/Misc/Player.cs index 6140f1e..9a78c8a 100644 --- a/src/Misc/Player.cs +++ b/src/Misc/Player.cs @@ -136,7 +136,7 @@ namespace mpvnet SetPropertyString("watch-later-options", "mute"); SetPropertyString("screenshot-directory", "~~desktop/"); - SetPropertyString("osd-playing-msg", "${filename}"); + SetPropertyString("osd-playing-msg", "${media-title}"); SetPropertyString("osc", "yes"); SetPropertyString("force-window", "yes"); SetPropertyString("config-dir", ConfigFolder);