Finally added enqueue functionality to extension options, fixed flawed selector in options, modified main.cpp so enqueuing when mpv is closed open a new instance
This commit is contained in:
@@ -33,7 +33,7 @@ class Option {
|
||||
case "select":
|
||||
return document.querySelector(`select[name="${this.name}"]`).value;
|
||||
case "text":
|
||||
return document.querySelector(`select[name="${this.name}"]`).value;
|
||||
return document.querySelector(`input[name="${this.name}"]`).value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -41,6 +41,9 @@
|
||||
<div class="item">
|
||||
<label><input type="radio" name="iconActionOption" value="pip"> Enter Picture-in-Picture</label>
|
||||
</div>
|
||||
<div class="item">
|
||||
<label><input type="radio" name="iconActionOption" value="enqueue"> Add to queue</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="option">
|
||||
|
@@ -27,7 +27,7 @@
|
||||
<div class="menu-item" id="open-fullScreen">Open in mpv and enter full screen</div>
|
||||
<div class="menu-item" id="open-pip">Open in mpv and enter Picture-in-Picture</div>
|
||||
<div class="menu-item" id="open-newWindow">Open in a new mpv window</div>
|
||||
<div class="menu-item" id="open-enqueue">Add to mpv playlist</div>
|
||||
<div class="menu-item" id="open-enqueue">Add to queue (playlist)</div>
|
||||
</div>
|
||||
<script src="./popup.js" type="module"></script>
|
||||
</body>
|
||||
|
@@ -6,7 +6,9 @@ The extension itself is a copy of the one from the awesome [iina](https://github
|
||||
## Installation
|
||||
> Compiled binaries and packed extensions can be found in the [releases page](https://github.com/Baldomo/open-in-mpv/releases).
|
||||
|
||||
To install `open-in-mpv`, just run
|
||||
This project requires [`libcurl`](https://curl.se/libcurl/). Each distro has its own way of installing the library so I will leave that to your favourite web search engine.
|
||||
|
||||
To build and install `open-in-mpv`, just run
|
||||
```sh
|
||||
sudo make install
|
||||
```
|
||||
@@ -24,7 +26,7 @@ The table below is a simple documentation of the URL query keys and values used
|
||||
| `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` | :warning: WIP, starts any arbitrary video player (only mpv-based ones are recommended, such as [Celluloid](https://celluloid-player.github.io/)) |
|
||||
| `flags` | `--vo%3Dgpu` | Custom command options and flags to be passed to the video player |
|
||||
| `flags` | `--vo%3Dgpu` | Custom command options and flags to be passed to the video player, URL-encoded |
|
||||
|
||||
### Playlist and `enqueue` functionality
|
||||
For `enqueue` to work properly with any mpv-based player (provided it supports mpv's IPC), the player has to read commands from a socket. This can be achieved by adding the following line to the video player's configuration (usually `.conf/mpv/mpv.conf` for mpv).
|
||||
|
10
src/main.cpp
10
src/main.cpp
@@ -54,11 +54,13 @@ int main(int argc, char const *argv[]) {
|
||||
if (mo->needs_ipc()) {
|
||||
mpvipc *mipc = new mpvipc();
|
||||
bool success = mipc->send(mo->build_ipc());
|
||||
if (!success) {
|
||||
std::cout << "Error writing to mpv socket" << std::endl;
|
||||
return 1;
|
||||
if (success) {
|
||||
return 0;
|
||||
}
|
||||
} else std::system(mo->build_cmd().c_str());
|
||||
|
||||
std::cout << "Error writing to socket, opening new instance" << std::endl;
|
||||
}
|
||||
std::system(mo->build_cmd().c_str());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user