Quellcode durchsuchen

Move PlayerEvent into player.

Simon Persson vor 7 Jahren
Ursprung
Commit
1b943d069f
3 geänderte Dateien mit 20 neuen und 18 gelöschten Zeilen
  1. 1 16
      playback/src/config.rs
  2. 18 1
      playback/src/player.rs
  3. 1 1
      src/player_event_handler.rs

+ 1 - 16
playback/src/config.rs

@@ -1,6 +1,7 @@
 use std::str::FromStr;
 use core::spotify_id::SpotifyId;
 use std::sync::mpsc::Sender;
+use player::PlayerEvent;
 
 #[derive(Clone, Copy, Debug, Hash, PartialOrd, Ord, PartialEq, Eq)]
 pub enum Bitrate {
@@ -27,22 +28,6 @@ impl Default for Bitrate {
     }
 }
 
-#[derive(Debug, Clone)]
-pub enum PlayerEvent {
-    Started {
-        track_id: SpotifyId,
-    },
-
-    Changed {
-        old_track_id: SpotifyId,
-        new_track_id: SpotifyId,
-    },
-
-    Stopped {
-        track_id: SpotifyId,
-    }
-}
-
 #[derive(Clone, Debug)]
 pub struct PlayerConfig {
     pub bitrate: Bitrate,

+ 18 - 1
playback/src/player.rs

@@ -8,7 +8,7 @@ use std::sync::mpsc::{RecvError, TryRecvError, RecvTimeoutError};
 use std::thread;
 use std::time::Duration;
 
-use config::{Bitrate, PlayerConfig, PlayerEvent};
+use config::{Bitrate, PlayerConfig};
 use core::session::Session;
 use core::spotify_id::SpotifyId;
 
@@ -42,6 +42,23 @@ enum PlayerCommand {
     Seek(u32),
 }
 
+#[derive(Debug, Clone)]
+pub enum PlayerEvent {
+    Started {
+        track_id: SpotifyId,
+    },
+
+    Changed {
+        old_track_id: SpotifyId,
+        new_track_id: SpotifyId,
+    },
+
+    Stopped {
+        track_id: SpotifyId,
+    }
+}
+
+
 impl Player {
     pub fn new<F>(config: PlayerConfig, session: Session,
                   audio_filter: Option<Box<AudioFilter + Send>>,

+ 1 - 1
src/player_event_handler.rs

@@ -1,7 +1,7 @@
 use std::process::Command;
 use std::sync::mpsc::{channel, Sender};
 use std::thread;
-use librespot::playback::config::PlayerEvent;
+use librespot::playback::player::PlayerEvent;
 
 fn run_program(program: &str, args: Vec<String>) {
     info!("Running {}", program);