-
This commit is contained in:
@@ -330,6 +330,9 @@ Shows media info in a messsge box.
|
|||||||
**editor**
|
**editor**
|
||||||
Shows media info in the text editor.
|
Shows media info in the text editor.
|
||||||
|
|
||||||
|
**osd**
|
||||||
|
Displays media info on screen.
|
||||||
|
|
||||||
**full**
|
**full**
|
||||||
Shows fully detailed media info.
|
Shows fully detailed media info.
|
||||||
|
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ using System.Globalization;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
using WinForms = System.Windows.Forms;
|
using WinForms = System.Windows.Forms;
|
||||||
|
|
||||||
using static mpvnet.Global;
|
using static mpvnet.Global;
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
namespace mpvnet
|
namespace mpvnet
|
||||||
{
|
{
|
||||||
@@ -172,42 +172,65 @@ namespace mpvnet
|
|||||||
|
|
||||||
if (CorePlayer.AudioTypes.Contains(path.Ext()))
|
if (CorePlayer.AudioTypes.Contains(path.Ext()))
|
||||||
{
|
{
|
||||||
using (MediaInfo mediaInfo = new MediaInfo(path))
|
if (App.MediaInfo)
|
||||||
{
|
{
|
||||||
performer = mediaInfo.GetInfo(MediaInfoStreamKind.General, "Performer");
|
using (MediaInfo mediaInfo = new MediaInfo(path))
|
||||||
title = mediaInfo.GetInfo(MediaInfoStreamKind.General, "Title");
|
{
|
||||||
album = mediaInfo.GetInfo(MediaInfoStreamKind.General, "Album");
|
performer = mediaInfo.GetInfo(MediaInfoStreamKind.General, "Performer");
|
||||||
genre = mediaInfo.GetInfo(MediaInfoStreamKind.General, "Genre");
|
title = mediaInfo.GetInfo(MediaInfoStreamKind.General, "Title");
|
||||||
date = mediaInfo.GetInfo(MediaInfoStreamKind.General, "Recorded_Date");
|
album = mediaInfo.GetInfo(MediaInfoStreamKind.General, "Album");
|
||||||
duration = mediaInfo.GetInfo(MediaInfoStreamKind.Audio, "Duration/String");
|
genre = mediaInfo.GetInfo(MediaInfoStreamKind.General, "Genre");
|
||||||
|
date = mediaInfo.GetInfo(MediaInfoStreamKind.General, "Recorded_Date");
|
||||||
|
duration = mediaInfo.GetInfo(MediaInfoStreamKind.Audio, "Duration/String");
|
||||||
|
|
||||||
if (performer != "") text += "Artist: " + performer + "\n";
|
if (performer != "") text += "Artist: " + performer + "\n";
|
||||||
if (title != "") text += "Title: " + title + "\n";
|
if (title != "") text += "Title: " + title + "\n";
|
||||||
if (album != "") text += "Album: " + album + "\n";
|
if (album != "") text += "Album: " + album + "\n";
|
||||||
if (genre != "") text += "Genre: " + genre + "\n";
|
if (genre != "") text += "Genre: " + genre + "\n";
|
||||||
if (date != "") text += "Year: " + date + "\n";
|
if (date != "") text += "Year: " + date + "\n";
|
||||||
if (duration != "") text += "Length: " + duration + "\n";
|
if (duration != "") text += "Length: " + duration + "\n";
|
||||||
|
|
||||||
text += "Size: " + mediaInfo.GetInfo(MediaInfoStreamKind.General, "FileSize/String") + "\n";
|
text += "Size: " + mediaInfo.GetInfo(MediaInfoStreamKind.General, "FileSize/String") + "\n";
|
||||||
text += "Type: " + path.Ext().ToUpper();
|
text += "Type: " + path.Ext().ToUpper();
|
||||||
|
}
|
||||||
Core.CommandV("show-text", text, "5000");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text = "File: " + path.FileName() + "\n";
|
||||||
|
duration = TimeSpan.FromSeconds((int)Core.GetPropertyDouble("duration")).ToString();
|
||||||
|
|
||||||
|
if (duration != "") text += "Length: " + duration + "\n";
|
||||||
|
if (fileSize > 0) text += "Size: " + Convert.ToInt32(fileSize / 1024.0 / 1024.0) + " MB\n";
|
||||||
|
|
||||||
|
text += "Type: " + path.Ext().ToUpper();
|
||||||
|
}
|
||||||
|
|
||||||
|
Core.CommandV("show-text", text, "5000");
|
||||||
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (CorePlayer.ImageTypes.Contains(path.Ext()))
|
else if (CorePlayer.ImageTypes.Contains(path.Ext()))
|
||||||
{
|
{
|
||||||
using (MediaInfo mediaInfo = new MediaInfo(path))
|
if (App.MediaInfo)
|
||||||
{
|
{
|
||||||
text =
|
using (MediaInfo mediaInfo = new MediaInfo(path))
|
||||||
"Width: " + mediaInfo.GetInfo(MediaInfoStreamKind.Image, "Width") + "\n" +
|
{
|
||||||
"Height: " + mediaInfo.GetInfo(MediaInfoStreamKind.Image, "Height") + "\n" +
|
text = "Width: " + mediaInfo.GetInfo(MediaInfoStreamKind.Image, "Width") + "\n" +
|
||||||
"Size: " + mediaInfo.GetInfo(MediaInfoStreamKind.General, "FileSize/String") + "\n" +
|
"Height: " + mediaInfo.GetInfo(MediaInfoStreamKind.Image, "Height") + "\n" +
|
||||||
"Type: " + path.Ext().ToUpper();
|
"Size: " + mediaInfo.GetInfo(MediaInfoStreamKind.General, "FileSize/String") + "\n" +
|
||||||
|
"Type: " + path.Ext().ToUpper();
|
||||||
Core.CommandV("show-text", text, "5000");
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text = "Width: " + Core.GetPropertyInt("width") + "\n" +
|
||||||
|
"Height: " + Core.GetPropertyInt("height") + "\n" +
|
||||||
|
"Size: " + Convert.ToInt32(fileSize / 1024.0) + " KB\n" +
|
||||||
|
"Type: " + path.Ext().ToUpper();
|
||||||
|
}
|
||||||
|
|
||||||
|
Core.CommandV("show-text", text, "5000");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,38 +326,30 @@ namespace mpvnet
|
|||||||
|
|
||||||
public static void CycleAudio()
|
public static void CycleAudio()
|
||||||
{
|
{
|
||||||
if (!App.MediaInfo)
|
Core.UpdateExternalTracks();
|
||||||
Core.UpdateTrackData();
|
|
||||||
|
|
||||||
var tracks = Core.MediaTracks.Where(track => track.Type == "a").ToArray();
|
lock (Core.MediaTracksLock)
|
||||||
|
|
||||||
if (App.MediaInfo)
|
|
||||||
{
|
{
|
||||||
var externalTracks = Core.GetExternalTracks().Where(track => track.Type == "a");
|
MediaTrack[] tracks = Core.MediaTracks.Where(track => track.Type == "a").ToArray();
|
||||||
|
|
||||||
if (externalTracks.Count() > 0)
|
if (tracks.Length < 1)
|
||||||
tracks = tracks.Concat(externalTracks).ToArray();
|
{
|
||||||
|
Core.CommandV("show-text", "No audio tracks");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int aid = Core.GetPropertyInt("aid");
|
||||||
|
|
||||||
|
if (tracks.Length > 1)
|
||||||
|
{
|
||||||
|
if (++aid > tracks.Length)
|
||||||
|
aid = 1;
|
||||||
|
|
||||||
|
Core.CommandV("set", "aid", aid.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
Core.CommandV("show-text", aid + "/" + tracks.Length + ": " + tracks[aid - 1].Text.Substring(3), "5000");
|
||||||
}
|
}
|
||||||
|
|
||||||
int len = tracks.Length;
|
|
||||||
|
|
||||||
if (len < 1)
|
|
||||||
{
|
|
||||||
Core.CommandV("show-text", "No audio tracks");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int aid = Core.GetPropertyInt("aid");
|
|
||||||
|
|
||||||
if (len > 1)
|
|
||||||
{
|
|
||||||
if (++aid > len)
|
|
||||||
aid = 1;
|
|
||||||
|
|
||||||
Core.CommandV("set", "aid", aid.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
Core.CommandV("show-text", aid + "/" + len + ": " + tracks[aid - 1].Text.Substring(3), "5000");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ShowCommands()
|
public static void ShowCommands()
|
||||||
@@ -388,6 +403,7 @@ namespace mpvnet
|
|||||||
(string Name, string Value)[] pairs = {
|
(string Name, string Value)[] pairs = {
|
||||||
("Show text box", "script-message mpv.net show-media-info default"),
|
("Show text box", "script-message mpv.net show-media-info default"),
|
||||||
("Show text editor", "script-message mpv.net show-media-info editor"),
|
("Show text editor", "script-message mpv.net show-media-info editor"),
|
||||||
|
("Show on screen", "script-message mpv.net show-media-info osd"),
|
||||||
("Show full", "script-message mpv.net show-media-info editor full"),
|
("Show full", "script-message mpv.net show-media-info editor full"),
|
||||||
("Show raw", "script-message mpv.net show-media-info editor full raw") };
|
("Show raw", "script-message mpv.net show-media-info editor full raw") };
|
||||||
|
|
||||||
@@ -402,23 +418,32 @@ namespace mpvnet
|
|||||||
|
|
||||||
if (File.Exists(path) && !path.Contains(@"\\.\pipe\"))
|
if (File.Exists(path) && !path.Contains(@"\\.\pipe\"))
|
||||||
{
|
{
|
||||||
using (MediaInfo mediaInfo = new MediaInfo(path))
|
string text = "";
|
||||||
|
|
||||||
|
bool full = args.Contains("full");
|
||||||
|
bool raw = args.Contains("raw");
|
||||||
|
bool editor = args.Contains("editor");
|
||||||
|
bool osd = args.Contains("osd");
|
||||||
|
|
||||||
|
if (App.MediaInfo && !osd)
|
||||||
|
using (MediaInfo mediaInfo = new MediaInfo(path))
|
||||||
|
text = Regex.Replace(mediaInfo.GetSummary(full, raw), "Unique ID.+", "");
|
||||||
|
else
|
||||||
|
lock (Core.MediaTracksLock)
|
||||||
|
foreach (MediaTrack track in Core.MediaTracks)
|
||||||
|
text += track.Text + BR;
|
||||||
|
|
||||||
|
text = text.TrimEx();
|
||||||
|
|
||||||
|
if (editor)
|
||||||
|
ShowTextWithEditor("media-info", text);
|
||||||
|
else if (osd)
|
||||||
|
Core.CommandV("show-text", text.Replace("\r", ""), "5000");
|
||||||
|
else
|
||||||
{
|
{
|
||||||
bool full = args.Contains("full");
|
MsgBoxEx.MessageBoxEx.MsgFontFamily = new FontFamily("Consolas");
|
||||||
bool raw = args.Contains("raw");
|
Msg.ShowInfo(text);
|
||||||
bool editor = args.Contains("editor");
|
MsgBoxEx.MessageBoxEx.MsgFontFamily = new FontFamily("Segoe UI");
|
||||||
|
|
||||||
string text = mediaInfo.GetSummary(full, raw);
|
|
||||||
text = Regex.Replace(text, "Unique ID.+", "");
|
|
||||||
|
|
||||||
if (editor)
|
|
||||||
ShowTextWithEditor("media-info", text);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MsgBoxEx.MessageBoxEx.MsgFontFamily = new FontFamily("Consolas");
|
|
||||||
Msg.ShowInfo(text);
|
|
||||||
MsgBoxEx.MessageBoxEx.MsgFontFamily = new FontFamily("Segoe UI");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -432,92 +457,81 @@ namespace mpvnet
|
|||||||
|
|
||||||
public static void ShowAudioTracks() => App.InvokeOnMainThread(() =>
|
public static void ShowAudioTracks() => App.InvokeOnMainThread(() =>
|
||||||
{
|
{
|
||||||
if (!App.MediaInfo)
|
Core.UpdateExternalTracks();
|
||||||
Core.UpdateTrackData();
|
|
||||||
|
|
||||||
var tracks = Core.MediaTracks.Where(track => track.Type == "a").ToArray();
|
lock (Core.MediaTracksLock)
|
||||||
|
{
|
||||||
|
MediaTrack[] tracks = Core.MediaTracks.Where(track => track.Type == "a").ToArray();
|
||||||
|
|
||||||
if (App.MediaInfo)
|
if (tracks.Length < 1)
|
||||||
{
|
|
||||||
var externalTracks = Core.GetExternalTracks().Where(track => track.Type == "a");
|
|
||||||
|
|
||||||
if (externalTracks.Count() > 0)
|
|
||||||
tracks = tracks.Concat(externalTracks).ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tracks.Length < 1)
|
|
||||||
{
|
|
||||||
Core.CommandV("show-text", "No audio tracks");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<CommandPaletteItem> items = new List<CommandPaletteItem>();
|
|
||||||
|
|
||||||
foreach (MediaTrack i in tracks)
|
|
||||||
{
|
|
||||||
MediaTrack track = i;
|
|
||||||
|
|
||||||
CommandPaletteItem item = new CommandPaletteItem()
|
|
||||||
{
|
{
|
||||||
Text = track.Text,
|
Core.CommandV("show-text", "No audio tracks");
|
||||||
Action = () => {
|
return;
|
||||||
Core.CommandV("set", "aid", track.ID.ToString());
|
}
|
||||||
Core.CommandV("show-text", track.ID + "/" + tracks.Length + ": " +
|
|
||||||
tracks[track.ID - 1].Text.Substring(3), "5000");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
items.Add(item);
|
List<CommandPaletteItem> items = new List<CommandPaletteItem>();
|
||||||
|
|
||||||
|
foreach (MediaTrack i in tracks)
|
||||||
|
{
|
||||||
|
MediaTrack track = i;
|
||||||
|
|
||||||
|
CommandPaletteItem item = new CommandPaletteItem()
|
||||||
|
{
|
||||||
|
Text = track.Text,
|
||||||
|
Action = () => {
|
||||||
|
Core.CommandV("set", "aid", track.ID.ToString());
|
||||||
|
Core.CommandV("show-text", track.ID + "/" + tracks.Length + ": " +
|
||||||
|
tracks[track.ID - 1].Text.Substring(3), "5000");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
items.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
CommandPalette.Instance.SetItems(items);
|
||||||
|
MainForm.Instance.ShowCommandPalette();
|
||||||
|
CommandPalette.Instance.SelectFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandPalette.Instance.SetItems(items);
|
|
||||||
MainForm.Instance.ShowCommandPalette();
|
|
||||||
CommandPalette.Instance.SelectFirst();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
public static void ShowSubtitleTracks() => App.InvokeOnMainThread(() =>
|
public static void ShowSubtitleTracks() => App.InvokeOnMainThread(() =>
|
||||||
{
|
{
|
||||||
if (!App.MediaInfo)
|
Core.UpdateExternalTracks();
|
||||||
Core.UpdateTrackData();
|
|
||||||
|
|
||||||
var tracks = Core.MediaTracks.Where(track => track.Type == "s").ToArray();
|
lock (Core.MediaTracksLock)
|
||||||
|
{
|
||||||
|
MediaTrack[] tracks = Core.MediaTracks.Where(track => track.Type == "s").ToArray();
|
||||||
|
|
||||||
if (App.MediaInfo)
|
if (tracks.Length < 1)
|
||||||
{
|
|
||||||
var externalTracks = Core.GetExternalTracks().Where(track => track.Type == "s");
|
|
||||||
|
|
||||||
if (externalTracks.Count() > 0)
|
|
||||||
tracks = tracks.Concat(externalTracks).ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tracks.Length < 1)
|
|
||||||
{
|
|
||||||
Core.CommandV("show-text", "No subtitle tracks");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<CommandPaletteItem> items = new List<CommandPaletteItem>();
|
|
||||||
|
|
||||||
foreach (MediaTrack i in tracks)
|
|
||||||
{
|
|
||||||
MediaTrack track = i;
|
|
||||||
|
|
||||||
CommandPaletteItem item = new CommandPaletteItem()
|
|
||||||
{
|
{
|
||||||
Text = track.Text,
|
Core.CommandV("show-text", "No subtitle tracks");
|
||||||
Action = () => {
|
return;
|
||||||
Core.CommandV("set", "sid", track.ID.ToString());
|
}
|
||||||
Core.CommandV("show-text", track.ID + "/" + tracks.Length + ": " +
|
|
||||||
tracks[track.ID - 1].Text.Substring(3), "5000");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
items.Add(item);
|
List<CommandPaletteItem> items = new List<CommandPaletteItem>();
|
||||||
|
|
||||||
|
foreach (MediaTrack i in tracks)
|
||||||
|
{
|
||||||
|
MediaTrack track = i;
|
||||||
|
|
||||||
|
CommandPaletteItem item = new CommandPaletteItem()
|
||||||
|
{
|
||||||
|
Text = track.Text,
|
||||||
|
Action = () => {
|
||||||
|
Core.CommandV("set", "sid", track.ID.ToString());
|
||||||
|
Core.CommandV("show-text", track.ID + "/" + tracks.Length + ": " +
|
||||||
|
tracks[track.ID - 1].Text.Substring(3), "5000");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
items.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
CommandPalette.Instance.SetItems(items);
|
||||||
|
MainForm.Instance.ShowCommandPalette();
|
||||||
|
CommandPalette.Instance.SelectFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandPalette.Instance.SetItems(items);
|
|
||||||
MainForm.Instance.ShowCommandPalette();
|
|
||||||
CommandPalette.Instance.SelectFirst();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
public static void ShowPlaylist() => App.InvokeOnMainThread(() =>
|
public static void ShowPlaylist() => App.InvokeOnMainThread(() =>
|
||||||
|
|||||||
@@ -227,10 +227,9 @@ namespace mpvnet
|
|||||||
|
|
||||||
void UpdateMenu()
|
void UpdateMenu()
|
||||||
{
|
{
|
||||||
if (!App.MediaInfo)
|
Core.UpdateExternalTracks();
|
||||||
Core.UpdateTrackData();
|
|
||||||
|
|
||||||
lock (Core.MediaTracks)
|
lock (Core.MediaTracksLock)
|
||||||
{
|
{
|
||||||
var trackMenuItem = FindMenuItem("Track");
|
var trackMenuItem = FindMenuItem("Track");
|
||||||
|
|
||||||
@@ -243,23 +242,6 @@ namespace mpvnet
|
|||||||
var vidTracks = Core.MediaTracks.Where(track => track.Type == "v");
|
var vidTracks = Core.MediaTracks.Where(track => track.Type == "v");
|
||||||
var ediTracks = Core.MediaTracks.Where(track => track.Type == "e");
|
var ediTracks = Core.MediaTracks.Where(track => track.Type == "e");
|
||||||
|
|
||||||
if (App.MediaInfo)
|
|
||||||
{
|
|
||||||
var externalTracks = Core.GetExternalTracks();
|
|
||||||
|
|
||||||
if (externalTracks.Count > 0)
|
|
||||||
{
|
|
||||||
var exAudTracks = externalTracks.Where(track => track.Type == "a");
|
|
||||||
var exSubTracks = externalTracks.Where(track => track.Type == "s");
|
|
||||||
|
|
||||||
if (exAudTracks.Count() > 0)
|
|
||||||
audTracks = audTracks.Concat(exAudTracks);
|
|
||||||
|
|
||||||
if (exSubTracks.Count() > 0)
|
|
||||||
subTracks = subTracks.Concat(exSubTracks);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (MediaTrack track in vidTracks)
|
foreach (MediaTrack track in vidTracks)
|
||||||
{
|
{
|
||||||
var mi = new WpfControls.MenuItem() { Header = track.Text };
|
var mi = new WpfControls.MenuItem() { Header = track.Text };
|
||||||
@@ -748,14 +730,16 @@ namespace mpvnet
|
|||||||
path = path + "|" + title;
|
path = path + "|" + title;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (App.Settings.RecentFiles.Contains(path))
|
if (!string.IsNullOrEmpty(path) && path != @"bd://" && path != @"dvd://")
|
||||||
App.Settings.RecentFiles.Remove(path);
|
{
|
||||||
|
if (App.Settings.RecentFiles.Contains(path))
|
||||||
|
App.Settings.RecentFiles.Remove(path);
|
||||||
|
|
||||||
if (path != @"bd://" && path != @"dvd://")
|
|
||||||
App.Settings.RecentFiles.Insert(0, path);
|
App.Settings.RecentFiles.Insert(0, path);
|
||||||
|
|
||||||
while (App.Settings.RecentFiles.Count > App.RecentCount)
|
while (App.Settings.RecentFiles.Count > App.RecentCount)
|
||||||
App.Settings.RecentFiles.RemoveAt(App.RecentCount);
|
App.Settings.RecentFiles.RemoveAt(App.RecentCount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetTitle() => BeginInvoke(new Action(() => Text = Core.Expand(Title)));
|
void SetTitle() => BeginInvoke(new Action(() => Text = Core.Expand(Title)));
|
||||||
|
|||||||
@@ -134,9 +134,10 @@ namespace mpvnet
|
|||||||
|
|
||||||
public class MediaTrack
|
public class MediaTrack
|
||||||
{
|
{
|
||||||
|
public int ID { get; set; }
|
||||||
|
public bool External { get; set; }
|
||||||
public string Text { get; set; }
|
public string Text { get; set; }
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
public int ID { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CommandItem : INotifyPropertyChanged
|
public class CommandItem : INotifyPropertyChanged
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ namespace mpvnet
|
|||||||
public Dictionary<string, List<Action<string>>> StringPropChangeActions { get; set; } = new Dictionary<string, List<Action<string>>>();
|
public Dictionary<string, List<Action<string>>> StringPropChangeActions { get; set; } = new Dictionary<string, List<Action<string>>>();
|
||||||
|
|
||||||
public List<MediaTrack> MediaTracks { get; set; } = new List<MediaTrack>();
|
public List<MediaTrack> MediaTracks { get; set; } = new List<MediaTrack>();
|
||||||
|
public object MediaTracksLock { get; } = new object();
|
||||||
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<TimeSpan> BluRayTitles { get; } = new List<TimeSpan>();
|
public List<TimeSpan> BluRayTitles { get; } = new List<TimeSpan>();
|
||||||
public IntPtr Handle { get; set; }
|
public IntPtr Handle { get; set; }
|
||||||
@@ -541,8 +542,7 @@ namespace mpvnet
|
|||||||
VideoSizeAutoResetEvent.Set();
|
VideoSizeAutoResetEvent.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (App.MediaInfo)
|
App.RunTask(new Action(() => UpdateTracks()));
|
||||||
App.RunTask(new Action(() => UpdateTrackDataUsingMediaInfo()));
|
|
||||||
|
|
||||||
App.RunTask(new Action(() => {
|
App.RunTask(new Action(() => {
|
||||||
if (path.Contains("://"))
|
if (path.Contains("://"))
|
||||||
@@ -1377,10 +1377,31 @@ namespace mpvnet
|
|||||||
string GetLanguage(string id)
|
string GetLanguage(string id)
|
||||||
{
|
{
|
||||||
foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
|
foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
|
||||||
if (ci.ThreeLetterISOLanguageName == id)
|
if (ci.ThreeLetterISOLanguageName == id || Convert(ci.ThreeLetterISOLanguageName) == id)
|
||||||
return ci.EnglishName;
|
return ci.EnglishName;
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
|
|
||||||
|
string Convert(string id2)
|
||||||
|
{
|
||||||
|
switch (id2)
|
||||||
|
{
|
||||||
|
case "bng": return "ben";
|
||||||
|
case "ces": return "cze";
|
||||||
|
case "deu": return "ger";
|
||||||
|
case "ell": return "gre";
|
||||||
|
case "eus": return "baq";
|
||||||
|
case "fra": return "fre";
|
||||||
|
case "hye": return "arm";
|
||||||
|
case "isl": return "ice";
|
||||||
|
case "kat": return "geo";
|
||||||
|
case "mya": return "bur";
|
||||||
|
case "nld": return "dut";
|
||||||
|
case "sqi": return "alb";
|
||||||
|
case "zho": return "chi";
|
||||||
|
default: return id2;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RaiseScaleWindow(float value) => ScaleWindow(value);
|
public void RaiseScaleWindow(float value) => ScaleWindow(value);
|
||||||
@@ -1389,54 +1410,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
public void RaiseShowMenu() => ShowMenu();
|
public void RaiseShowMenu() => ShowMenu();
|
||||||
|
|
||||||
public List<MediaTrack> GetExternalTracks()
|
public void UpdateTracks()
|
||||||
{
|
|
||||||
List<MediaTrack> tracks = new List<MediaTrack>();
|
|
||||||
int count = GetPropertyInt("track-list/count");
|
|
||||||
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
bool external = GetPropertyBool($"track-list/{i}/external");
|
|
||||||
|
|
||||||
if (external)
|
|
||||||
{
|
|
||||||
string type = GetPropertyString($"track-list/{i}/type");
|
|
||||||
string filename = GetPropertyString($"filename/no-ext");
|
|
||||||
string title = GetPropertyString($"track-list/{i}/title").Replace(filename, "");
|
|
||||||
title = Regex.Replace(title, @"^[\._\-]", "").Replace("_", "__");
|
|
||||||
|
|
||||||
if (type == "audio")
|
|
||||||
{
|
|
||||||
MediaTrack track = new MediaTrack();
|
|
||||||
Add(track, GetLanguage(GetPropertyString($"track-list/{i}/lang")));
|
|
||||||
Add(track, GetPropertyString($"track-list/{i}/codec").ToUpperEx());
|
|
||||||
Add(track, GetPropertyInt($"track-list/{i}/audio-channels") + " channels");
|
|
||||||
Add(track, "External");
|
|
||||||
Add(track, title);
|
|
||||||
track.Text = "A: " + track.Text.Trim(' ', ',');
|
|
||||||
track.Type = "a";
|
|
||||||
track.ID = GetPropertyInt($"track-list/{i}/id");
|
|
||||||
tracks.Add(track);
|
|
||||||
}
|
|
||||||
else if (type == "sub")
|
|
||||||
{
|
|
||||||
MediaTrack track = new MediaTrack();
|
|
||||||
Add(track, GetLanguage(GetPropertyString($"track-list/{i}/lang")));
|
|
||||||
Add(track, GetPropertyString($"track-list/{i}/codec").ToUpperEx());
|
|
||||||
Add(track, "External");
|
|
||||||
Add(track, title);
|
|
||||||
track.Text = "S: " + track.Text.Trim(' ', ',');
|
|
||||||
track.Type = "s";
|
|
||||||
track.ID = GetPropertyInt($"track-list/{i}/id");
|
|
||||||
tracks.Add(track);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tracks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateTrackData()
|
|
||||||
{
|
{
|
||||||
string path = GetPropertyString("path");
|
string path = GetPropertyString("path");
|
||||||
|
|
||||||
@@ -1444,64 +1418,118 @@ namespace mpvnet
|
|||||||
lock (BluRayTitles)
|
lock (BluRayTitles)
|
||||||
BluRayTitles.Clear();
|
BluRayTitles.Clear();
|
||||||
|
|
||||||
lock (MediaTracks)
|
lock (MediaTracksLock)
|
||||||
{
|
{
|
||||||
MediaTracks.Clear();
|
if (App.MediaInfo && !path.Contains("://") && !path.Contains(@"\\.\pipe\") && File.Exists(path))
|
||||||
|
MediaTracks = GetMediaInfoTracks(path);
|
||||||
|
else
|
||||||
|
MediaTracks = GetTracks();
|
||||||
|
}
|
||||||
|
|
||||||
int trackListCount = GetPropertyInt("track-list/count");
|
lock (Chapters)
|
||||||
|
{
|
||||||
|
Chapters.Clear();
|
||||||
|
int count = GetPropertyInt("chapter-list/count");
|
||||||
|
|
||||||
for (int i = 0; i < trackListCount; i++)
|
for (int x = 0; x < count; x++)
|
||||||
{
|
{
|
||||||
string type = GetPropertyString($"track-list/{i}/type");
|
string text = GetPropertyString($"chapter-list/{x}/title");
|
||||||
string filename = GetPropertyString($"filename/no-ext");
|
double time = GetPropertyDouble($"chapter-list/{x}/time");
|
||||||
string title = GetPropertyString($"track-list/{i}/title").Replace(filename, "");
|
|
||||||
|
|
||||||
title = Regex.Replace(title, @"^[\._\-]", "").Replace("_", "__");
|
|
||||||
|
|
||||||
if (type == "video")
|
if (string.IsNullOrEmpty(text))
|
||||||
{
|
text = "Chapter " + (x + 1);
|
||||||
MediaTrack track = new MediaTrack();
|
|
||||||
Add(track, GetPropertyString($"track-list/{i}/codec").ToUpperEx());
|
Chapters.Add(new KeyValuePair<string, double>(text, time));
|
||||||
Add(track, GetPropertyString($"track-list/{i}/demux-w") + "x" + GetPropertyString($"track-list/{i}/demux-h"));
|
|
||||||
Add(track, GetPropertyString($"track-list/{i}/demux-fps").Replace(".000000", "") + " FPS");
|
|
||||||
Add(track, GetPropertyBool($"track-list/{i}/default") ? "Default" : null);
|
|
||||||
track.Text = "V: " + track.Text.Trim(' ', ',');
|
|
||||||
track.Type = "v";
|
|
||||||
track.ID = GetPropertyInt($"track-list/{i}/id");
|
|
||||||
MediaTracks.Add(track);
|
|
||||||
}
|
|
||||||
else if (type == "audio")
|
|
||||||
{
|
|
||||||
MediaTrack track = new MediaTrack();
|
|
||||||
Add(track, GetLanguage(GetPropertyString($"track-list/{i}/lang")));
|
|
||||||
Add(track, GetPropertyString($"track-list/{i}/codec").ToUpperEx());
|
|
||||||
Add(track, GetPropertyInt($"track-list/{i}/audio-channels") + " channels");
|
|
||||||
Add(track, GetPropertyInt($"track-list/{i}/demux-samplerate") + " Hz");
|
|
||||||
Add(track, GetPropertyBool($"track-list/{i}/forced") ? "Forced" : null);
|
|
||||||
Add(track, GetPropertyBool($"track-list/{i}/default") ? "Default" : null);
|
|
||||||
Add(track, GetPropertyBool($"track-list/{i}/external") ? "External" : null);
|
|
||||||
Add(track, title);
|
|
||||||
track.Text = "A: " + track.Text.Trim(' ', ',');
|
|
||||||
track.Type = "a";
|
|
||||||
track.ID = GetPropertyInt($"track-list/{i}/id");
|
|
||||||
MediaTracks.Add(track);
|
|
||||||
}
|
|
||||||
else if (type == "sub")
|
|
||||||
{
|
|
||||||
MediaTrack track = new MediaTrack();
|
|
||||||
Add(track, GetLanguage(GetPropertyString($"track-list/{i}/lang")));
|
|
||||||
Add(track, GetPropertyString($"track-list/{i}/codec").ToUpperEx());
|
|
||||||
Add(track, GetPropertyBool($"track-list/{i}/forced") ? "Forced" : null);
|
|
||||||
Add(track, GetPropertyBool($"track-list/{i}/default") ? "Default" : null);
|
|
||||||
Add(track, GetPropertyBool($"track-list/{i}/external") ? "External" : null);
|
|
||||||
Add(track, title);
|
|
||||||
track.Text = "S: " + track.Text.Trim(' ', ',');
|
|
||||||
track.Type = "s";
|
|
||||||
track.ID = GetPropertyInt($"track-list/{i}/id");
|
|
||||||
MediaTracks.Add(track);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateExternalTracks()
|
||||||
|
{
|
||||||
|
int trackCount = GetPropertyInt("track-list/count");
|
||||||
|
int editionCount = GetPropertyInt("edition-list/count");
|
||||||
|
|
||||||
|
lock (MediaTracksLock)
|
||||||
|
{
|
||||||
|
if (MediaTracks.Count != (trackCount + editionCount))
|
||||||
|
{
|
||||||
|
MediaTracks = MediaTracks.Where(i => !i.External).ToList();
|
||||||
|
MediaTracks.AddRange(GetTracks(false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MediaTrack> GetTracks(bool includeInternal = true, bool includeExternal = true)
|
||||||
|
{
|
||||||
|
List<MediaTrack> tracks = new List<MediaTrack>();
|
||||||
|
|
||||||
|
int trackCount = GetPropertyInt("track-list/count");
|
||||||
|
|
||||||
|
for (int i = 0; i < trackCount; i++)
|
||||||
|
{
|
||||||
|
bool external = GetPropertyBool($"track-list/{i}/external");
|
||||||
|
|
||||||
|
if ((external && !includeExternal) || (!external && !includeInternal))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
string type = GetPropertyString($"track-list/{i}/type");
|
||||||
|
string filename = GetPropertyString($"filename/no-ext");
|
||||||
|
string title = GetPropertyString($"track-list/{i}/title").Replace(filename, "");
|
||||||
|
|
||||||
|
title = Regex.Replace(title, @"^[\._\-]", "").Replace("_", "__");
|
||||||
|
|
||||||
|
if (type == "video")
|
||||||
|
{
|
||||||
|
MediaTrack track = new MediaTrack();
|
||||||
|
Add(track, GetPropertyString($"track-list/{i}/codec").ToUpperEx());
|
||||||
|
Add(track, GetPropertyString($"track-list/{i}/demux-w") + "x" + GetPropertyString($"track-list/{i}/demux-h"));
|
||||||
|
Add(track, GetPropertyString($"track-list/{i}/demux-fps").Replace(".000000", "") + " FPS");
|
||||||
|
Add(track, GetPropertyBool($"track-list/{i}/default") ? "Default" : null);
|
||||||
|
track.Text = "V: " + track.Text.Trim(' ', ',');
|
||||||
|
track.Type = "v";
|
||||||
|
track.ID = GetPropertyInt($"track-list/{i}/id");
|
||||||
|
tracks.Add(track);
|
||||||
|
}
|
||||||
|
else if (type == "audio")
|
||||||
|
{
|
||||||
|
MediaTrack track = new MediaTrack();
|
||||||
|
Add(track, GetLanguage(GetPropertyString($"track-list/{i}/lang")));
|
||||||
|
Add(track, GetPropertyString($"track-list/{i}/codec").ToUpperEx());
|
||||||
|
Add(track, GetPropertyInt($"track-list/{i}/audio-channels") + " channels");
|
||||||
|
Add(track, GetPropertyInt($"track-list/{i}/demux-samplerate") + " Hz");
|
||||||
|
Add(track, GetPropertyBool($"track-list/{i}/forced") ? "Forced" : null);
|
||||||
|
Add(track, GetPropertyBool($"track-list/{i}/default") ? "Default" : null);
|
||||||
|
Add(track, GetPropertyBool($"track-list/{i}/external") ? "External" : null);
|
||||||
|
Add(track, title);
|
||||||
|
track.Text = "A: " + track.Text.Trim(' ', ',');
|
||||||
|
track.Type = "a";
|
||||||
|
track.ID = GetPropertyInt($"track-list/{i}/id");
|
||||||
|
track.External = external;
|
||||||
|
tracks.Add(track);
|
||||||
|
}
|
||||||
|
else if (type == "sub")
|
||||||
|
{
|
||||||
|
string codec = GetPropertyString($"track-list/{i}/codec");
|
||||||
|
if (codec == "hdmv_pgs_subtitle")
|
||||||
|
codec = "pgs";
|
||||||
|
MediaTrack track = new MediaTrack();
|
||||||
|
Add(track, GetLanguage(GetPropertyString($"track-list/{i}/lang")));
|
||||||
|
Add(track, codec.ToUpperEx());
|
||||||
|
Add(track, GetPropertyBool($"track-list/{i}/forced") ? "Forced" : null);
|
||||||
|
Add(track, GetPropertyBool($"track-list/{i}/default") ? "Default" : null);
|
||||||
|
Add(track, GetPropertyBool($"track-list/{i}/external") ? "External" : null);
|
||||||
|
Add(track, title);
|
||||||
|
track.Text = "S: " + track.Text.Trim(' ', ',');
|
||||||
|
track.Type = "s";
|
||||||
|
track.ID = GetPropertyInt($"track-list/{i}/id");
|
||||||
|
track.External = external;
|
||||||
|
tracks.Add(track);
|
||||||
|
Debug.WriteLine(GetPropertyString($"track-list/{i}/codec"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (includeInternal)
|
||||||
|
{
|
||||||
int editionCount = GetPropertyInt("edition-list/count");
|
int editionCount = GetPropertyInt("edition-list/count");
|
||||||
|
|
||||||
for (int i = 0; i < editionCount; i++)
|
for (int i = 0; i < editionCount; i++)
|
||||||
@@ -1513,164 +1541,91 @@ namespace mpvnet
|
|||||||
track.Text = "E: " + title;
|
track.Text = "E: " + title;
|
||||||
track.Type = "e";
|
track.Type = "e";
|
||||||
track.ID = i;
|
track.ID = i;
|
||||||
MediaTracks.Add(track);
|
tracks.Add(track);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (Chapters)
|
return tracks;
|
||||||
{
|
|
||||||
Chapters.Clear();
|
|
||||||
int count = GetPropertyInt("chapter-list/count");
|
|
||||||
|
|
||||||
for (int x = 0; x < count; x++)
|
|
||||||
{
|
|
||||||
string text = GetPropertyString($"chapter-list/{x}/title");
|
|
||||||
double time = GetPropertyDouble($"chapter-list/{x}/time");
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(text))
|
|
||||||
text = "Chapter " + (x + 1);
|
|
||||||
|
|
||||||
Chapters.Add(new KeyValuePair<string, double>(text, time));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateTrackDataUsingMediaInfo()
|
public List<MediaTrack> GetMediaInfoTracks(string path)
|
||||||
{
|
{
|
||||||
string path = GetPropertyString("path");
|
List<MediaTrack> tracks = new List<MediaTrack>();
|
||||||
|
|
||||||
if (!path.ToLowerEx().StartsWithEx("bd://"))
|
using (MediaInfo mi = new MediaInfo(path))
|
||||||
lock (BluRayTitles)
|
|
||||||
BluRayTitles.Clear();
|
|
||||||
|
|
||||||
lock (MediaTracks)
|
|
||||||
{
|
{
|
||||||
MediaTracks.Clear();
|
int videoCount = mi.GetCount(MediaInfoStreamKind.Video);
|
||||||
|
|
||||||
if (path.ToLowerEx().Contains("://"))
|
for (int i = 0; i < videoCount; i++)
|
||||||
{
|
{
|
||||||
int trackListCount = GetPropertyInt("track-list/count");
|
MediaTrack track = new MediaTrack();
|
||||||
|
Add(track, mi.GetVideo(i, "Format"));
|
||||||
for (int i = 0; i < trackListCount; i++)
|
Add(track, mi.GetVideo(i, "Format_Profile"));
|
||||||
{
|
Add(track, mi.GetVideo(i, "Width") + "x" + mi.GetVideo(i, "Height"));
|
||||||
string type = GetPropertyString($"track-list/{i}/type");
|
Add(track, mi.GetVideo(i, "FrameRate") + " FPS");
|
||||||
|
Add(track, mi.GetVideo(i, "Language/String"));
|
||||||
if (type == "audio")
|
Add(track, mi.GetVideo(i, "Forced") == "Yes" ? "Forced" : "");
|
||||||
{
|
Add(track, mi.GetVideo(i, "Default") == "Yes" ? "Default" : "");
|
||||||
MediaTrack track = new MediaTrack();
|
Add(track, mi.GetVideo(i, "Title"));
|
||||||
Add(track, GetLanguage(GetPropertyString($"track-list/{i}/lang")));
|
track.Text = "V: " + track.Text.Trim(' ', ',');
|
||||||
Add(track, GetPropertyString($"track-list/{i}/codec").ToUpperEx());
|
track.Type = "v";
|
||||||
Add(track, GetPropertyInt($"track-list/{i}/audio-channels") + " channels");
|
track.ID = i + 1;
|
||||||
track.Text = "A: " + track.Text.Trim(' ', ',');
|
tracks.Add(track);
|
||||||
track.Type = "a";
|
|
||||||
track.ID = GetPropertyInt($"track-list/{i}/id");
|
|
||||||
MediaTracks.Add(track);
|
|
||||||
}
|
|
||||||
else if (type == "sub")
|
|
||||||
{
|
|
||||||
MediaTrack track = new MediaTrack();
|
|
||||||
Add(track, GetLanguage(GetPropertyString($"track-list/{i}/lang")));
|
|
||||||
Add(track, GetPropertyString($"track-list/{i}/codec").ToUpperEx());
|
|
||||||
track.Text = "S: " + track.Text.Trim(' ', ',');
|
|
||||||
track.Type = "s";
|
|
||||||
track.ID = GetPropertyInt($"track-list/{i}/id");
|
|
||||||
MediaTracks.Add(track);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (File.Exists(path) && !path.Contains(@"\\.\pipe\"))
|
|
||||||
|
int audioCount = mi.GetCount(MediaInfoStreamKind.Audio);
|
||||||
|
|
||||||
|
for (int i = 0; i < audioCount; i++)
|
||||||
{
|
{
|
||||||
using (MediaInfo mi = new MediaInfo(path))
|
MediaTrack track = new MediaTrack();
|
||||||
{
|
Add(track, mi.GetAudio(i, "Language/String"));
|
||||||
int videoCount = mi.GetCount(MediaInfoStreamKind.Video);
|
Add(track, mi.GetAudio(i, "Format"));
|
||||||
|
Add(track, mi.GetAudio(i, "Format_Profile"));
|
||||||
|
Add(track, mi.GetAudio(i, "BitRate/String"));
|
||||||
|
Add(track, mi.GetAudio(i, "Channel(s)/String"));
|
||||||
|
Add(track, mi.GetAudio(i, "SamplingRate/String"));
|
||||||
|
Add(track, mi.GetAudio(i, "Forced") == "Yes" ? "Forced" : "");
|
||||||
|
Add(track, mi.GetAudio(i, "Default") == "Yes" ? "Default" : "");
|
||||||
|
Add(track, mi.GetAudio(i, "Title"));
|
||||||
|
track.Text = "A: " + track.Text.Trim(' ', ',');
|
||||||
|
track.Type = "a";
|
||||||
|
track.ID = i + 1;
|
||||||
|
tracks.Add(track);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < videoCount; i++)
|
int subCount = mi.GetCount(MediaInfoStreamKind.Text);
|
||||||
{
|
|
||||||
MediaTrack track = new MediaTrack();
|
|
||||||
Add(track, mi.GetVideo(i, "Format"));
|
|
||||||
Add(track, mi.GetVideo(i, "Format_Profile"));
|
|
||||||
Add(track, mi.GetVideo(i, "Width") + "x" + mi.GetVideo(i, "Height"));
|
|
||||||
Add(track, mi.GetVideo(i, "FrameRate") + " FPS");
|
|
||||||
Add(track, mi.GetVideo(i, "Language/String"));
|
|
||||||
Add(track, mi.GetVideo(i, "Forced") == "Yes" ? "Forced" : "");
|
|
||||||
Add(track, mi.GetVideo(i, "Default") == "Yes" ? "Default" : "");
|
|
||||||
Add(track, mi.GetVideo(i, "Title"));
|
|
||||||
track.Text = "V: " + track.Text.Trim(' ', ',');
|
|
||||||
track.Type = "v";
|
|
||||||
track.ID = i + 1;
|
|
||||||
MediaTracks.Add(track);
|
|
||||||
}
|
|
||||||
|
|
||||||
int audioCount = mi.GetCount(MediaInfoStreamKind.Audio);
|
for (int i = 0; i < subCount; i++)
|
||||||
|
{
|
||||||
for (int i = 0; i < audioCount; i++)
|
MediaTrack track = new MediaTrack();
|
||||||
{
|
Add(track, mi.GetText(i, "Language/String"));
|
||||||
MediaTrack track = new MediaTrack();
|
Add(track, mi.GetText(i, "Format"));
|
||||||
Add(track, mi.GetAudio(i, "Language/String"));
|
Add(track, mi.GetText(i, "Format_Profile"));
|
||||||
Add(track, mi.GetAudio(i, "Format"));
|
Add(track, mi.GetText(i, "Forced") == "Yes" ? "Forced" : "");
|
||||||
Add(track, mi.GetAudio(i, "Format_Profile"));
|
Add(track, mi.GetText(i, "Default") == "Yes" ? "Default" : "");
|
||||||
Add(track, mi.GetAudio(i, "BitRate/String"));
|
Add(track, mi.GetText(i, "Title"));
|
||||||
Add(track, mi.GetAudio(i, "Channel(s)/String"));
|
track.Text = "S: " + track.Text.Trim(' ', ',');
|
||||||
Add(track, mi.GetAudio(i, "SamplingRate/String"));
|
track.Type = "s";
|
||||||
Add(track, mi.GetAudio(i, "Forced") == "Yes" ? "Forced" : "");
|
track.ID = i + 1;
|
||||||
Add(track, mi.GetAudio(i, "Default") == "Yes" ? "Default" : "");
|
tracks.Add(track);
|
||||||
Add(track, mi.GetAudio(i, "Title"));
|
|
||||||
track.Text = "A: " + track.Text.Trim(' ', ',');
|
|
||||||
track.Type = "a";
|
|
||||||
track.ID = i + 1;
|
|
||||||
MediaTracks.Add(track);
|
|
||||||
}
|
|
||||||
|
|
||||||
int subCount = mi.GetCount(MediaInfoStreamKind.Text);
|
|
||||||
|
|
||||||
for (int i = 0; i < subCount; i++)
|
|
||||||
{
|
|
||||||
MediaTrack track = new MediaTrack();
|
|
||||||
Add(track, mi.GetText(i, "Language/String"));
|
|
||||||
Add(track, mi.GetText(i, "Format"));
|
|
||||||
Add(track, mi.GetText(i, "Format_Profile"));
|
|
||||||
Add(track, mi.GetText(i, "Forced") == "Yes" ? "Forced" : "");
|
|
||||||
Add(track, mi.GetText(i, "Default") == "Yes" ? "Default" : "");
|
|
||||||
Add(track, mi.GetText(i, "Title"));
|
|
||||||
track.Text = "S: " + track.Text.Trim(' ', ',');
|
|
||||||
track.Type = "s";
|
|
||||||
track.ID = i + 1;
|
|
||||||
MediaTracks.Add(track);
|
|
||||||
}
|
|
||||||
|
|
||||||
int editionCount = GetPropertyInt("edition-list/count");
|
|
||||||
|
|
||||||
for (int i = 0; i < editionCount; i++)
|
|
||||||
{
|
|
||||||
string title = GetPropertyString($"edition-list/{i}/title");
|
|
||||||
if (string.IsNullOrEmpty(title))
|
|
||||||
title = "Edition " + i;
|
|
||||||
MediaTrack track = new MediaTrack();
|
|
||||||
track.Text = "E: " + title;
|
|
||||||
track.Type = "e";
|
|
||||||
track.ID = i;
|
|
||||||
MediaTracks.Add(track);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (Chapters)
|
int editionCount = GetPropertyInt("edition-list/count");
|
||||||
|
|
||||||
|
for (int i = 0; i < editionCount; i++)
|
||||||
{
|
{
|
||||||
Chapters.Clear();
|
string title = GetPropertyString($"edition-list/{i}/title");
|
||||||
int count = GetPropertyInt("chapter-list/count");
|
if (string.IsNullOrEmpty(title))
|
||||||
|
title = "Edition " + i;
|
||||||
for (int x = 0; x < count; x++)
|
MediaTrack track = new MediaTrack();
|
||||||
{
|
track.Text = "E: " + title;
|
||||||
string text = GetPropertyString($"chapter-list/{x}/title");
|
track.Type = "e";
|
||||||
double time = GetPropertyDouble($"chapter-list/{x}/time");
|
track.ID = i;
|
||||||
|
tracks.Add(track);
|
||||||
if (string.IsNullOrEmpty(text))
|
|
||||||
text = "Chapter " + (x + 1);
|
|
||||||
|
|
||||||
Chapters.Add(new KeyValuePair<string, double>(text, time));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return tracks;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Add(MediaTrack track, object value)
|
void Add(MediaTrack track, object value)
|
||||||
|
|||||||
Reference in New Issue
Block a user