fix slow BluRay menu
This commit is contained in:
@@ -2,6 +2,10 @@
|
|||||||
5.4.8.4 Beta (not yet released)
|
5.4.8.4 Beta (not yet released)
|
||||||
============
|
============
|
||||||
|
|
||||||
|
- BluRays with dozens of titles showed all titles in the menu
|
||||||
|
which was difficult to choose and also extremely slow.
|
||||||
|
|
||||||
|
|
||||||
5.4.8.3 Beta
|
5.4.8.3 Beta
|
||||||
============
|
============
|
||||||
|
|
||||||
|
|||||||
@@ -268,15 +268,18 @@ namespace mpvnet
|
|||||||
|
|
||||||
lock (core.BluRayTitles)
|
lock (core.BluRayTitles)
|
||||||
{
|
{
|
||||||
|
List<(int Index, TimeSpan Len)> items = new List<(int Index, TimeSpan Len)>();
|
||||||
|
|
||||||
for (int i = 0; i < core.BluRayTitles.Count; i++)
|
for (int i = 0; i < core.BluRayTitles.Count; i++)
|
||||||
{
|
items.Add((i, core.BluRayTitles[i]));
|
||||||
if (core.BluRayTitles[i] != "00:00:00")
|
|
||||||
{
|
var titleItems = items.OrderByDescending(item => item.Len)
|
||||||
int tmp = i;
|
.Take(20).OrderBy(item => item.Index);
|
||||||
MenuItem.Add(titles.DropDownItems, $"{core.BluRayTitles[i]} ({i})",
|
|
||||||
() => core.SetBluRayTitle(tmp));
|
foreach (var item in titleItems)
|
||||||
}
|
if (item.Len != TimeSpan.Zero)
|
||||||
}
|
MenuItem.Add(titles.DropDownItems, $"{item.Len} ({item.Index})",
|
||||||
|
() => core.SetBluRayTitle(item.Index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
public List<MediaTrack> MediaTracks { get; set; } = new List<MediaTrack>();
|
public List<MediaTrack> MediaTracks { get; set; } = new List<MediaTrack>();
|
||||||
public List<KeyValuePair<string, double>> Chapters { get; set; } = new List<KeyValuePair<string, double>>();
|
public List<KeyValuePair<string, double>> Chapters { get; set; } = new List<KeyValuePair<string, double>>();
|
||||||
public List<string> BluRayTitles { get; } = new List<string>();
|
public List<TimeSpan> BluRayTitles { get; } = new List<TimeSpan>();
|
||||||
public IntPtr Handle { get; set; }
|
public IntPtr Handle { get; set; }
|
||||||
public IntPtr WindowHandle { get; set; }
|
public IntPtr WindowHandle { get; set; }
|
||||||
|
|
||||||
@@ -614,7 +614,10 @@ namespace mpvnet
|
|||||||
if (msg.Contains(" duration: "))
|
if (msg.Contains(" duration: "))
|
||||||
{
|
{
|
||||||
int start = msg.IndexOf(" duration: ") + 11;
|
int start = msg.IndexOf(" duration: ") + 11;
|
||||||
BluRayTitles.Add(msg.Substring(start, 8));
|
BluRayTitles.Add(new TimeSpan(
|
||||||
|
msg.Substring(start, 2).ToInt(),
|
||||||
|
msg.Substring(start + 3, 2).ToInt(),
|
||||||
|
msg.Substring(start + 6, 2).ToInt()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user