#423 Fix chapter time display in menu

This commit is contained in:
stax76
2022-05-22 11:48:35 +02:00
parent 843f7d1a41
commit 4c3c65dded
2 changed files with 7 additions and 1 deletions

View File

@@ -10,6 +10,7 @@
- Fix crash choosing Matroska edition in the menu.
- Fix auto-play not working with user scripts.
- Fix slow startup using osd-scale-by-window=no.
- Fix chapter time display in menu.
- libmpv shinchiro 2022-05-17 with idle fix

View File

@@ -301,8 +301,13 @@ namespace mpvnet
foreach (var pair in Core.Chapters)
{
string caption = TimeSpan.FromSeconds(pair.Value).ToString();
if (caption.ContainsEx("."))
caption = caption.Substring(0, caption.LastIndexOf("."));
var chapterMenuItem = new WpfControls.MenuItem() { Header = pair.Key };
chapterMenuItem.InputGestureText = TimeSpan.FromSeconds(pair.Value).ToString().Substring(0, 8);
chapterMenuItem.InputGestureText = caption;
chapterMenuItem.Click += (sender, args) => Core.CommandV("seek", pair.Value.ToString(CultureInfo.InvariantCulture), "absolute");
chaptersMenuItem.Items.Add(chapterMenuItem);
}