50485e7c3a
Since `Result` implements `Termination` (https://doc.rust-lang.org/std/process/trait.Termination.html), the result of `Command::execute` can be returned from `main` directly. If an `FF2MpvError` error would be propagated to `main`, it will be printed using `eprintln` just as before, and the program will terminate with an appropriate exit code: https://doc.rust-lang.org/std/process/struct.ExitCode.html#associatedconstant.FAILURE The only caveat is that `FF2MpvError` has to implement `Debug`, but instead of deriving it I cheated a bit and re-used the existing `Display` implementation to preserve the format of the error messages. |
||
---|---|---|
src | ||
.gitignore | ||
Cargo.lock | ||
Cargo.toml | ||
ff2mpv-rust.json | ||
LICENSE | ||
README.md |
ff2mpv-rust
Native messaging host for ff2mpv written in Rust.
This is a native compiled binary, so it runs much faster and doesn't require external dependencies by itself, unlike Python and Ruby scripts.
What is this?
This is a script for hooking mpv and ff2mpv, that allows opening any video link in mpv straight from the browser.
Installation
First, install ff2mpv extension from AMO or Chrome Store.
After that get native messasing host manifest:
ff2mpv-rust manifest
Install it following manual installation instructions on ff2mpv wiki.
Configuration
On Linux configuration file is searched in such order:
- $XDG_CONFIG_HOME/ff2mpv-rust.json
- $HOME/.config/ff2mpv-rust.json
- /etc/ff2mpv-rust.json
On Windows configuration file should be placed at: %APPDATA%/ff2mpv-rust.json.
Command line interface
ff2mpv-rust provides command line interface with following commands:
help: prints help message
manifest: prints manifest for browser configuration
validate: checks configration file for validity
Note that it won't fail on invalid commands, but instead assume it is called from browser, blocking the input.
Contributing
All issues and pull requests are welcome! Feel free to open an issue if you've got an idea or a problem. You can open a pull request if you are able to implement it yourself.
Made with ponies and love!
GNU GPL © Ryze 2023