pub struct MediaFile {
Show 18 fields pub id: i64, pub media_id: Option<i64>, pub library_id: i64, pub target_file: String, pub raw_name: String, pub raw_year: Option<i64>, pub quality: Option<String>, pub codec: Option<String>, pub container: Option<String>, pub audio: Option<String>, pub original_resolution: Option<String>, pub duration: Option<i64>, pub episode: Option<i64>, pub season: Option<i64>, pub corrupt: Option<bool>, pub channels: Option<i64>, pub profile: Option<String>, pub audio_language: Option<String>,
}
Expand description

MediaFile struct which represents a media file on the filesystem. This struct holds some basic information which the video player on the front end might require.

Fields§

§id: i64

Unique identifier of a mediafile.

§media_id: Option<i64>

Foreign key linking this entry to the media table or Media struct

§library_id: i64

Library foreign key linking this entry to the library table or Library struct

§target_file: String

String representing the file path of the file we target. This should be a real path on the filesystem.

§raw_name: String

Raw name that we extract from the filename using regex and the parse-torrent-name library

§raw_year: Option<i64>

Raw year we might be able to extract from the filename using regex and the parse-torrent-name library

§quality: Option<String>

Quality string that we might get from ffprobe when running it against our file

§codec: Option<String>

Codec that we might get from ffprobe when running it against our file

§container: Option<String>

Container descriptor that we might get from ffprobe

§audio: Option<String>

Audio codec specifier that we might get from ffprobe

§original_resolution: Option<String>

Video resolution that we can obtain from ffprobe

§duration: Option<i64>

Duration of the video file that we obtain from ffprobe

§episode: Option<i64>

Episode number that we might get from using regex and the parse-torrent-name crate. This is specific to tv shows only.

§season: Option<i64>

Season number that we might get from using regexa and the parse-torrent-name crate. This is specific to tv shows only.

§corrupt: Option<bool>

Flag which tells us if the file is corrupted or not. ie if ffprobe cant open the file and reports no metadata this flag will be set.

§channels: Option<i64>

Audio channels count

§profile: Option<String>

avc_profile

§audio_language: Option<String>

Primary audio language

Implementations§

Method returns all mediafiles associated with a library.

Arguments
  • conn - mutable reference to a sqlx transaction.
  • lib - reference to a Library object that we will match against

Method returns all mediafiles associated with a library and filters for those not associated with a media

Arguments
  • conn - mutable reference to a sqlx transaction.
  • lib - reference to a Library object that we will match against

Method returns all mediafiles associated with a Media object.

Arguments
  • conn - mutable reference to a sqlx transaction.
  • lib - reference to a Library object that we will match against

Method returns all metadata of a mediafile based on the id supplied.

Arguments
  • conn - mutable reference to a sqlx transaction.
  • _id - id of the mediafile object we are targetting

Method returns all metadata for a set of mediafile ids.

Arguments
  • conn - mutable reference to a sqlx transaction.
  • ids - list of mediafile ids

Method checks whether a mediafile entry with the filepath supplied exists or not, returning a bool.

Arguments
  • conn - mutable reference to a sqlx transaction.
  • file - string slice containing our filepath

Function will return the largest duration for a media.

Method deletes mediafile matching the id supplied

Arguments
  • conn - mutable reference to a sqlx transaction.
  • _id - id of the mediafile entry we want to delete

Function deletes all mediafiles with library_id of lib_id. This function is used when deleting a library with a sqlite backend.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts this type into the (usually inferred) input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more