pub struct Track { /* private fields */ }Implementations§
Source§impl Track
impl Track
Sourcepub fn from_podcast_episode(ep: &Episode) -> Self
pub fn from_podcast_episode(ep: &Episode) -> Self
Create a new Track instance from a Podcast Episode from the database
Sourcepub fn read_track_from_path<P: Into<PathBuf>>(path: P) -> Result<Self>
pub fn read_track_from_path<P: Into<PathBuf>>(path: P) -> Result<Self>
Create a new Track from a local file, populated with the most important tags
pub fn artist(&self) -> Option<&str>
pub fn title(&self) -> Option<&str>
pub fn duration(&self) -> Option<Duration>
Sourcepub fn duration_str_short(&self) -> Option<DurationFmtShort>
pub fn duration_str_short(&self) -> Option<DurationFmtShort>
Format the Track’s duration to a short-form.
see DurationFmtShort for formatting.
Sourcepub fn url(&self) -> Option<&str>
pub fn url(&self) -> Option<&str>
Get the main URL-identifier of the current track, if it is a type that has one.
Only MediaTypes::Track does not have a URL at the moment.
Sourcepub fn path(&self) -> Option<&Path>
pub fn path(&self) -> Option<&Path>
Get the main Path-identifier of the current track, if it is a type that has one.
Only MediaTypes::Track currently has a main Path-identifier.
pub fn as_track(&self) -> Option<&TrackData>
pub fn as_radio(&self) -> Option<&RadioTrackData>
pub fn as_podcast(&self) -> Option<&PodcastTrackData>
pub fn inner(&self) -> &MediaTypes
Sourcepub fn media_type(&self) -> MediaTypesSimple
pub fn media_type(&self) -> MediaTypesSimple
Get a Enum without values to check against types.
Mainly for not having to change too many functions yet.
Sourcepub fn as_track_source(&self) -> PlaylistTrackSource
pub fn as_track_source(&self) -> PlaylistTrackSource
Create a PlaylistTrackSource from the current track identifier for GRPC.
Sourcepub fn get_picture(&self) -> Result<Option<Arc<Picture>>>
pub fn get_picture(&self) -> Result<Option<Arc<Picture>>>
Get a cover / picture for the current track.
Returns Ok(None) if there was no error, but also no picture could be found.
This is currently only implemented for Music Tracks.
§Errors
- if reading the file fails
- if parsing the file fails
- if there is no parent in the given path
- reading the directory fails
- reading the file fails
- parsing the file as a picture fails
Trait Implementations§
Source§impl PartialEq<PlaylistTrackSource> for &Track
impl PartialEq<PlaylistTrackSource> for &Track
Auto Trait Implementations§
impl Freeze for Track
impl RefUnwindSafe for Track
impl Send for Track
impl Sync for Track
impl Unpin for Track
impl UnwindSafe for Track
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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>
T in a tonic::Request