New media info command
This commit is contained in:
@@ -1,4 +1,10 @@
|
|||||||
|
|
||||||
|
5.4.9.1 (2021-0?-??)
|
||||||
|
====================
|
||||||
|
|
||||||
|
- New media info command: Ctrl+m script-message mpv.net show-media-info #menu: View > Show Media Info
|
||||||
|
|
||||||
|
|
||||||
5.4.9.0 (2021-05-29)
|
5.4.9.0 (2021-05-29)
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
|||||||
@@ -60,10 +60,14 @@ Download
|
|||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
|
|
||||||
mpv.net requires the .NET Framework 4.8 and Windows 7 or 10 and a modern graphics card.
|
mpv.net requires the .NET Framework 4.8 and Windows 7 or higher and a modern graphics card.
|
||||||
|
|
||||||
There is a setup exe and a portable zip file download.
|
There is a setup exe and a portable zip file download.
|
||||||
|
|
||||||
|
An old version should be uninstalled before installing a new version,
|
||||||
|
it's generally not a good idea to install a new version on top of an old version,
|
||||||
|
the setup don't enforce it because it's not easy to implement.
|
||||||
|
|
||||||
For internet streaming youtube-dl must be downloaded and installed manually,
|
For internet streaming youtube-dl must be downloaded and installed manually,
|
||||||
meaning it must be located in the PATH environment variable or in the startup directory.
|
meaning it must be located in the PATH environment variable or in the startup directory.
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
public static class App
|
public static class App
|
||||||
{
|
{
|
||||||
|
public static List<string> TempFiles { get; } = new List<string>();
|
||||||
|
|
||||||
public static string ConfPath { get => Core.ConfigFolder + "mpvnet.conf"; }
|
public static string ConfPath { get => Core.ConfigFolder + "mpvnet.conf"; }
|
||||||
public static string ProcessInstance { get; set; } = "single";
|
public static string ProcessInstance { get; set; } = "single";
|
||||||
public static string DarkMode { get; set; } = "always";
|
public static string DarkMode { get; set; } = "always";
|
||||||
@@ -164,6 +166,9 @@ namespace mpvnet
|
|||||||
Settings.Mute = Core.get_property_string("mute");
|
Settings.Mute = Core.get_property_string("mute");
|
||||||
|
|
||||||
SettingsManager.Save(Settings);
|
SettingsManager.Save(Settings);
|
||||||
|
|
||||||
|
foreach (string file in TempFiles)
|
||||||
|
FileHelp.Delete(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Dictionary<string, string> _Conf;
|
static Dictionary<string, string> _Conf;
|
||||||
|
|||||||
@@ -8,15 +8,13 @@ using System.Windows.Forms;
|
|||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
using VB = Microsoft.VisualBasic;
|
|
||||||
|
|
||||||
using static mpvnet.Global;
|
using static mpvnet.Global;
|
||||||
|
|
||||||
namespace mpvnet
|
namespace mpvnet
|
||||||
{
|
{
|
||||||
public class Commands
|
public class Commands
|
||||||
{
|
{
|
||||||
public static void Execute(string id, string[] args = null)
|
public static void Execute(string id, string[] args)
|
||||||
{
|
{
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
@@ -44,8 +42,9 @@ namespace mpvnet
|
|||||||
case "show-info": ShowInfo(); break;
|
case "show-info": ShowInfo(); break;
|
||||||
case "show-input-editor": ShowDialog(typeof(InputWindow)); break;
|
case "show-input-editor": ShowDialog(typeof(InputWindow)); break;
|
||||||
case "show-keys": ShowTextWithEditor("input-key-list", Core.get_property_string("input-key-list").Replace(",", BR)); break;
|
case "show-keys": ShowTextWithEditor("input-key-list", Core.get_property_string("input-key-list").Replace(",", BR)); break;
|
||||||
|
case "show-media-info": ShowMediaInfo(args); break;
|
||||||
case "show-media-search": ShowDialog(typeof(EverythingWindow)); break;
|
case "show-media-search": ShowDialog(typeof(EverythingWindow)); break;
|
||||||
case "show-playlist": ShowPlaylist(); break;
|
case "show-playlist": ShowPlaylist(args); break;
|
||||||
case "show-profiles": ShowTextWithEditor("profile-list", mpvHelp.GetProfiles()); break;
|
case "show-profiles": ShowTextWithEditor("profile-list", mpvHelp.GetProfiles()); break;
|
||||||
case "show-properties": ShowProperties(); break;
|
case "show-properties": ShowProperties(); break;
|
||||||
case "show-protocols": ShowTextWithEditor("protocol-list", mpvHelp.GetProtocols()); break;
|
case "show-protocols": ShowTextWithEditor("protocol-list", mpvHelp.GetProtocols()); break;
|
||||||
@@ -54,7 +53,7 @@ namespace mpvnet
|
|||||||
case "update-check": UpdateCheck.CheckOnline(true); break;
|
case "update-check": UpdateCheck.CheckOnline(true); break;
|
||||||
case "window-scale": WindowScale(float.Parse(args[0], CultureInfo.InvariantCulture)); break;
|
case "window-scale": WindowScale(float.Parse(args[0], CultureInfo.InvariantCulture)); break;
|
||||||
|
|
||||||
default: Msg.ShowError($"No command '{id}' found."); break;
|
default: App.ShowError($"No command '{id}' found."); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,7 +337,8 @@ namespace mpvnet
|
|||||||
|
|
||||||
public static void ShowTextWithEditor(string name, string text)
|
public static void ShowTextWithEditor(string name, string text)
|
||||||
{
|
{
|
||||||
string file = Path.GetTempPath() + $"\\{name}.txt";
|
string file = Path.Combine(Path.GetTempPath(), name + ".txt");
|
||||||
|
App.TempFiles.Add(file);
|
||||||
File.WriteAllText(file, BR + text.Trim() + BR);
|
File.WriteAllText(file, BR + text.Trim() + BR);
|
||||||
ProcessHelp.ShellExecute(file);
|
ProcessHelp.ShellExecute(file);
|
||||||
}
|
}
|
||||||
@@ -362,12 +362,12 @@ namespace mpvnet
|
|||||||
"}${osd-ass-cc/1}" + text + "\" " + duration);
|
"}${osd-ass-cc/1}" + text + "\" " + duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ShowPlaylist(string[] args = null)
|
public static void ShowPlaylist(string[] args)
|
||||||
{
|
{
|
||||||
int duration = 5000;
|
int duration = 5000;
|
||||||
|
|
||||||
if (args?.Length == 1)
|
if (args.Length == 1 && int.TryParse(args[0], out int result))
|
||||||
duration = Convert.ToInt32(args[0]);
|
duration = result;
|
||||||
|
|
||||||
var size = Core.get_property_number("osd-font-size");
|
var size = Core.get_property_number("osd-font-size");
|
||||||
Core.set_property_number("osd-font-size", 40);
|
Core.set_property_number("osd-font-size", 40);
|
||||||
@@ -378,5 +378,21 @@ namespace mpvnet
|
|||||||
Core.set_property_number("osd-font-size", size);
|
Core.set_property_number("osd-font-size", size);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ShowMediaInfo(string[] args)
|
||||||
|
{
|
||||||
|
string path = Core.GetPropertyString("path");
|
||||||
|
|
||||||
|
if (File.Exists(path))
|
||||||
|
{
|
||||||
|
using (MediaInfo mediaInfo = new MediaInfo(path))
|
||||||
|
{
|
||||||
|
bool full = args.Contains("full");
|
||||||
|
bool raw = args.Contains("raw");
|
||||||
|
string text = mediaInfo.GetSummary(full, raw);
|
||||||
|
ShowTextWithEditor(Path.GetFileName(path), text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -762,6 +762,11 @@ namespace mpvnet
|
|||||||
HandleError(err, throwException, $"error setting property: {name} = {value}");
|
HandleError(err, throwException, $"error setting property: {name} = {value}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetPropertyString(string name, bool throwException = false)
|
||||||
|
{
|
||||||
|
return get_property_string(name, throwException);
|
||||||
|
}
|
||||||
|
|
||||||
public string get_property_string(string name, bool throwException = false)
|
public string get_property_string(string name, bool throwException = false)
|
||||||
{
|
{
|
||||||
mpv_error err = mpv_get_property(Handle, GetUtf8Bytes(name),
|
mpv_error err = mpv_get_property(Handle, GetUtf8Bytes(name),
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
@@ -11,6 +12,19 @@ using static mpvnet.Global;
|
|||||||
|
|
||||||
namespace mpvnet
|
namespace mpvnet
|
||||||
{
|
{
|
||||||
|
public static class FileHelp
|
||||||
|
{
|
||||||
|
public static void Delete(string path)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (File.Exists(path))
|
||||||
|
File.Delete(path);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Terminal.WriteError("Failed to delete file:" + BR + path + BR + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class ProcessHelp
|
public static class ProcessHelp
|
||||||
{
|
{
|
||||||
public static void Execute(string file, string arguments = null)
|
public static void Execute(string file, string arguments = null)
|
||||||
|
|||||||
@@ -41,6 +41,13 @@ public class MediaInfo : IDisposable
|
|||||||
stream, parameter, MediaInfoKind.Text, MediaInfoKind.Name));
|
stream, parameter, MediaInfoKind.Text, MediaInfoKind.Name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetSummary(bool complete, bool rawView)
|
||||||
|
{
|
||||||
|
MediaInfo_Option(Handle, "Language", rawView ? "raw" : "");
|
||||||
|
MediaInfo_Option(Handle, "Complete", complete ? "1" : "0");
|
||||||
|
return Marshal.PtrToStringUni(MediaInfo_Inform(Handle, 0)) ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
bool Disposed;
|
bool Disposed;
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|||||||
@@ -141,10 +141,10 @@
|
|||||||
Alt+3 script-message mpv.net window-scale 3.0 #menu: View > Zoom > 300 %
|
Alt+3 script-message mpv.net window-scale 3.0 #menu: View > Zoom > 300 %
|
||||||
b cycle border #menu: View > Toggle Border
|
b cycle border #menu: View > Toggle Border
|
||||||
i script-message mpv.net show-info #menu: View > File/Stream Info
|
i script-message mpv.net show-info #menu: View > File/Stream Info
|
||||||
t script-binding stats/display-stats #menu: View > Show Statistics
|
|
||||||
T script-binding stats/display-stats-toggle #menu: View > Toggle Statistics
|
|
||||||
Del script-binding osc/visibility #menu: View > Toggle OSC Visibility
|
Del script-binding osc/visibility #menu: View > Toggle OSC Visibility
|
||||||
Ctrl+r cycle-values video-rotate 90 180 270 0 #menu: View > Rotate Video
|
Ctrl+r cycle-values video-rotate 90 180 270 0 #menu: View > Rotate Video
|
||||||
|
T script-binding stats/display-stats-toggle #menu: View > Toggle Statistics
|
||||||
|
t script-binding stats/display-stats #menu: View > Show Statistics
|
||||||
_ script-message mpv.net show-audio-devices #menu: View > Show Audio Devices
|
_ script-message mpv.net show-audio-devices #menu: View > Show Audio Devices
|
||||||
Shift+c script-message mpv.net show-commands #menu: View > Show Commands
|
Shift+c script-message mpv.net show-commands #menu: View > Show Commands
|
||||||
` script-binding console/enable #menu: View > Show Console
|
` script-binding console/enable #menu: View > Show Console
|
||||||
@@ -157,6 +157,7 @@
|
|||||||
Shift+p script-message mpv.net show-properties #menu: View > Show Properties
|
Shift+p script-message mpv.net show-properties #menu: View > Show Properties
|
||||||
_ script-message mpv.net show-protocols #menu: View > Show Protocols
|
_ script-message mpv.net show-protocols #menu: View > Show Protocols
|
||||||
F9 show-text ${track-list} 5000 #menu: View > Show Tracks
|
F9 show-text ${track-list} 5000 #menu: View > Show Tracks
|
||||||
|
Ctrl+m script-message mpv.net show-media-info #menu: View > Show Media Info
|
||||||
|
|
||||||
c script-message mpv.net show-conf-editor #menu: Settings > Show Config Editor
|
c script-message mpv.net show-conf-editor #menu: Settings > Show Config Editor
|
||||||
Ctrl+i script-message mpv.net show-input-editor #menu: Settings > Show Input Editor
|
Ctrl+i script-message mpv.net show-input-editor #menu: Settings > Show Input Editor
|
||||||
|
|||||||
@@ -77,8 +77,5 @@ class Script
|
|||||||
Dic[path] = rating;
|
Dic[path] = rating;
|
||||||
Core.commandv("show-text", "Rating: " + rating);
|
Core.commandv("show-text", "Rating: " + rating);
|
||||||
}
|
}
|
||||||
else if (args[1] == "about")
|
|
||||||
MessageBox.Show("This extension writes a rating to the filename of rated videos when mpv.net shuts down.",
|
|
||||||
"Rating Extension");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user