#442 show chapters in the command palette

This commit is contained in:
stax76
2022-06-19 05:23:10 +02:00
parent 55f4a340af
commit 500fe9abc4
7 changed files with 63 additions and 14 deletions

View File

@@ -74,7 +74,7 @@ namespace mpvnet
public AutoResetEvent VideoSizeAutoResetEvent { get; } = new AutoResetEvent(false);
public IntPtr Handle { get; set; }
public IntPtr NamedHandle { get; set; }
public List<KeyValuePair<string, double>> Chapters { get; set; } = new List<KeyValuePair<string, double>>();
public List<Chapter> Chapters { get; set; } = new List<Chapter>();
public List<MediaTrack> MediaTracks { get; set; } = new List<MediaTrack>();
public List<TimeSpan> BluRayTitles { get; } = new List<TimeSpan>();
public object MediaTracksLock { get; } = new object();
@@ -1458,13 +1458,15 @@ namespace mpvnet
for (int x = 0; x < count; x++)
{
string text = GetPropertyString($"chapter-list/{x}/title");
string title = GetPropertyString($"chapter-list/{x}/title");
double time = GetPropertyDouble($"chapter-list/{x}/time");
if (string.IsNullOrEmpty(text))
text = "Chapter " + (x + 1);
if (string.IsNullOrEmpty(title) ||
(title.Length == 12 && title.Contains(":") && title.Contains(".")))
Chapters.Add(new KeyValuePair<string, double>(text, time));
title = "Chapter " + (x + 1);
Chapters.Add(new Chapter() { Title = title, Time = time });
}
}
}