Native messaging host for ff2mpv written in Rust
Find a file
Markus Pettersson ef7e431779 Clean up config.rs
Some refactoring to `config.rs` with the aim to:

* Increase type safety
* Reduce duplication
* Leverage `std::result::Result` & `std::path::PathBuf` APIs

To achieve these goals, the following was done:

* `get_config_file` propagates an `FF2MpvError` if the config file doesn't exist/is invalid
* Always type check `unix` & `windows` code by using `cfg!` expressions over
`#[cfg()]` attributes. This also removed some duplicated lines of code
* Move `#[serde(default)]` to `Config` struct instead of every struct
member: https://serde.rs/container-attrs.html#default
2023-10-29 20:04:15 +01:00
src Clean up config.rs 2023-10-29 20:04:15 +01:00
.gitignore Add Cargo.lock. Fixes #4 2023-09-04 23:10:55 +03:00
Cargo.lock Add Cargo.lock. Fixes #4 2023-09-04 23:10:55 +03:00
Cargo.toml Version 1.1.0 2023-03-14 21:27:50 +03:00
ff2mpv-rust.json Added example configuration file 2023-03-14 21:22:54 +03:00
LICENSE Initial commit 2023-02-13 21:14:26 +03:00
README.md Update README 2023-03-14 21:25:10 +03:00

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:

  1. $XDG_CONFIG_HOME/ff2mpv-rust.json
  2. $HOME/.config/ff2mpv-rust.json
  3. /etc/ff2mpv-rust.json

On Windows configuration file should be placed at: %APPDATA%/ff2mpv-rust.json.

See example configuration.

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