pub struct GeneralPlayer {
pub backend: Backend,
pub playlist: SharedPlaylist,
pub config: SharedServerSettings,
pub current_track_updated: bool,
pub mpris: Option<Mpris>,
pub discord: Option<Rpc>,
pub db: DataBase,
pub db_podcast: Database,
pub cmd_tx: PlayerCmdSender,
pub stream_tx: StreamTX,
pub errors_since_last_progress: usize,
}Fields§
§backend: Backend§playlist: SharedPlaylist§config: SharedServerSettings§current_track_updated: bool§mpris: Option<Mpris>§discord: Option<Rpc>§db: DataBase§db_podcast: Database§cmd_tx: PlayerCmdSender§stream_tx: StreamTX§errors_since_last_progress: usizeKeep track of continues backend errors (like NotFound) to not keep trying infinitely.
Implementations§
Source§impl GeneralPlayer
impl GeneralPlayer
pub fn mpris_handler(&mut self, e: MediaControlEvent)
Sourcepub fn mpris_handle_events(&mut self)
pub fn mpris_handle_events(&mut self)
Handle Media-Controls events, if enabled to be used
Sourcepub fn mpris_update_progress(&mut self, progress: &PlayerProgress)
pub fn mpris_update_progress(&mut self, progress: &PlayerProgress)
Update Media-Controls reported Position & Status, if enabled to be reporting
Sourcepub fn mpris_volume_update(&mut self)
pub fn mpris_volume_update(&mut self)
Update Media-Controls reported volume, if enabled to be reporting
Source§impl GeneralPlayer
impl GeneralPlayer
Sourcepub fn new_backend(
backend: BackendSelect,
config: SharedServerSettings,
cmd_tx: PlayerCmdSender,
stream_tx: StreamTX,
playlist: SharedPlaylist,
) -> Result<Self>
pub fn new_backend( backend: BackendSelect, config: SharedServerSettings, cmd_tx: PlayerCmdSender, stream_tx: StreamTX, playlist: SharedPlaylist, ) -> Result<Self>
Create a new GeneralPlayer, with the selected backend
§Errors
- if connecting to the database fails
- if config path creation fails
Sourcepub fn increment_errors(&mut self)
pub fn increment_errors(&mut self)
Increment the errors that happened by one.
Sourcepub fn reset_errors(&mut self)
pub fn reset_errors(&mut self)
Reset errors that happened back to 0
Sourcepub fn new(
config: SharedServerSettings,
cmd_tx: PlayerCmdSender,
stream_tx: StreamTX,
playlist: SharedPlaylist,
) -> Result<Self>
pub fn new( config: SharedServerSettings, cmd_tx: PlayerCmdSender, stream_tx: StreamTX, playlist: SharedPlaylist, ) -> Result<Self>
Create a new GeneralPlayer, with the default Backend (BackendSelect::Rusty)
§Errors
- if connecting to the database fails
- if config path creation fails
Sourcepub fn reload_config(&mut self) -> Result<()>
pub fn reload_config(&mut self) -> Result<()>
pub fn toggle_gapless(&mut self) -> bool
Sourcepub fn start_play(&mut self)
pub fn start_play(&mut self)
Requires that the function is called on a thread with a entered tokio runtime
§Panics
if current_track_index in playlist is above u32
pub fn enqueue_next_from_playlist(&mut self)
Sourcepub fn toggle_pause(&mut self)
pub fn toggle_pause(&mut self)
Resume playback if paused, pause playback if running
Sourcepub fn seek_relative(&mut self, forward: bool)
pub fn seek_relative(&mut self, forward: bool)
§Panics
if the underlying “seek” returns a error (which current never happens)
pub fn player_save_last_position(&mut self)
pub fn player_restore_last_position(&mut self)
Trait Implementations§
Source§impl PlayerTrait for GeneralPlayer
impl PlayerTrait for GeneralPlayer
Source§fn add_and_play<'life0, 'life1, 'async_trait>(
&'life0 mut self,
track: &'life1 Track,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add_and_play<'life0, 'life1, 'async_trait>(
&'life0 mut self,
track: &'life1 Track,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Add the given track, skip to it (if not already) and start playing
Source§fn add_volume(&mut self, volume: VolumeSigned) -> Volume
fn add_volume(&mut self, volume: VolumeSigned) -> Volume
Add a relative amount to the current volume Read more
Source§fn set_volume(&mut self, volume: Volume) -> Volume
fn set_volume(&mut self, volume: Volume) -> Volume
Set the volume to a specific amount. Read more
fn is_paused(&self) -> bool
Source§fn add_speed(&mut self, speed: SpeedSigned) -> Speed
fn add_speed(&mut self, speed: SpeedSigned) -> Speed
Add a relative amount to the current speed Read more
fn stop(&mut self)
Source§fn get_progress(&self) -> Option<PlayerProgress>
fn get_progress(&self) -> Option<PlayerProgress>
Get current track time position
fn gapless(&self) -> bool
fn set_gapless(&mut self, to: bool)
fn skip_one(&mut self)
Source§fn enqueue_next(&mut self, track: &Track)
fn enqueue_next(&mut self, track: &Track)
Add the given URI to be played, but do not skip currently playing track
Source§fn media_info(&self) -> MediaInfo
fn media_info(&self) -> MediaInfo
Get info of the current media
Auto Trait Implementations§
impl !Freeze for GeneralPlayer
impl !RefUnwindSafe for GeneralPlayer
impl Send for GeneralPlayer
impl !Sync for GeneralPlayer
impl Unpin for GeneralPlayer
impl !UnwindSafe for GeneralPlayer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request