mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Move PlayerEvent into player.
This commit is contained in:
parent
b0ee03112f
commit
1b943d069f
3 changed files with 20 additions and 18 deletions
|
@ -1,6 +1,7 @@
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use core::spotify_id::SpotifyId;
|
use core::spotify_id::SpotifyId;
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
|
use player::PlayerEvent;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Hash, PartialOrd, Ord, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, Hash, PartialOrd, Ord, PartialEq, Eq)]
|
||||||
pub enum Bitrate {
|
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)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct PlayerConfig {
|
pub struct PlayerConfig {
|
||||||
pub bitrate: Bitrate,
|
pub bitrate: Bitrate,
|
||||||
|
|
|
@ -8,7 +8,7 @@ use std::sync::mpsc::{RecvError, TryRecvError, RecvTimeoutError};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use config::{Bitrate, PlayerConfig, PlayerEvent};
|
use config::{Bitrate, PlayerConfig};
|
||||||
use core::session::Session;
|
use core::session::Session;
|
||||||
use core::spotify_id::SpotifyId;
|
use core::spotify_id::SpotifyId;
|
||||||
|
|
||||||
|
@ -42,6 +42,23 @@ enum PlayerCommand {
|
||||||
Seek(u32),
|
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 {
|
impl Player {
|
||||||
pub fn new<F>(config: PlayerConfig, session: Session,
|
pub fn new<F>(config: PlayerConfig, session: Session,
|
||||||
audio_filter: Option<Box<AudioFilter + Send>>,
|
audio_filter: Option<Box<AudioFilter + Send>>,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::sync::mpsc::{channel, Sender};
|
use std::sync::mpsc::{channel, Sender};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use librespot::playback::config::PlayerEvent;
|
use librespot::playback::player::PlayerEvent;
|
||||||
|
|
||||||
fn run_program(program: &str, args: Vec<String>) {
|
fn run_program(program: &str, args: Vec<String>) {
|
||||||
info!("Running {}", program);
|
info!("Running {}", program);
|
||||||
|
|
Loading…
Reference in a new issue