use filtered-metadata option for music osd
This commit is contained in:
@@ -170,81 +170,33 @@ namespace mpvnet
|
|||||||
|
|
||||||
LastShowInfo = Environment.TickCount;
|
LastShowInfo = Environment.TickCount;
|
||||||
|
|
||||||
string performer, title, album, genre, date, duration, text = "";
|
string text;
|
||||||
long fileSize = 0;
|
long fileSize = 0;
|
||||||
string path = Core.GetPropertyString("path");
|
string path = Core.GetPropertyString("path");
|
||||||
|
|
||||||
if (path.Contains("://"))
|
|
||||||
path = Core.GetPropertyString("media-title");
|
|
||||||
|
|
||||||
if (File.Exists(path))
|
if (File.Exists(path))
|
||||||
{
|
{
|
||||||
fileSize = new FileInfo(path).Length;
|
fileSize = new FileInfo(path).Length;
|
||||||
|
|
||||||
if (CorePlayer.AudioTypes.Contains(path.Ext()))
|
if (CorePlayer.AudioTypes.Contains(path.Ext()))
|
||||||
{
|
{
|
||||||
if (App.MediaInfo)
|
text = Core.GetPropertyOsdString("filtered-metadata");
|
||||||
{
|
|
||||||
using (MediaInfo mediaInfo = new MediaInfo(path))
|
|
||||||
{
|
|
||||||
performer = mediaInfo.GetInfo(MediaInfoStreamKind.General, "Performer");
|
|
||||||
title = mediaInfo.GetInfo(MediaInfoStreamKind.General, "Title");
|
|
||||||
album = mediaInfo.GetInfo(MediaInfoStreamKind.General, "Album");
|
|
||||||
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 (title != "") text += "Title: " + title + "\n";
|
|
||||||
if (album != "") text += "Album: " + album + "\n";
|
|
||||||
if (genre != "") text += "Genre: " + genre + "\n";
|
|
||||||
if (date != "") text += "Year: " + date + "\n";
|
|
||||||
if (duration != "") text += "Length: " + duration + "\n";
|
|
||||||
|
|
||||||
text += "Size: " + mediaInfo.GetInfo(MediaInfoStreamKind.General, "FileSize/String") + "\n";
|
|
||||||
text += "Type: " + path.Ext().ToUpper();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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");
|
Core.CommandV("show-text", text, "5000");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (CorePlayer.ImageTypes.Contains(path.Ext()))
|
else if (CorePlayer.ImageTypes.Contains(path.Ext()))
|
||||||
{
|
{
|
||||||
if (App.MediaInfo)
|
text = "Width: " + Core.GetPropertyInt("width") + "\n" +
|
||||||
{
|
"Height: " + Core.GetPropertyInt("height") + "\n" +
|
||||||
using (MediaInfo mediaInfo = new MediaInfo(path))
|
"Size: " + Convert.ToInt32(fileSize / 1024.0) + " KB\n" +
|
||||||
{
|
"Type: " + path.Ext().ToUpper();
|
||||||
text = "Width: " + mediaInfo.GetInfo(MediaInfoStreamKind.Image, "Width") + "\n" +
|
|
||||||
"Height: " + mediaInfo.GetInfo(MediaInfoStreamKind.Image, "Height") + "\n" +
|
|
||||||
"Size: " + mediaInfo.GetInfo(MediaInfoStreamKind.General, "FileSize/String") + "\n" +
|
|
||||||
"Type: " + path.Ext().ToUpper();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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");
|
Core.CommandV("show-text", text, "5000");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (path.Contains("://")) path = Core.GetPropertyString("media-title");
|
||||||
string videoFormat = Core.GetPropertyString("video-format").ToUpper();
|
string videoFormat = Core.GetPropertyString("video-format").ToUpper();
|
||||||
string audioCodec = Core.GetPropertyString("audio-codec-name").ToUpper();
|
string audioCodec = Core.GetPropertyString("audio-codec-name").ToUpper();
|
||||||
int width = Core.GetPropertyInt("video-params/w");
|
int width = Core.GetPropertyInt("video-params/w");
|
||||||
@@ -255,7 +207,6 @@ namespace mpvnet
|
|||||||
if (fileSize > 0) text += Convert.ToInt32(fileSize / 1024.0 / 1024.0) + " MB\n";
|
if (fileSize > 0) text += Convert.ToInt32(fileSize / 1024.0 / 1024.0) + " MB\n";
|
||||||
text += $"{width} x {height}\n";
|
text += $"{width} x {height}\n";
|
||||||
text += $"{videoFormat}\n{audioCodec}";
|
text += $"{videoFormat}\n{audioCodec}";
|
||||||
|
|
||||||
Core.CommandV("show-text", text, "5000");
|
Core.CommandV("show-text", text, "5000");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user