Struct termusicplayback::GeneralPlayer
source · pub struct GeneralPlayer {
pub backend: Backend,
pub playlist: Playlist,
pub config: SharedSettings,
pub current_track_updated: bool,
pub mpris: Mpris,
pub discord: Rpc,
pub db: DataBase,
pub db_podcast: Database,
pub cmd_tx: PlayerCmdSender,
}
Fields§
§backend: Backend
§playlist: Playlist
§config: SharedSettings
§current_track_updated: bool
§mpris: Mpris
§discord: Rpc
§db: DataBase
§db_podcast: Database
§cmd_tx: PlayerCmdSender
Implementations§
source§impl GeneralPlayer
impl GeneralPlayer
pub fn mpris_handler(&mut self, e: MediaControlEvent)
pub fn update_mpris(&mut self)
source§impl GeneralPlayer
impl GeneralPlayer
sourcepub fn new_backend(
backend: BackendSelect,
config: Settings,
cmd_tx: PlayerCmdSender
) -> Result<Self>
pub fn new_backend( backend: BackendSelect, config: Settings, cmd_tx: PlayerCmdSender ) -> Result<Self>
Create a new GeneralPlayer
, with the selected backend
§Errors
- if connecting to the database fails
- if config path creation fails
sourcepub fn new(config: Settings, cmd_tx: PlayerCmdSender) -> Result<Self>
pub fn new(config: Settings, cmd_tx: PlayerCmdSender) -> Result<Self>
Create a new GeneralPlayer
, with the BackendSelect::Default
backend
§Errors
- if connecting to the database fails
- if config path creation fails
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
pub fn enqueue_next_from_playlist(&mut self)
pub fn next(&mut self)
pub fn previous(&mut self)
pub fn toggle_pause(&mut self)
pub fn pause(&mut self)
pub fn play(&mut self)
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 volume_down(&mut self) -> Volume
fn volume_down(&mut self) -> Volume
Step the volume down by a backend-set step amount 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 pause(&mut self)
fn resume(&mut self)
fn is_paused(&self) -> bool
source§fn speed_down(&mut self) -> Speed
fn speed_down(&mut self) -> Speed
Step the speed down by a backend-set step amount 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
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> 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
source§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> R
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self
, then passes self.deref()
into the pipe function.source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref()
only in debug builds, and is erased in release
builds.