Compare commits

...

29 Commits

Author SHA1 Message Date
stax76
7f680829ef update changelog 2022-07-30 13:05:30 +02:00
stax76
603f956261 update changelog 2022-07-30 12:55:32 +02:00
stax76
6d06df9004 6.0.3.1 2022-07-30 12:52:19 +02:00
stax76
5ea086d05b Support --audio-file and --sub-file aliases 2022-07-30 11:45:07 +02:00
stax76
1ad819fa9d Fix external audio tracks not shown correctly in tracks context menu 2022-07-30 11:26:45 +02:00
stax76
f2dd6205b5 Merge branch 'master' of https://github.com/stax76/mpv.net 2022-07-27 09:42:02 +02:00
stax76
b2a3c231ff command line syntax is supported in mpv.conf 2022-07-27 09:42:00 +02:00
stax76
f6c223a411 Update issue templates 2022-07-25 09:51:28 +02:00
stax76
e7a2ba6805 Update issue templates 2022-07-25 09:43:58 +02:00
stax76
5a08d9ccd6 Shift key enables process-instance=multi 2022-07-23 08:50:07 +02:00
stax76
5714a5e62a Merge branch 'master' of https://github.com/stax76/mpv.net 2022-07-17 08:04:43 +02:00
stax76
def7e5ac5a misc 2022-07-17 08:04:32 +02:00
stax76
601bb20492 Update FUNDING.yml 2022-07-14 04:31:20 +02:00
stax76
59600df977 update manual 2022-07-13 09:02:51 +02:00
stax76
e1b9730e9b use mpv.net to cycle subtitles 2022-07-12 05:49:05 +02:00
stax76
e378551938 misc 2022-07-11 13:14:26 +02:00
stax76
a82b2ef571 disable unused mpv events 2022-07-11 07:05:50 +02:00
stax76
6157a01701 disable unused mpv events 2022-07-11 06:57:10 +02:00
stax76
ec17ae8ce9 support shortcuts with media file target 2022-07-11 06:14:01 +02:00
stax76
f719528017 fix #293 2022-07-10 10:30:01 +02:00
stax76
966b45eb65 shorten annoying media info titles 2022-07-10 00:49:56 +02:00
stax76
eeae6994a2 remove basic view and enhance advanced view of show-info command 2022-07-09 17:26:49 +02:00
stax76
07809d882f use mpvnet instead of mpv to create playlist from folder 2022-07-08 12:20:36 +02:00
stax76
e970f0b4e4 libmpv shinchiro 2022-07-02 2022-07-08 05:51:06 +02:00
stax76
a36b6a3fdf misc 2022-07-04 08:45:37 +02:00
stax76
4febca257f properly fix OSC hide behavior 2022-07-04 08:32:53 +02:00
stax76
9d493b4d08 store package update 2022-07-03 10:49:13 +02:00
stax76
9a6bf5a481 v6.0.3.0 update changelog 2022-07-03 10:35:39 +02:00
stax76
40565e8b3d fix possible race condition 2022-07-02 15:10:22 +02:00
19 changed files with 401 additions and 127 deletions

1
.github/FUNDING.yml vendored
View File

@@ -1,3 +1,2 @@
github: stax76 github: stax76
patreon: stax76
ko_fi: stax76 ko_fi: stax76

View File

@@ -8,3 +8,33 @@ assignees: stax76
--- ---
This template is meant for usage questions of mpv.net. This template is meant for usage questions of mpv.net.
Some type of questions like questions about a problem require filling out an issue template:
**Describe the problem**
A clear and concise description of what the problem is.
**To Reproduce**
To reproduce, try the last beta version using the CLI option `--config=no`.
In case of an audio or video problem, try to reproduce the problem using mpv instead of mpv.net.
If it can be reproduced with mpv, use the [mpv issue tracker](https://github.com/mpv-player/mpv/issues).
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.
1. mpv.net version
2. Windows version
3. GPU name
4. Media info

View File

@@ -11,6 +11,11 @@ assignees: stax76
A clear and concise description of what the bug is. A clear and concise description of what the bug is.
**To Reproduce** **To Reproduce**
To reproduce, try the last beta version using the CLI option `--config=no`.
In case of an audio or video issue, try to reproduce the issue using mpv instead of mpv.net.
If it can be reproduced with mpv, use the [mpv issue tracker](https://github.com/mpv-player/mpv/issues).
Steps to reproduce the behavior: Steps to reproduce the behavior:
1. Go to '...' 1. Go to '...'
2. Click on '....' 2. Click on '....'
@@ -25,3 +30,7 @@ If applicable, add screenshots to help explain your problem.
**Additional context** **Additional context**
Add any other context about the problem here. Add any other context about the problem here.
1. mpv.net version
2. Windows version
3. GPU name
4. Media info

View File

@@ -16,10 +16,6 @@ mpv focuses on the usage of the command line and the terminal,
mpv.net retains the ability to be used from the command line and mpv.net retains the ability to be used from the command line and
the terminal and adds a modern Windows GUI on top of it. the terminal and adds a modern Windows GUI on top of it.
Like mpv, mpv.net is designed for power users, for regular users there is a
[mpv.net-next](https://github.com/mpv-net-player/mpv.net-next)
project under construction.
#### Graphical User Interface #### Graphical User Interface
Modern GUI with customizable color themes. Modern GUI with customizable color themes.

View File

@@ -1,4 +1,35 @@
# 6.0.3.1 (2022-07-30)
- Creating a playlist from a folder uses absolute normalized paths, non-media files are ignored.
- The show-info command shows directly an advanced view, which was enhanced with a General section and the filename.
- Media info titles are shortened if they contain duplicated or obvious information.
- Support of shortcuts (.lnk files) with media file target.
- Support --audio-file and --sub-file aliases.
- playlist-random command jumps to a random playlist entry, default key binding is F9.
- Fix OSC hide behavior on mouse move.
- Fix external audio tracks not shown correctly in tracks context menu.
- New binding (e key) to show the current file in File Explorer.
- Shift key enables `process-instance=multi`.
- Command line syntax (preceding double hyphen) is supported in mpv.conf for options implemented by mpv.net.
- MediaInfo v22.06
- libmpv shinchiro 2022-07-30
input.conf changes:
New:
```
e run powershell -command "explorer.exe '/select,' ( \"${path}\" -replace '/', '\\' )" #menu: Tools > Show current file in File Explorer
F9 script-message-to mpvnet playlist-random #menu: Navigate > Random File
```
# 6.0.3.0 (2022-07-03)
- Fix the rare occasion of duplicated playlist entries produced by the auto-load-folder feature.
# 6.0.2.0 (2022-07-02) # 6.0.2.0 (2022-07-02)
- Fix main window shown collapsed when the player was started with full screen. - Fix main window shown collapsed when the player was started with full screen.

View File

@@ -42,9 +42,7 @@ mpv focuses on the usage of the command line and the terminal,
mpv.net retains the ability to be used from the command line and mpv.net retains the ability to be used from the command line and
the terminal and adds a modern Windows GUI on top of it. the terminal and adds a modern Windows GUI on top of it.
Like mpv, mpv.net is designed for power users, for regular users there is a Like mpv, mpv.net is designed for power users.
[mpv.net-next](https://github.com/mpv-net-player/mpv.net-next)
project under construction.
Download Download
@@ -90,12 +88,21 @@ the files are opened in mpv.net in random order, this works with maximum 15 file
Support Support
------- -------
Before making a support request, please try the newest version first. Before making a support request, please try the newest [beta version](../../../releases) first.
Bugs and feature requests can be made on the github [issue tracker](../../../issues), Support can be requested here:
feel free to use for anything mpv.net related, usage questions are welcome.
Or use the [support thread](https://forum.videohelp.com/threads/392514-mpv-net-a-extendable-media-player-for-windows) in the VideoHelp forum. Beginner questions:
https://www.reddit.com/r/mpv
mpv.net bug reports, feature requests and advanced questions:
https://github.com/stax76/mpv.net/issues
Advanced mpv questions:
https://github.com/mpv-player/mpv/issues
Settings Settings
@@ -270,6 +277,9 @@ already the first entry, nothing happens.
Jumps to the last playlist entry, if the loaded file is Jumps to the last playlist entry, if the loaded file is
already the last entry, nothing happens. already the last entry, nothing happens.
### playlist-random
Jumps to a random playlist entry.
### quick-bookmark ### quick-bookmark
On the first press a bookmark is saved, on the second On the first press a bookmark is saved, on the second
@@ -320,9 +330,6 @@ Shows available demuxers.
Shows the history file when existing. Shows the history file when existing.
### show-info
Shows media info on screen, a second key press shows more detailed media info.
### show-input-editor ### show-input-editor
Shows the input editor. Shows the input editor.
@@ -475,10 +482,12 @@ playback automatically resumes.
Defines if more then one mpv.net process is allowed. Defines if more then one mpv.net process is allowed.
Tip: Whenever the CTRL key is pressed when files or URLs are opened, Whenever the CTRL key is pressed when files or URLs are opened,
the playlist is not cleared but the files or URLs are appended to the playlist. the playlist is not cleared but the files or URLs are appended to the playlist.
This not only works on process startup but in all mpv.net features that open files and URLs. This not only works on process startup but in all mpv.net features that open files and URLs.
Multi can alternatively be enabled by pressing the SHIFT key.
**multi** **multi**
Create a new process everytime the shell starts mpv.net. Create a new process everytime the shell starts mpv.net.
@@ -572,31 +581,6 @@ Alternatively the Chrome/Firefox extension [Open With](../../../issues/119) can
[Open with++](https://github.com/stax76/OpenWithPlusPlus) can be used to extend the File Explorer context menu to get menu items for [Play with mpv.net](https://github.com/stax76/OpenWithPlusPlus#play-with-mpvnet) and [Add to mpv.net playlist](https://github.com/stax76/OpenWithPlusPlus#add-to-mpvnet-playlist). [Open with++](https://github.com/stax76/OpenWithPlusPlus) can be used to extend the File Explorer context menu to get menu items for [Play with mpv.net](https://github.com/stax76/OpenWithPlusPlus#play-with-mpvnet) and [Add to mpv.net playlist](https://github.com/stax76/OpenWithPlusPlus#add-to-mpvnet-playlist).
### Universal Remote Android app
Universal Remote is Android remote control app which costs 5 €.
https://www.unifiedremote.com
https://play.google.com/store/apps/details?id=com.Relmtech.Remote
https://play.google.com/store/apps/details?id=com.Relmtech.RemotePaid
https://www.unifiedremote.com/tutorials/how-to-create-a-custom-keyboard-shortcuts-remote
https://www.unifiedremote.com/tutorials/how-to-install-a-custom-remote
[My config](./Universal%20Remote)
Very useful is the Universal Remote File Browser feature.
### One For All Contour URC1210 and FLIRC USB
My primary remote control solution however is a One For All Contour URC1210
using Philips code 0556 together with FLIRC USB (gen2).
### External Application Button ### External Application Button
Videos can be streamed or downloaded easily with the Chrome extension Videos can be streamed or downloaded easily with the Chrome extension
@@ -1241,7 +1225,7 @@ Adds a negative audio delay using the following command:
Shows the next subtitle track using the following command: Shows the next subtitle track using the following command:
`cycle sub` `script-message-to mpvnet cycle-subtitles`
[cycle command](https://mpv.io/manual/master/#command-interface-cycle-%3Cname%3E-[%3Cvalue%3E]) [cycle command](https://mpv.io/manual/master/#command-interface-cycle-%3Cname%3E-[%3Cvalue%3E])

View File

@@ -24,20 +24,19 @@ namespace mpvnet
{ {
switch (id) switch (id)
{ {
case "add-files-to-playlist": OpenFiles("append"); break; // deprecated 2019
case "cycle-audio": CycleAudio(); break; case "cycle-audio": CycleAudio(); break;
case "execute-mpv-command": Msg.ShowError("The command was removed, reset input.conf by deleting it, in the new menu use the on screen console."); break; // deprecated 2020 case "cycle-subtitles": CycleSubtitles(); break;
case "load-audio": LoadAudio(); break; case "load-audio": LoadAudio(); break;
case "load-sub": LoadSubtitle(); break; case "load-sub": LoadSubtitle(); break;
case "open-clipboard": OpenFromClipboard(); break; case "open-clipboard": OpenFromClipboard(); break;
case "open-conf-folder": ProcessHelp.ShellExecute(Core.ConfigFolder); break; case "open-conf-folder": ProcessHelp.ShellExecute(Core.ConfigFolder); break;
case "open-files": OpenFiles(args); break; case "open-files": OpenFiles(args); break;
case "open-optical-media": Open_DVD_Or_BD_Folder(); break; case "open-optical-media": Open_DVD_Or_BD_Folder(); break;
case "open-url": OpenFromClipboard(); break; // deprecated 2022
case "play-pause": PlayPause(); break; case "play-pause": PlayPause(); break;
case "playlist-add": PlaylistAdd(Convert.ToInt32(args[0])); break; case "playlist-add": PlaylistAdd(Convert.ToInt32(args[0])); break;
case "playlist-first": PlaylistFirst(); break; case "playlist-first": PlaylistFirst(); break;
case "playlist-last": PlaylistLast(); break; case "playlist-last": PlaylistLast(); break;
case "playlist-random": PlaylistRandom(); break;
case "quick-bookmark": QuickBookmark(); break; case "quick-bookmark": QuickBookmark(); break;
case "reg-file-assoc": RegisterFileAssociations(args[0]); break; case "reg-file-assoc": RegisterFileAssociations(args[0]); break;
case "scale-window": ScaleWindow(float.Parse(args[0], CultureInfo.InvariantCulture)); break; case "scale-window": ScaleWindow(float.Parse(args[0], CultureInfo.InvariantCulture)); break;
@@ -64,10 +63,20 @@ namespace mpvnet
case "show-properties": ShowProperties(); break; case "show-properties": ShowProperties(); break;
case "show-protocols": ShowStrings(mpvHelp.GetProtocols().Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)); break; case "show-protocols": ShowStrings(mpvHelp.GetProtocols().Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)); break;
case "show-recent": ShowRecent(); break; case "show-recent": ShowRecent(); break;
case "show-setup-dialog": ShowSetupDialog(); break; // deprecated 2022
case "show-subtitle-tracks": ShowSubtitleTracks(); break; case "show-subtitle-tracks": ShowSubtitleTracks(); break;
case "show-text": ShowText(args[0], Convert.ToInt32(args[1]), Convert.ToInt32(args[2])); break; case "show-text": ShowText(args[0], Convert.ToInt32(args[1]), Convert.ToInt32(args[2])); break;
case "window-scale": WindowScale(float.Parse(args[0], CultureInfo.InvariantCulture)); break; case "window-scale": WindowScale(float.Parse(args[0], CultureInfo.InvariantCulture)); break;
// deprecated 2019
case "add-files-to-playlist": OpenFiles("append"); break;
// deprecated 2020
case "execute-mpv-command": Msg.ShowError("command was removed, reset input.conf by deleting it, in the new menu use the on screen console."); break;
case "key-binding": if (args[0] == "show-playlist") ShowPlaylist(); break;
// deprecated 2022
case "show-setup-dialog": ShowSetupDialog(); break;
case "open-url": OpenFromClipboard(); break;
} }
} }
@@ -155,30 +164,17 @@ namespace mpvnet
} }
} }
static int LastShowInfo;
public static void ShowInfo() public static void ShowInfo()
{ {
if (Core.PlaylistPos == -1) if (Core.PlaylistPos == -1)
return; return;
if (Environment.TickCount - LastShowInfo < 5000)
{
Core.Command("script-message-to mpvnet show-media-info osd");
LastShowInfo = 0;
return;
}
LastShowInfo = Environment.TickCount;
string text; string text;
long fileSize = 0; long fileSize = 0;
string path = Core.GetPropertyString("path"); string path = Core.GetPropertyString("path");
if (File.Exists(path)) if (File.Exists(path))
{ {
fileSize = new FileInfo(path).Length;
if (CorePlayer.AudioTypes.Contains(path.Ext())) if (CorePlayer.AudioTypes.Contains(path.Ext()))
{ {
text = Core.GetPropertyOsdString("filtered-metadata"); text = Core.GetPropertyOsdString("filtered-metadata");
@@ -187,6 +183,7 @@ namespace mpvnet
} }
else if (CorePlayer.ImageTypes.Contains(path.Ext())) else if (CorePlayer.ImageTypes.Contains(path.Ext()))
{ {
fileSize = new FileInfo(path).Length;
text = "Width: " + Core.GetPropertyInt("width") + "\n" + text = "Width: " + Core.GetPropertyInt("width") + "\n" +
"Height: " + Core.GetPropertyInt("height") + "\n" + "Height: " + Core.GetPropertyInt("height") + "\n" +
"Size: " + Convert.ToInt32(fileSize / 1024.0) + " KB\n" + "Size: " + Convert.ToInt32(fileSize / 1024.0) + " KB\n" +
@@ -195,6 +192,11 @@ namespace mpvnet
Core.CommandV("show-text", text, "5000"); Core.CommandV("show-text", text, "5000");
return; return;
} }
else
{
Core.Command("script-message-to mpvnet show-media-info osd");
return;
}
} }
if (path.Contains("://")) path = Core.GetPropertyString("media-title"); if (path.Contains("://")) path = Core.GetPropertyString("media-title");
@@ -308,13 +310,44 @@ namespace mpvnet
if (++aid > tracks.Length) if (++aid > tracks.Length)
aid = 1; aid = 1;
Core.CommandV("set", "aid", aid.ToString()); Core.SetPropertyInt("aid", aid);
} }
Core.CommandV("show-text", aid + "/" + tracks.Length + ": " + tracks[aid - 1].Text.Substring(3), "5000"); Core.CommandV("show-text", aid + "/" + tracks.Length + ": " + tracks[aid - 1].Text.Substring(3), "5000");
} }
} }
public static void CycleSubtitles()
{
Core.UpdateExternalTracks();
lock (Core.MediaTracksLock)
{
MediaTrack[] tracks = Core.MediaTracks.Where(track => track.Type == "s").ToArray();
if (tracks.Length < 1)
{
Core.CommandV("show-text", "No subtitles");
return;
}
int sid = Core.GetPropertyInt("sid");
if (tracks.Length > 1)
{
if (++sid > tracks.Length)
sid = 0;
Core.SetPropertyInt("sid", sid);
}
if (sid == 0)
Core.CommandV("show-text", "No subtitle");
else
Core.CommandV("show-text", sid + "/" + tracks.Length + ": " + tracks[sid - 1].Text.Substring(3), "5000");
}
}
public static void ShowCommands() public static void ShowCommands()
{ {
string jsonString = Core.GetPropertyString("command-list"); string jsonString = Core.GetPropertyString("command-list");
@@ -391,6 +424,7 @@ namespace mpvnet
else else
{ {
Core.UpdateExternalTracks(); Core.UpdateExternalTracks();
text = "N: " + Core.GetPropertyString("filename") + BR;
lock (Core.MediaTracksLock) lock (Core.MediaTracksLock)
foreach (MediaTrack track in Core.MediaTracks) foreach (MediaTrack track in Core.MediaTracks)
text += track.Text + BR; text += track.Text + BR;
@@ -518,6 +552,9 @@ namespace mpvnet
Action = () => Core.SetPropertyInt("playlist-pos", index) Action = () => Core.SetPropertyInt("playlist-pos", index)
}; };
if (string.IsNullOrEmpty(item.Text))
item.Text = file;
items.Add(item); items.Add(item);
if (currentPath.ToLowerEx() == file.ToLowerEx()) if (currentPath.ToLowerEx() == file.ToLowerEx())
@@ -701,6 +738,12 @@ namespace mpvnet
Core.SetPropertyInt("playlist-pos", pos); Core.SetPropertyInt("playlist-pos", pos);
} }
public static void PlaylistRandom()
{
int count = Core.GetPropertyInt("playlist-count");
Core.SetPropertyInt("playlist-pos", new Random().Next(count));
}
public static void QuickBookmark() public static void QuickBookmark()
{ {
if (App.QuickBookmark == 0) if (App.QuickBookmark == 0)

View File

@@ -7,7 +7,7 @@ public static class TestStringExtension
{ {
public static bool ContainsEx(this string instance, string value) public static bool ContainsEx(this string instance, string value)
{ {
if (instance != null && value != null) if (!string.IsNullOrEmpty(instance) && !string.IsNullOrEmpty(value))
return instance.Contains(value); return instance.Contains(value);
return false; return false;
@@ -47,6 +47,8 @@ public static class ConvertToStringExtension
return instance.Trim(); return instance.Trim();
} }
public static string ToStringEx(this object instance) => instance?.ToString() ?? "";
} }
public static class ConvertStringExtension public static class ConvertStringExtension

View File

@@ -118,6 +118,11 @@ namespace mpvnet
Handle = mpv_create(); Handle = mpv_create();
var events = Enum.GetValues(typeof(mpv_event_id)).Cast<mpv_event_id>();
foreach (mpv_event_id i in events)
mpv_request_event(Handle, i, 0);
mpv_request_log_messages(Handle, "no"); mpv_request_log_messages(Handle, "no");
App.RunTask(() => MainEventLoop()); App.RunTask(() => MainEventLoop());
@@ -373,6 +378,9 @@ namespace mpvnet
string key = i.Substring(0, i.IndexOf("=")).Trim(); string key = i.Substring(0, i.IndexOf("=")).Trim();
string value = i.Substring(i.IndexOf("=") + 1).Trim(); string value = i.Substring(i.IndexOf("=") + 1).Trim();
if (key.StartsWith("-"))
key = key.TrimStart('-');
if (value.Contains("#") && !value.StartsWith("#") && if (value.Contains("#") && !value.StartsWith("#") &&
!value.StartsWith("'#") && !value.StartsWith("\"#")) !value.StartsWith("'#") && !value.StartsWith("\"#"))
@@ -1124,11 +1132,13 @@ namespace mpvnet
string left = arg.Substring(2, arg.IndexOf("=") - 2); string left = arg.Substring(2, arg.IndexOf("=") - 2);
string right = arg.Substring(left.Length + 3); string right = arg.Substring(left.Length + 3);
if (left == "script") switch (left)
left = "scripts"; {
case "script": left = "scripts"; break;
if (left == "external-file") case "audio-file": left = "audio-files"; break;
left = "external-files"; case "sub-file": left = "sub-files"; break;
case "external-file": left = "external-files"; break;
}
if (preInit && preInitProperties.Contains(left)) if (preInit && preInitProperties.Contains(left))
{ {
@@ -1194,22 +1204,39 @@ namespace mpvnet
{ {
string file = files[i]; string file = files[i];
if (string.IsNullOrEmpty(file))
continue;
if (file.Contains("|")) if (file.Contains("|"))
file = file.Substring(0, file.IndexOf("|")); file = file.Substring(0, file.IndexOf("|"));
if (file.Ext() == "avs") string ext = file.Ext();
LoadAviSynth();
if (file.Ext() == "iso") switch (ext)
LoadISO(file);
else if(SubtitleTypes.Contains(file.Ext()))
CommandV("sub-add", file);
else if (file.Ext().Length != 3 && File.Exists(System.IO.Path.Combine(file, "BDMV\\index.bdmv")))
{ {
Command("stop"); case "avs": LoadAviSynth(); break;
Thread.Sleep(500); case "lnk": file = GetShortcutTarget(file); break;
SetPropertyString("bluray-device", file); }
CommandV("loadfile", @"bd://");
if (ext == "iso")
LoadISO(file);
else if(SubtitleTypes.Contains(ext))
CommandV("sub-add", file);
else if (ext == "" && !file.Contains("://") && Directory.Exists(file))
{
if (File.Exists(System.IO.Path.Combine(file, "BDMV\\index.bdmv")))
{
Command("stop");
Thread.Sleep(500);
SetPropertyString("bluray-device", file);
CommandV("loadfile", @"bd://");
}
else
{
files = GetMediaFiles(Directory.GetFiles(file, "*.*", SearchOption.AllDirectories)).ToArray();
LoadFiles(files, loadFolder, append);
return;
}
} }
else else
{ {
@@ -1276,41 +1303,48 @@ namespace mpvnet
} }
} }
static object LoadFolderLockObject = new object();
public void LoadFolder() public void LoadFolder()
{ {
if (!App.AutoLoadFolder || Control.ModifierKeys.HasFlag(Keys.Shift)) if (!App.AutoLoadFolder || Control.ModifierKeys.HasFlag(Keys.Shift))
return; return;
Thread.Sleep(1000); Thread.Sleep(1000);
string path = GetPropertyString("path");
if (!File.Exists(path) || GetPropertyInt("playlist-count") != 1) lock (LoadFolderLockObject)
return; {
string path = GetPropertyString("path");
string dir = Environment.CurrentDirectory; if (!File.Exists(path) || GetPropertyInt("playlist-count") != 1)
return;
if (path.Contains(":/") && !path.Contains("://")) string dir = Environment.CurrentDirectory;
path = path.Replace("/", "\\");
if (path.Contains("\\")) if (path.Contains(":/") && !path.Contains("://"))
dir = System.IO.Path.GetDirectoryName(path); path = path.Replace("/", "\\");
List<string> files = Directory.GetFiles(dir).ToList(); if (path.Contains("\\"))
dir = System.IO.Path.GetDirectoryName(path);
files = files.Where(file => List<string> files = GetMediaFiles(Directory.GetFiles(dir)).ToList();
VideoTypes.Contains(file.Ext()) || files.Sort(new StringLogicalComparer());
AudioTypes.Contains(file.Ext()) || int index = files.IndexOf(path);
ImageTypes.Contains(file.Ext())).ToList(); files.Remove(path);
files.Sort(new StringLogicalComparer()); foreach (string i in files)
int index = files.IndexOf(path); CommandV("loadfile", i, "append");
files.Remove(path);
foreach (string i in files) if (index > 0)
CommandV("loadfile", i, "append"); CommandV("playlist-move", "0", (index + 1).ToString());
}
}
if (index > 0) IEnumerable<string> GetMediaFiles(IEnumerable<string> files)
CommandV("playlist-move", "0", (index + 1).ToString()); {
return files.Where(i => VideoTypes.Contains(i.Ext()) ||
AudioTypes.Contains(i.Ext()) ||
ImageTypes.Contains(i.Ext()));
} }
bool WasAviSynthLoaded; bool WasAviSynthLoaded;
@@ -1431,6 +1465,22 @@ namespace mpvnet
} }
} }
string GetNativeLanguage(string name)
{
foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
if (ci.EnglishName == name)
return ci.NativeName;
return name;
}
public static string GetShortcutTarget(string path)
{
Type t = Type.GetTypeFromProgID("WScript.Shell");
dynamic sh = Activator.CreateInstance(t);
return sh.CreateShortcut(path).TargetPath;
}
public void RaiseScaleWindow(float value) => ScaleWindow(value); public void RaiseScaleWindow(float value) => ScaleWindow(value);
public void RaiseWindowScaleNET(float value) => WindowScaleNET(value); public void RaiseWindowScaleNET(float value) => WindowScaleNET(value);
@@ -1476,12 +1526,13 @@ namespace mpvnet
public void UpdateExternalTracks() public void UpdateExternalTracks()
{ {
int trackCount = GetPropertyInt("track-list/count"); int trackListTrackCount = GetPropertyInt("track-list/count");
int editionCount = GetPropertyInt("edition-list/count"); int editionCount = GetPropertyInt("edition-list/count");
int count = MediaTracks.Where(i => i.Type != "g").Count();
lock (MediaTracksLock) lock (MediaTracksLock)
{ {
if (MediaTracks.Count != (trackCount + editionCount)) if (count != (trackListTrackCount + editionCount))
{ {
MediaTracks = MediaTracks.Where(i => !i.External).ToList(); MediaTracks = MediaTracks.Where(i => !i.External).ToList();
MediaTracks.AddRange(GetTracks(false)); MediaTracks.AddRange(GetTracks(false));
@@ -1599,6 +1650,15 @@ namespace mpvnet
using (MediaInfo mi = new MediaInfo(path)) using (MediaInfo mi = new MediaInfo(path))
{ {
MediaTrack track = new MediaTrack();
Add(track, mi.GetGeneral("Format"));
Add(track, mi.GetGeneral("FileSize/String"));
Add(track, mi.GetGeneral("Duration/String"));
Add(track, mi.GetGeneral("OverallBitRate/String"));
track.Text = "G: " + track.Text.Trim(' ', ',');
track.Type = "g";
tracks.Add(track);
int videoCount = mi.GetCount(MediaInfoStreamKind.Video); int videoCount = mi.GetCount(MediaInfoStreamKind.Video);
for (int i = 0; i < videoCount; i++) for (int i = 0; i < videoCount; i++)
@@ -1608,14 +1668,12 @@ namespace mpvnet
if (float.TryParse(fps, NumberStyles.Float, CultureInfo.InvariantCulture, out float result)) if (float.TryParse(fps, NumberStyles.Float, CultureInfo.InvariantCulture, out float result))
fps = result.ToString(CultureInfo.InvariantCulture); fps = result.ToString(CultureInfo.InvariantCulture);
MediaTrack track = new MediaTrack(); track = new MediaTrack();
Add(track, mi.GetVideo(i, "Format")); Add(track, mi.GetVideo(i, "Format"));
Add(track, mi.GetVideo(i, "Format_Profile")); Add(track, mi.GetVideo(i, "Format_Profile"));
Add(track, mi.GetVideo(i, "Width") + "x" + mi.GetVideo(i, "Height")); Add(track, mi.GetVideo(i, "Width") + "x" + mi.GetVideo(i, "Height"));
Add(track, mi.GetVideo(i, "BitRate/String")); Add(track, mi.GetVideo(i, "BitRate/String"));
Add(track, fps + " FPS"); Add(track, fps + " FPS");
Add(track, mi.GetVideo(i, "Language/String"));
Add(track, mi.GetVideo(i, "Forced") == "Yes" ? "Forced" : "");
Add(track, (videoCount > 1 && mi.GetVideo(i, "Default") == "Yes") ? "Default" : ""); Add(track, (videoCount > 1 && mi.GetVideo(i, "Default") == "Yes") ? "Default" : "");
Add(track, mi.GetVideo(i, "Title")); Add(track, mi.GetVideo(i, "Title"));
track.Text = "V: " + track.Text.Trim(' ', ','); track.Text = "V: " + track.Text.Trim(' ', ',');
@@ -1628,16 +1686,80 @@ namespace mpvnet
for (int i = 0; i < audioCount; i++) for (int i = 0; i < audioCount; i++)
{ {
MediaTrack track = new MediaTrack(); string lang = mi.GetAudio(i, "Language/String");
Add(track, mi.GetAudio(i, "Language/String")); string nativeLang = GetNativeLanguage(lang);
Add(track, mi.GetAudio(i, "Format")); string title = mi.GetAudio(i, "Title");
string format = mi.GetAudio(i, "Format");
if (!string.IsNullOrEmpty(title))
{
if (title.ContainsEx("DTS-HD MA"))
format = "DTS-MA";
if (title.ContainsEx("DTS-HD MA"))
title = title.Replace("DTS-HD MA", "");
if (title.ContainsEx("Blu-ray"))
title = title.Replace("Blu-ray", "");
if (title.ContainsEx("UHD "))
title = title.Replace("UHD ", "");
if (title.ContainsEx("EAC"))
title = title.Replace("EAC", "E-AC");
if (title.ContainsEx("AC3"))
title = title.Replace("AC3", "AC-3");
if (title.ContainsEx(lang))
title = title.Replace(lang, "").Trim();
if (title.ContainsEx(nativeLang))
title = title.Replace(nativeLang, "").Trim();
if (title.ContainsEx("Surround"))
title = title.Replace("Surround", "");
if (title.ContainsEx("Dolby Digital"))
title = title.Replace("Dolby Digital", "");
if (title.ContainsEx("Stereo"))
title = title.Replace("Stereo", "");
if (title.StartsWith(format + " "))
title = title.Replace(format + " ", "");
foreach (string i2 in new [] { "2.0", "5.1", "6.1", "7.1" })
if (title.ContainsEx(i2))
title = title.Replace(i2, "");
if (title.ContainsEx("()"))
title = title.Replace("()", "");
if (title.ContainsEx("[]"))
title = title.Replace("[]", "");
if (title.TrimEx() == format)
title = null;
}
track = new MediaTrack();
Add(track, lang);
Add(track, format);
Add(track, mi.GetAudio(i, "Format_Profile")); Add(track, mi.GetAudio(i, "Format_Profile"));
Add(track, mi.GetAudio(i, "BitRate/String")); Add(track, mi.GetAudio(i, "BitRate/String"));
Add(track, mi.GetAudio(i, "Channel(s)") + " ch"); Add(track, mi.GetAudio(i, "Channel(s)") + " ch");
Add(track, mi.GetAudio(i, "SamplingRate/String")); Add(track, mi.GetAudio(i, "SamplingRate/String"));
Add(track, mi.GetAudio(i, "Forced") == "Yes" ? "Forced" : ""); Add(track, mi.GetAudio(i, "Forced") == "Yes" ? "Forced" : "");
Add(track, (audioCount > 1 && mi.GetAudio(i, "Default") == "Yes") ? "Default" : ""); Add(track, (audioCount > 1 && mi.GetAudio(i, "Default") == "Yes") ? "Default" : "");
Add(track, mi.GetAudio(i, "Title")); Add(track, title);
if (track.Text.Contains("MPEG Audio, Layer 2"))
track.Text = track.Text.Replace("MPEG Audio, Layer 2", "MP2");
if (track.Text.Contains("MPEG Audio, Layer 3"))
track.Text = track.Text.Replace("MPEG Audio, Layer 2", "MP3");
track.Text = "A: " + track.Text.Trim(' ', ','); track.Text = "A: " + track.Text.Trim(' ', ',');
track.Type = "a"; track.Type = "a";
track.ID = i + 1; track.ID = i + 1;
@@ -1649,6 +1771,7 @@ namespace mpvnet
for (int i = 0; i < subCount; i++) for (int i = 0; i < subCount; i++)
{ {
string codec = mi.GetText(i, "Format").ToUpperEx(); string codec = mi.GetText(i, "Format").ToUpperEx();
if (codec == "UTF-8") if (codec == "UTF-8")
codec = "SRT"; codec = "SRT";
else if (codec == "WEBVTT") else if (codec == "WEBVTT")
@@ -1656,13 +1779,57 @@ namespace mpvnet
else if (codec == "VOBSUB") else if (codec == "VOBSUB")
codec = "VOB"; codec = "VOB";
MediaTrack track = new MediaTrack(); string lang = mi.GetText(i, "Language/String");
Add(track, mi.GetText(i, "Language/String")); string nativeLang = GetNativeLanguage(lang);
string title = mi.GetText(i, "Title");
bool forced = mi.GetText(i, "Forced") == "Yes";
if (!string.IsNullOrEmpty(title))
{
if (title.ContainsEx("VobSub"))
title = title.Replace("VobSub", "VOB");
if (title.ContainsEx(codec))
title = title.Replace(codec, "");
if (title.ContainsEx(lang.ToLowerEx()))
title = title.Replace(lang.ToLowerEx(), lang);
if (title.ContainsEx(nativeLang.ToLowerEx()))
title = title.Replace(nativeLang.ToLowerEx(), nativeLang).Trim();
if (title.ContainsEx(lang))
title = title.Replace(lang, "");
if (title.ContainsEx(nativeLang))
title = title.Replace(nativeLang, "").Trim();
if (title.ContainsEx("full"))
title = title.Replace("full", "").Trim();
if (title.ContainsEx("Full"))
title = title.Replace("Full", "").Trim();
if (title.ContainsEx("forced"))
title = title.Replace("forced", "Forced").Trim();
if (forced && title.ContainsEx("Forced"))
title = title.Replace("Forced", "").Trim();
if (title.ContainsEx("()"))
title = title.Replace("()", "");
if (title.ContainsEx("[]"))
title = title.Replace("[]", "");
}
track = new MediaTrack();
Add(track, lang);
Add(track, codec); Add(track, codec);
Add(track, mi.GetText(i, "Format_Profile")); Add(track, mi.GetText(i, "Format_Profile"));
Add(track, mi.GetText(i, "Forced") == "Yes" ? "Forced" : ""); Add(track, forced ? "Forced" : "");
Add(track, (subCount > 1 && mi.GetText(i, "Default") == "Yes") ? "Default" : ""); Add(track, (subCount > 1 && mi.GetText(i, "Default") == "Yes") ? "Default" : "");
Add(track, mi.GetText(i, "Title")); Add(track, title);
track.Text = "S: " + track.Text.Trim(' ', ','); track.Text = "S: " + track.Text.Trim(' ', ',');
track.Type = "s"; track.Type = "s";
track.ID = i + 1; track.ID = i + 1;
@@ -1689,8 +1856,10 @@ namespace mpvnet
void Add(MediaTrack track, object value) void Add(MediaTrack track, object value)
{ {
if (value != null && !(track.Text != null && track.Text.Contains(value.ToString()))) string str = value.ToStringEx().Trim();
track.Text += " " + value + ",";
if (str != "" && !(track.Text != null && track.Text.Contains(str)))
track.Text += " " + str + ",";
} }
private string[] _ProfileNames; private string[] _ProfileNames;

View File

@@ -32,6 +32,9 @@ namespace mpvnet
App.Init(); App.Init();
Mutex mutex = new Mutex(true, StringHelp.GetMD5Hash(App.ConfPath), out bool isFirst); Mutex mutex = new Mutex(true, StringHelp.GetMD5Hash(App.ConfPath), out bool isFirst);
if (Control.ModifierKeys.HasFlag(Keys.Shift))
App.ProcessInstance = "multi";
if ((App.ProcessInstance == "single" || App.ProcessInstance == "queue") && !isFirst) if ((App.ProcessInstance == "single" || App.ProcessInstance == "queue") && !isFirst)
{ {
List<string> args2 = new List<string>(); List<string> args2 = new List<string>();

View File

@@ -23,7 +23,6 @@ namespace mpvnet
public Size WindowSize; public Size WindowSize;
public string ConfigEditorSearch = "Video:"; public string ConfigEditorSearch = "Video:";
public string Mute = "no"; public string Mute = "no";
public string UpdateCheckVersion = "";
} }
class SettingsManager class SettingsManager

View File

@@ -23,6 +23,12 @@ public class MediaInfo : IDisposable
public int GetCount(MediaInfoStreamKind kind) => MediaInfo_Count_Get(Handle, kind, -1); public int GetCount(MediaInfoStreamKind kind) => MediaInfo_Count_Get(Handle, kind, -1);
public string GetGeneral(string parameter)
{
return Marshal.PtrToStringUni(MediaInfo_Get(Handle, MediaInfoStreamKind.General,
0, parameter, MediaInfoKind.Text, MediaInfoKind.Name));
}
public string GetVideo(int stream, string parameter) public string GetVideo(int stream, string parameter)
{ {
return Marshal.PtrToStringUni(MediaInfo_Get(Handle, MediaInfoStreamKind.Video, return Marshal.PtrToStringUni(MediaInfo_Get(Handle, MediaInfoStreamKind.Video,

View File

@@ -65,6 +65,9 @@ public class libmpv
[DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr mpv_wait_event(IntPtr mpvHandle, double timeout); public static extern IntPtr mpv_wait_event(IntPtr mpvHandle, double timeout);
[DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern mpv_error mpv_request_event(IntPtr mpvHandle, mpv_event_id id, int enable);
public enum mpv_error public enum mpv_error
{ {
MPV_ERROR_SUCCESS = 0, MPV_ERROR_SUCCESS = 0,

View File

@@ -11,7 +11,7 @@
<Identity <Identity
Name="5664FrankSkare.mpv.net" Name="5664FrankSkare.mpv.net"
Publisher="CN=6A1A1E69-736C-4C77-B310-7B6D38E32617" Publisher="CN=6A1A1E69-736C-4C77-B310-7B6D38E32617"
Version="5.7.0.0" /> Version="6.0.3.0" />
<Properties> <Properties>
<DisplayName>mpv.net</DisplayName> <DisplayName>mpv.net</DisplayName>

View File

@@ -27,7 +27,7 @@
<GenerateAppInstallerFile>False</GenerateAppInstallerFile> <GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision> <AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<GenerateTestArtifacts>True</GenerateTestArtifacts> <GenerateTestArtifacts>True</GenerateTestArtifacts>
<AppxBundlePlatforms>neutral</AppxBundlePlatforms> <AppxBundlePlatforms>x64</AppxBundlePlatforms>
<GenerateTemporaryStoreCertificate>True</GenerateTemporaryStoreCertificate> <GenerateTemporaryStoreCertificate>True</GenerateTemporaryStoreCertificate>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks> <HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
</PropertyGroup> </PropertyGroup>

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.0.2.0")] [assembly: AssemblyVersion("6.0.3.1")]
[assembly: AssemblyFileVersion("6.0.2.0")] [assembly: AssemblyFileVersion("6.0.3.1")]

View File

@@ -24,6 +24,8 @@ _ ignore #menu: Navigate > -
Home script-message-to mpvnet playlist-first #menu: Navigate > First File Home script-message-to mpvnet playlist-first #menu: Navigate > First File
End script-message-to mpvnet playlist-last #menu: Navigate > Last File End script-message-to mpvnet playlist-last #menu: Navigate > Last File
_ ignore #menu: Navigate > - _ ignore #menu: Navigate > -
F9 script-message-to mpvnet playlist-random #menu: Navigate > Random File
_ ignore #menu: Navigate > -
PGUP add chapter 1 #menu: Navigate > Next Chapter PGUP add chapter 1 #menu: Navigate > Next Chapter
PGDWN add chapter -1 #menu: Navigate > Previous Chapter PGDWN add chapter -1 #menu: Navigate > Previous Chapter
_ ignore #menu: Navigate > - _ ignore #menu: Navigate > -
@@ -78,7 +80,7 @@ _ ignore #menu: Audio > -
Ctrl+d add audio-delay 0.1 #menu: Audio > Delay +0.1 Ctrl+d add audio-delay 0.1 #menu: Audio > Delay +0.1
Ctrl+D add audio-delay -0.1 #menu: Audio > Delay -0.1 Ctrl+D add audio-delay -0.1 #menu: Audio > Delay -0.1
KP8 cycle sub #menu: Subtitle > Cycle/Next KP8 script-message-to mpvnet cycle-subtitles #menu: Subtitle > Cycle/Next #menu: Subtitle > Cycle/Next
v cycle sub-visibility #menu: Subtitle > Toggle Visibility v cycle sub-visibility #menu: Subtitle > Toggle Visibility
_ ignore #menu: Subtitle > - _ ignore #menu: Subtitle > -
z add sub-delay -0.1 #menu: Subtitle > Delay -0.1 z add sub-delay -0.1 #menu: Subtitle > Delay -0.1
@@ -125,10 +127,9 @@ b cycle border #menu: View > Toggle Borde
Ctrl+t cycle ontop #menu: View > Toggle On Top Ctrl+t cycle ontop #menu: View > Toggle On Top
t script-binding stats/display-stats-toggle #menu: View > Toggle 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
i script-message-to mpvnet show-info #menu: View > Show File/Stream Info i script-message-to mpvnet show-info #menu: View > Show Media Info
Ctrl+m script-message-to mpvnet show-media-info #menu: View > Show Media Info Advanced
p show-progress #menu: View > Show Progress p show-progress #menu: View > Show Progress
F9 script-message-to mpvnet show-media-info osd #menu: View > Show Tracks
Ctrl+m script-message-to mpvnet show-media-info #menu: View > Show Media Info
Alt+r script-message-to mpvnet show-recent #menu: View > Show Recent Alt+r script-message-to mpvnet show-recent #menu: View > Show Recent
` script-binding console/enable #menu: View > Advanced > Show Console ` script-binding console/enable #menu: View > Advanced > Show Console
@@ -157,6 +158,7 @@ L cycle-values loop-file inf no #menu: Tools > Toggle infi
_ playlist-shuffle #menu: Tools > Shuffle Playlist _ playlist-shuffle #menu: Tools > Shuffle Playlist
Ctrl+h cycle-values hwdec auto no #menu: Tools > Toggle Hardware Decoding Ctrl+h cycle-values hwdec auto no #menu: Tools > Toggle Hardware Decoding
Q quit-watch-later #menu: Tools > Exit Watch Later Q quit-watch-later #menu: Tools > Exit Watch Later
e run powershell -command "explorer.exe '/select,' ( \"${path}\" -replace '/', '\\' )" #menu: Tools > Show current file in File Explorer
_ script-message-to mpvnet shell-execute https://mpv.io #menu: Help > Website mpv _ script-message-to mpvnet shell-execute https://mpv.io #menu: Help > Website mpv
_ script-message-to mpvnet shell-execute https://github.com/stax76/mpv.net #menu: Help > Website mpv.net _ script-message-to mpvnet shell-execute https://github.com/stax76/mpv.net #menu: Help > Website mpv.net
@@ -179,8 +181,8 @@ Sharp script-message-to mpvnet cycle-audio
Ctrl+F11 script-message-to mpvnet playlist-add -10 Ctrl+F11 script-message-to mpvnet playlist-add -10
Ctrl+F12 script-message-to mpvnet playlist-add 10 Ctrl+F12 script-message-to mpvnet playlist-add 10
Alt+q script-message-to mpvnet quick-bookmark Alt+q script-message-to mpvnet quick-bookmark
8 cycle sub 8 script-message-to mpvnet cycle-subtitles
j cycle sub j script-message-to mpvnet cycle-subtitles
q quit q quit
Power quit Power quit
Play cycle pause Play cycle pause

View File

@@ -860,6 +860,7 @@ namespace mpvnet
case 0x20b: // WM_XBUTTONDOWN case 0x20b: // WM_XBUTTONDOWN
case 0x20c: // WM_XBUTTONUP case 0x20c: // WM_XBUTTONUP
case 0x20e: // WM_MOUSEHWHEEL case 0x20e: // WM_MOUSEHWHEEL
case 0x2a3: // WM_MOUSELEAVE
if (mpvWindowHandle == IntPtr.Zero) if (mpvWindowHandle == IntPtr.Zero)
mpvWindowHandle = FindWindowEx(Handle, IntPtr.Zero, "mpv", null); mpvWindowHandle = FindWindowEx(Handle, IntPtr.Zero, "mpv", null);
@@ -894,10 +895,6 @@ namespace mpvnet
if (CursorHelp.IsPosDifferent(LastCursorPosition)) if (CursorHelp.IsPosDifferent(LastCursorPosition))
CursorHelp.Show(); CursorHelp.Show();
break; break;
case 0x2a3: // WM_MOUSELEAVE
//osc won't auto hide after mouse left window in borderless mode
Core.Command($"mouse {ClientSize.Width / 2} {ClientSize.Height / 3}");
break;
case 0x203: // WM_LBUTTONDBLCLK case 0x203: // WM_LBUTTONDBLCLK
{ {
Point pos = PointToClient(Cursor.Position); Point pos = PointToClient(Cursor.Position);

View File

@@ -69,6 +69,7 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" /> <Reference Include="Microsoft.VisualBasic" />
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />