Respect options passed by ff2mpv extension #12
|
@ -8,6 +8,7 @@ use crate::error::FF2MpvError;
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct FF2MpvMessage {
|
pub struct FF2MpvMessage {
|
||||||
pub url: String,
|
pub url: String,
|
||||||
|
pub options: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_reply() -> Result<(), io::Error> {
|
pub fn send_reply() -> Result<(), io::Error> {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
|
|||||||
|
use serde_json::{self, json};
|
||||||
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
|
|||||||
use std::env;
|
use std::env;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::process;
|
use std::process;
|
||||||
use serde_json::{self, json};
|
|
||||||
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
|
|||||||
|
|
||||||
use crate::browser;
|
use crate::browser;
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
|
@ -12,10 +12,9 @@ pub enum Command {
|
||||||
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
|
|||||||
ShowManifest,
|
ShowManifest,
|
||||||
ShowManifestChromium,
|
ShowManifestChromium,
|
||||||
ValidateConfig,
|
ValidateConfig,
|
||||||
FF2Mpv
|
FF2Mpv,
|
||||||
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
|
|||||||
impl Command {
|
impl Command {
|
||||||
pub fn execute(&self) -> Result<(), FF2MpvError> {
|
pub fn execute(&self) -> Result<(), FF2MpvError> {
|
||||||
match self {
|
match self {
|
||||||
|
@ -23,7 +22,7 @@ impl Command {
|
||||||
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
|
|||||||
Command::ShowManifest => Self::show_manifest(false),
|
Command::ShowManifest => Self::show_manifest(false),
|
||||||
Command::ShowManifestChromium => Self::show_manifest(true),
|
Command::ShowManifestChromium => Self::show_manifest(true),
|
||||||
Command::ValidateConfig => Self::validate_config(),
|
Command::ValidateConfig => Self::validate_config(),
|
||||||
Command::FF2Mpv => Self::ff2mpv()
|
Command::FF2Mpv => Self::ff2mpv(),
|
||||||
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +42,10 @@ impl Command {
|
||||||
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
|
|||||||
fn show_manifest(chromium: bool) -> Result<(), FF2MpvError> {
|
fn show_manifest(chromium: bool) -> Result<(), FF2MpvError> {
|
||||||
let executable_path = env::current_exe()?;
|
let executable_path = env::current_exe()?;
|
||||||
let allowed_keyvalue = if chromium {
|
let allowed_keyvalue = if chromium {
|
||||||
("allowed_origins", "chrome-extension://ephjcajbkgplkjmelpglennepbpmdpjg")
|
(
|
||||||
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
|
|||||||
|
"allowed_origins",
|
||||||
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
|
|||||||
|
"chrome-extension://ephjcajbkgplkjmelpglennepbpmdpjg",
|
||||||
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
|
|||||||
|
)
|
||||||
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
|
|||||||
} else {
|
} else {
|
||||||
("allowed_extensions", "ff2mpv@yossarian.net")
|
("allowed_extensions", "ff2mpv@yossarian.net")
|
||||||
};
|
};
|
||||||
|
@ -72,7 +74,8 @@ impl Command {
|
||||||
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
|
|||||||
fn ff2mpv() -> Result<(), FF2MpvError> {
|
fn ff2mpv() -> Result<(), FF2MpvError> {
|
||||||
let config = Config::build();
|
let config = Config::build();
|
||||||
let ff2mpv_message = browser::get_mpv_message()?;
|
let ff2mpv_message = browser::get_mpv_message()?;
|
||||||
Command::launch_mpv(config.player_command, config.player_args, &ff2mpv_message.url)?;
|
let args = [config.player_args, ff2mpv_message.options].concat();
|
||||||
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
|
|||||||
|
Command::launch_mpv(config.player_command, args, &ff2mpv_message.url)?;
|
||||||
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
|
|||||||
browser::send_reply()?;
|
browser::send_reply()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
||||||
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
Let's keep the order of imports as is, i.e:
Let's keep the order of imports as is, i.e:
1. `std`
2. External crates
3. Local crates
```suggestion
use std::env;
use std::io;
use std::process;
use serde_json::{self, json};
```
|
Let's keep the order of imports as is, i.e:
std