window title fix

This commit is contained in:
stax76
2022-07-02 09:35:15 +02:00
parent 1015f87533
commit 03b775370b
2 changed files with 27 additions and 3 deletions

View File

@@ -1194,6 +1194,9 @@ namespace mpvnet
{
string file = files[i];
if (file.Contains("|"))
file = file.Substring(0, file.IndexOf("|"));
if (file.Ext() == "avs")
LoadAviSynth();

View File

@@ -48,7 +48,7 @@ namespace mpvnet
Core.FileLoaded += Core_FileLoaded;
Core.Pause += Core_Pause;
Core.PlaylistPosChanged += (value) => SetTitle();
Core.PlaylistPosChanged += Core_PlaylistPosChanged;
Core.ScaleWindow += Core_ScaleWindow;
Core.Seek += () => UpdateProgressBar();
Core.ShowMenu += Core_ShowMenu;
@@ -118,6 +118,12 @@ namespace mpvnet
}
}
private void Core_PlaylistPosChanged(int pos)
{
if (pos == -1)
SetTitle();
}
void Init()
{
Core.Init(Handle);
@@ -720,7 +726,7 @@ namespace mpvnet
void Core_FileLoaded()
{
BeginInvoke(new Action(() => {
Text = Core.Expand(Title);
SetTitleInternal();
int interval = (int)(Core.Duration.TotalMilliseconds / 100);
@@ -759,7 +765,22 @@ namespace mpvnet
}
}
void SetTitle() => BeginInvoke(new Action(() => Text = Core.Expand(Title)));
void SetTitle() => BeginInvoke(new Action(() => SetTitleInternal()));
void SetTitleInternal()
{
string title = Title;
if (title == "${filename}" && Core.Path.ContainsEx("://"))
title = "${media-title}";
string text = Core.Expand(title);
if (text == "(unavailable)")
text = "mpv.net";
Text = text;
}
public void Voodoo()
{