Skip to content

Commit d37026d

Browse files
committed
opt: code format
1 parent 817d63a commit d37026d

File tree

23 files changed

+292
-235
lines changed

23 files changed

+292
-235
lines changed

src/app.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ use crate::{
5050
music_board::{draw_music_board, MusicController},
5151
radio::{draw_radio_list, RadioExplorer},
5252
EventType,
53-
}, util::m3u8::empty_cache,
53+
},
54+
util::m3u8::empty_cache,
5455
};
5556

5657
pub enum InputMode {
@@ -165,7 +166,7 @@ impl App {
165166
EventType::Radio => {
166167
let radio = &mut self.radio;
167168
radio.tick();
168-
},
169+
}
169170
}
170171
}
171172

src/config.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// Copyright (C) 2022 Kingtous
2-
//
2+
//
33
// This file is part of RustPlayer.
4-
//
4+
//
55
// RustPlayer is free software: you can redistribute it and/or modify
66
// it under the terms of the GNU General Public License as published by
77
// the Free Software Foundation, either version 3 of the License, or
88
// (at your option) any later version.
9-
//
9+
//
1010
// RustPlayer is distributed in the hope that it will be useful,
1111
// but WITHOUT ANY WARRANTY; without even the implied warranty of
1212
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1313
// GNU General Public License for more details.
14-
//
14+
//
1515
// You should have received a copy of the GNU General Public License
1616
// along with RustPlayer. If not, see <http://www.gnu.org/licenses/>.
1717

@@ -31,4 +31,4 @@ impl Config {
3131
home_page: "https://github.com/Kingtous",
3232
}
3333
}
34-
}
34+
}

src/handler/help.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// Copyright (C) 2022 Kingtous
2-
//
2+
//
33
// This file is part of RustPlayer.
4-
//
4+
//
55
// RustPlayer is free software: you can redistribute it and/or modify
66
// it under the terms of the GNU General Public License as published by
77
// the Free Software Foundation, either version 3 of the License, or
88
// (at your option) any later version.
9-
//
9+
//
1010
// RustPlayer is distributed in the hope that it will be useful,
1111
// but WITHOUT ANY WARRANTY; without even the implied warranty of
1212
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1313
// GNU General Public License for more details.
14-
//
14+
//
1515
// You should have received a copy of the GNU General Public License
1616
// along with RustPlayer. If not, see <http://www.gnu.org/licenses/>.
1717

@@ -31,6 +31,8 @@ pub fn handle_help(app: &mut App, code: KeyCode) -> bool {
3131
open::that(config_dir);
3232
return true;
3333
}
34-
_ => {return false;}
34+
_ => {
35+
return false;
36+
}
3537
}
36-
}
38+
}

src/handler/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ use crossterm::event::KeyCode;
2020
use crate::app::{ActiveModules, App, Routes};
2121

2222
use self::{
23-
fs::handle_fs, help::handle_help, music_controller::{handle_music_controller, handle_radio_controller},
24-
player::{handle_player, handle_radio}, radio::handle_radio_fs,
23+
fs::handle_fs,
24+
help::handle_help,
25+
music_controller::{handle_music_controller, handle_radio_controller},
26+
player::{handle_player, handle_radio},
27+
radio::handle_radio_fs,
2528
};
2629

2730
mod fs;
@@ -95,7 +98,7 @@ pub fn handle_keyboard_event(app: &mut App, key: KeyCode) {
9598
if flag {
9699
return;
97100
}
98-
flag = handle_radio(app, key);
101+
flag = handle_radio(app, key);
99102
if flag {
100103
return;
101104
}

src/handler/music_controller.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
// Copyright (C) 2022 Kingtous
2-
//
2+
//
33
// This file is part of RustPlayer.
4-
//
4+
//
55
// RustPlayer is free software: you can redistribute it and/or modify
66
// it under the terms of the GNU General Public License as published by
77
// the Free Software Foundation, either version 3 of the License, or
88
// (at your option) any later version.
9-
//
9+
//
1010
// RustPlayer is distributed in the hope that it will be useful,
1111
// but WITHOUT ANY WARRANTY; without even the implied warranty of
1212
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1313
// GNU General Public License for more details.
14-
//
14+
//
1515
// You should have received a copy of the GNU General Public License
1616
// along with RustPlayer. If not, see <http://www.gnu.org/licenses/>.
1717

1818
use std::cmp::max;
1919

2020
use crossterm::event::KeyCode;
2121

22-
use crate::{app::{ActiveModules, App}, media::player::Player};
22+
use crate::{
23+
app::{ActiveModules, App},
24+
media::player::Player,
25+
};
2326

2427
pub fn handle_music_controller(app: &mut App, code: KeyCode) -> bool {
2528
// if app.active_modules != ActiveModules::MusicController {
@@ -39,7 +42,9 @@ pub fn handle_music_controller(app: &mut App, code: KeyCode) -> bool {
3942
player.next();
4043
return true;
4144
}
42-
_ => {return false;}
45+
_ => {
46+
return false;
47+
}
4348
}
4449
}
4550

@@ -57,6 +62,8 @@ pub fn handle_radio_controller(app: &mut App, code: KeyCode) -> bool {
5762
}
5863
return true;
5964
}
60-
_ => {return false;}
65+
_ => {
66+
return false;
67+
}
6168
}
62-
}
69+
}

src/handler/player.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// Copyright (C) 2022 Kingtous
2-
//
2+
//
33
// This file is part of RustPlayer.
4-
//
4+
//
55
// RustPlayer is free software: you can redistribute it and/or modify
66
// it under the terms of the GNU General Public License as published by
77
// the Free Software Foundation, either version 3 of the License, or
88
// (at your option) any later version.
9-
//
9+
//
1010
// RustPlayer is distributed in the hope that it will be useful,
1111
// but WITHOUT ANY WARRANTY; without even the implied warranty of
1212
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1313
// GNU General Public License for more details.
14-
//
14+
//
1515
// You should have received a copy of the GNU General Public License
1616
// along with RustPlayer. If not, see <http://www.gnu.org/licenses/>.
1717

@@ -35,7 +35,9 @@ pub fn handle_player(app: &mut App, code: KeyCode) -> bool {
3535
app.player.set_volume(new_volume);
3636
return true;
3737
}
38-
_ => {return false;}
38+
_ => {
39+
return false;
40+
}
3941
}
4042
}
4143

@@ -53,6 +55,8 @@ pub fn handle_radio(app: &mut App, code: KeyCode) -> bool {
5355
app.radio.set_volume(new_volume);
5456
return true;
5557
}
56-
_ => {return false;}
58+
_ => {
59+
return false;
60+
}
5761
}
58-
}
62+
}

src/main.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// Copyright (C) 2022 Kingtous
2-
//
2+
//
33
// This file is part of RustPlayer.
4-
//
4+
//
55
// RustPlayer is free software: you can redistribute it and/or modify
66
// it under the terms of the GNU General Public License as published by
77
// the Free Software Foundation, either version 3 of the License, or
88
// (at your option) any later version.
9-
//
9+
//
1010
// RustPlayer is distributed in the hope that it will be useful,
1111
// but WITHOUT ANY WARRANTY; without even the implied warranty of
1212
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1313
// GNU General Public License for more details.
14-
//
14+
//
1515
// You should have received a copy of the GNU General Public License
1616
// along with RustPlayer. If not, see <http://www.gnu.org/licenses/>.
1717

@@ -22,18 +22,18 @@ use ui::*;
2222
use util::*;
2323

2424
mod app;
25-
mod ui;
25+
mod config;
2626
mod handler;
2727
mod media;
28-
mod config;
28+
mod ui;
2929
mod util;
3030

3131
fn main() {
3232
let mut app = App::new().unwrap();
3333
match app.run() {
34-
Ok(_) => {},
34+
Ok(_) => {}
3535
Err(e) => {
36-
println!("{:?}",e);
37-
},
36+
println!("{:?}", e);
37+
}
3838
}
39-
}
39+
}

src/media/media.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
// Copyright (C) 2022 Kingtous
2-
//
2+
//
33
// This file is part of RustPlayer.
4-
//
4+
//
55
// RustPlayer is free software: you can redistribute it and/or modify
66
// it under the terms of the GNU General Public License as published by
77
// the Free Software Foundation, either version 3 of the License, or
88
// (at your option) any later version.
9-
//
9+
//
1010
// RustPlayer is distributed in the hope that it will be useful,
1111
// but WITHOUT ANY WARRANTY; without even the implied warranty of
1212
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1313
// GNU General Public License for more details.
14-
//
14+
//
1515
// You should have received a copy of the GNU General Public License
1616
// along with RustPlayer. If not, see <http://www.gnu.org/licenses/>.
1717

1818
use crate::ui::radio::RadioConfig;
1919

20-
2120
pub enum Source {
2221
Http(String),
2322
M3u8(RadioConfig),
@@ -26,4 +25,4 @@ pub enum Source {
2625

2726
pub struct Media {
2827
pub src: Source,
29-
}
28+
}

src/media/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
// Copyright (C) 2022 Kingtous
2-
//
2+
//
33
// This file is part of RustPlayer.
4-
//
4+
//
55
// RustPlayer is free software: you can redistribute it and/or modify
66
// it under the terms of the GNU General Public License as published by
77
// the Free Software Foundation, either version 3 of the License, or
88
// (at your option) any later version.
9-
//
9+
//
1010
// RustPlayer is distributed in the hope that it will be useful,
1111
// but WITHOUT ANY WARRANTY; without even the implied warranty of
1212
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1313
// GNU General Public License for more details.
14-
//
14+
//
1515
// You should have received a copy of the GNU General Public License
1616
// along with RustPlayer. If not, see <http://www.gnu.org/licenses/>.
1717

18+
pub mod media;
1819
pub mod player;
19-
pub mod media;

src/media/player.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ use crate::{
4949
app,
5050
util::lyrics::{Lyric, Lyrics},
5151
};
52-
use crate::{
53-
m3u8::download_m3u8_playlist,
54-
util::{net::download_as_bytes},
55-
};
52+
use crate::{m3u8::download_m3u8_playlist, util::net::download_as_bytes};
5653

5754
use super::media::Media;
5855

0 commit comments

Comments
 (0)