Skip to content

Commit

Permalink
fix(src/config.rs): always play_mode normal
Browse files Browse the repository at this point in the history
If modify some downloader settings except "play_mode" in custom.toml.

The "play_mode" always "normal".

Now, don't change "play_mode" if custom.toml not include this key.
  • Loading branch information
akiirui committed Aug 5, 2021
1 parent d07554c commit ff17e2b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ struct CustomDownloader {

#[derive(Debug)]
pub enum PlayMode {
Normal,
Direct,
Normal,
Pipe,
}

Expand Down Expand Up @@ -137,8 +137,8 @@ impl Downloader {
/// Return the downloader play mode
pub fn play_mode(&self) -> Result<PlayMode, ConfigError> {
match self.play_mode.as_str() {
"normal" => Ok(PlayMode::Normal),
"direct" => Ok(PlayMode::Direct),
"normal" => Ok(PlayMode::Normal),
"pipe" => Ok(PlayMode::Pipe),
_ => Err(ConfigError::DownloaderWrongPlayMode(self.play_mode.clone())),
}
Expand Down Expand Up @@ -270,8 +270,6 @@ fn merge_downloader(d: &mut Downloader, c: CustomDownloader) {
}
if let Some(v) = c.play_mode {
d.play_mode = v;
} else {
d.play_mode = Config::default_play_mode();
}
if let Some(v) = c.options {
d.options = v;
Expand Down

0 comments on commit ff17e2b

Please sign in to comment.