Skip to content

Commit

Permalink
Command line parser supports list options with -add suffix. Fixex #619
Browse files Browse the repository at this point in the history
.
  • Loading branch information
stax76 committed Dec 19, 2023
1 parent d328f6b commit ed48f5c
Show file tree
Hide file tree
Showing 14 changed files with 293 additions and 232 deletions.
12 changes: 9 additions & 3 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@

# v7.0.0.4 Beta (2023-??-??)

- Command line parser supports list options with `-add` suffix.
- Fix window sometimes shown with wrong size.
- Limited support for the mpv option `geometry`, it supports location in percent,
for size use `autofit`. Please read the instructions in the mpv.net manual or in the conf editor.
- Updated and improved manual.
for size use `autofit`. Read the instructions in the mpv.net manual or in the conf editor.
- Improved manual.
- Improved bindings.
- Conf editor reorganized according to options categories used in mpv manual.
- mpv.net is available via command line package manager winget.
- New libplacebo config editor options added.
- The conf editor uses a newly developed combo box control (dropdown menu)
instead of radio buttons whenever an option has more than 3 items.
instead of radio buttons whenever an option has more than 3 items,
this improves the look and feel, usability and performance.
The navigation tree view was improved.
- New zhongfly libmpv build.


Expand Down
19 changes: 13 additions & 6 deletions docs/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Table of contents
* [Hidden Features](#hidden-features)
* [Differences compared to mpv](#differences-compared-to-mpv)
* [Environment Variables](#environment-variables)
* [user-data](#user-data)
* [Context Menu Commands](#context-menu)


Expand Down Expand Up @@ -269,12 +270,6 @@ Shows available [mpv input commands](https://mpv.io/manual/master/#list-of-input
### show-conf-editor
Shows the conf editor.

### show-decoders
Shows available decoders.

### show-demuxers
Shows available demuxers.

### show-input-editor
Shows the input editor.

Expand Down Expand Up @@ -707,6 +702,18 @@ Environment Variables
Directory where mpv.net looks for user settings.


user-data
---------

Script authors can access the following
[user-data](https://mpv.io/manual/master/#command-interface-user-data) properties:

```
user-data/frontend/name
user-data/frontend/version
user-data/frontend/process-path
```

Context Menu Commands
---------------------

Expand Down
50 changes: 48 additions & 2 deletions src/MpvNet.Windows/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using MpvNet.Windows.UI;
using MpvNet.Windows.Help;
using MpvNet.Windows.WPF;
using System.Diagnostics;

namespace MpvNet.Windows;

Expand Down Expand Up @@ -97,10 +96,13 @@ static void Main()
return;
}

if (App.CommandLine.Contains("--o="))
if (ProcessCommandLineArguments())
Environment.GetCommandLineArgs();
else if (App.CommandLine.Contains("--o="))
{
App.AutoLoadFolder = false;
Player.Init(IntPtr.Zero);
Player.ProcessCommandLineArgsPost();
Player.ProcessCommandLineFiles();
Player.SetPropertyString("idle", "no");
Player.EventLoop();
Expand All @@ -119,4 +121,48 @@ static void Main()
Terminal.WriteError(ex);
}
}

static bool ProcessCommandLineArguments()
{
foreach (string arg in Environment.GetCommandLineArgs().Skip(1))
{
if (arg == "--profile=help")
{
Player.Init(IntPtr.Zero, false);
Console.WriteLine(Player.GetProfiles());
Player.Destroy();
return true;
}
else if (arg == "--vd=help" || arg == "--ad=help")
{
Player.Init(IntPtr.Zero, false);
Console.WriteLine(Player.GetDecoders());
Player.Destroy();
return true;
}
else if (arg == "--audio-device=help")
{
Player.Init(IntPtr.Zero, false);
Console.WriteLine(Player.GetPropertyOsdString("audio-device-list"));
Player.Destroy();
return true;
}
else if (arg == "--input-keylist")
{
Player.Init(IntPtr.Zero, false);
Console.WriteLine(Player.GetPropertyString("input-key-list").Replace(",", BR));
Player.Destroy();
return true;
}
else if (arg == "--version")
{
Player.Init(IntPtr.Zero, false);
Console.WriteLine(AppClass.About);
Player.Destroy();
return true;
}
}

return false;
}
}
Loading

0 comments on commit ed48f5c

Please sign in to comment.