Fully implemented flag overriding and player specification in players.hpp, fixed bugs and updated README

This commit is contained in:
Baldomo
2021-01-24 18:44:12 +01:00
parent 93f7bc29f3
commit 1bf066ec7c
5 changed files with 107 additions and 22 deletions

View File

@@ -1,8 +1,14 @@
# open-in-mpv
<h1 align="center">open-in-mpv</h1>
This is a simple web extension (for Chrome and Firefox) which helps open any video in the currently open tab in the [mpv player](https://mpv.io).
The extension itself shares a lot of code with the one from the awesome [iina](https://github.com/iina/iina), while the (bare) backend is written in C++20 (this is a rewrite from Rust).
- [Installation](#installation)
- [The `mpv://` protocol](#the-mpv-protocol)
- [Playlist and `enqueue` functionality](#playlist-and-enqueue-functionality)
- [Player support](#player-support)
## Installation
> Compiled binaries and packed extensions can be found in the [releases page](https://github.com/Baldomo/open-in-mpv/releases).
@@ -15,7 +21,13 @@ sudo make install
### The `mpv://` protocol
`open-in-mpv install-protocol` will create a custom `xdg-open` desktop file with a scheme handler for the `mpv://` protocol. This lets `xdg-open` call `open-in-mpv` with an encoded URI, so that it can be parsed and the information can be relayed to `mpv` - this logic follows how `iina` parses and opens custom URIs with the `iina://` protocol on Mac. `install-protocol.sh` has the same functionality.
The table below is a simple documentation of the URL query keys and values used to let the `open-in-mpv` executable what to do:
Please note that this specification is enforced quite strictly, as the program will error out when:
- The protocol is not `mpv://`
- The method/path is not `/open`
- The query is empty
The table below is a simple documentation of the URL query keys and values used to let the `open-in-mpv` executable what to do.
| Key | Example value | Description |
|---------------|----------------------------------------|---------------|
@@ -24,7 +36,7 @@ The table below is a simple documentation of the URL query keys and values used
| `pip` | `1` | Simulates a picture-in-picture mode (only works with mpv for now) |
| `enqueue` | `1` | Adds a video to the queue (see below) |
| `new_window` | `1` | Forcibly starts a video in a new window even if one is already open |
| `player` | `celluloid` | Starts any arbitrary video player (only mpv-based ones are recommended, such as [Celluloid](https://celluloid-player.github.io/)) |
| `player` | `celluloid` | Starts any supported video player (see [Player support](#player-support)) |
| `flags` | `--vo%3Dgpu` | Custom command options and flags to be passed to the video player, URL-encoded |
### Playlist and `enqueue` functionality
@@ -32,4 +44,7 @@ For `enqueue` to work properly with any mpv-based player (provided it supports m
```conf
input-ipc-server=/tmp/mpvsocket
```
```
### Player support
Supported players are defined in `src/players.hpp`, where the struct `player` defines supported functionality and command line flag overrides. To request support for a player you're welcome to open a new issue or a pull request.