1
1
use std:: env;
2
2
use std:: io;
3
3
use std:: process;
4
- use serde_json:: { self , json} ;
4
+
5
+ use serde_json:: json;
5
6
6
7
use crate :: browser;
7
8
use crate :: config:: Config ;
@@ -12,18 +13,17 @@ pub enum Command {
12
13
ShowManifest ,
13
14
ShowManifestChromium ,
14
15
ValidateConfig ,
15
- FF2Mpv
16
+ FF2Mpv ,
16
17
}
17
18
18
-
19
19
impl Command {
20
20
pub fn execute ( & self ) -> Result < ( ) , FF2MpvError > {
21
21
match self {
22
22
Command :: ShowHelp => Self :: show_help ( ) ,
23
23
Command :: ShowManifest => Self :: show_manifest ( false ) ,
24
24
Command :: ShowManifestChromium => Self :: show_manifest ( true ) ,
25
25
Command :: ValidateConfig => Self :: validate_config ( ) ,
26
- Command :: FF2Mpv => Self :: ff2mpv ( )
26
+ Command :: FF2Mpv => Self :: ff2mpv ( ) ,
27
27
}
28
28
}
29
29
@@ -43,7 +43,10 @@ impl Command {
43
43
fn show_manifest ( chromium : bool ) -> Result < ( ) , FF2MpvError > {
44
44
let executable_path = env:: current_exe ( ) ?;
45
45
let allowed_keyvalue = if chromium {
46
- ( "allowed_origins" , "chrome-extension://ephjcajbkgplkjmelpglennepbpmdpjg" )
46
+ (
47
+ "allowed_origins" ,
48
+ "chrome-extension://ephjcajbkgplkjmelpglennepbpmdpjg" ,
49
+ )
47
50
} else {
48
51
( "allowed_extensions" , "[email protected] " )
49
52
} ;
@@ -72,7 +75,11 @@ impl Command {
72
75
fn ff2mpv ( ) -> Result < ( ) , FF2MpvError > {
73
76
let config = Config :: build ( ) ;
74
77
let ff2mpv_message = browser:: get_mpv_message ( ) ?;
75
- Command :: launch_mpv ( config. player_command , config. player_args , & ff2mpv_message. url ) ?;
78
+ Command :: launch_mpv (
79
+ config. player_command ,
80
+ config. player_args ,
81
+ & ff2mpv_message. url ,
82
+ ) ?;
76
83
browser:: send_reply ( ) ?;
77
84
78
85
Ok ( ( ) )
0 commit comments