Struct aspasia::SsaSubtitle

source ·
pub struct SsaSubtitle { /* private fields */ }
Expand description

SubStation Alpha v4 (.ssa) subtitle

Implementations§

source§

impl SsaSubtitle

source

pub fn builder( ) -> __SsaSubtitleBuilder<(__Required<SsaScriptInfo>, __Optional<Vec<SsaEvent>>, __Optional<Vec<SsaEvent>>, __Optional<Vec<SsaEvent>>, __Optional<Vec<SsaEvent>>, __Optional<Vec<SsaEvent>>, __Optional<Vec<SsaStyle>>, __Optional<Vec<SubStationFont>>, __Optional<Vec<SubStationGraphic>>)>

Create a new SsaSubtitle

Arguments
  • script_info: Script info
  • dialogue: Dialogue events
  • pictures: Picture events
  • sounds: Sound events
  • movies: Movie events
  • commands: Command events
  • styles: Styles
  • fonts: Embedded font data
  • graphics: Embedded graphics data
source§

impl SsaSubtitle

source

pub fn pictures(&self) -> &[SsaEvent]

Get list of picture events as a slice

source

pub fn pictures_mut(&mut self) -> &mut [SsaEvent]

Get list of picture events as a mutable slice

source

pub fn picture(&self, index: usize) -> Option<&SsaEvent>

Get picture event at given index

source

pub fn picture_mut(&mut self, index: usize) -> Option<&mut SsaEvent>

Get mutable picture event at given index

source

pub fn sounds(&self) -> &[SsaEvent]

Get list of sound events as a slice

source

pub fn sounds_mut(&mut self) -> &mut [SsaEvent]

Get list of sound events as a mutable slice

source

pub fn sound(&self, index: usize) -> Option<&SsaEvent>

Get sound event at specified index

source

pub fn sound_mut(&mut self, index: usize) -> Option<&mut SsaEvent>

Get mutable sound event at specified index

source

pub fn movies(&self) -> &[SsaEvent]

Get list of movie events as a slice

source

pub fn movies_mut(&mut self) -> &mut [SsaEvent]

Get list of movie events as a mutable slice

source

pub fn movie(&self, index: usize) -> Option<&SsaEvent>

Get movie event at specified index

source

pub fn movie_mut(&mut self, index: usize) -> Option<&mut SsaEvent>

Get mutable movie event at specified index

source

pub fn commands(&self) -> &[SsaEvent]

Get list of command events as a slice

source

pub fn commands_mut(&mut self) -> &mut [SsaEvent]

Get list of command events as a mutable slice

source

pub fn command(&self, index: usize) -> Option<&SsaEvent>

Get command event at given index

source

pub fn command_mut(&mut self, index: usize) -> Option<&mut SsaEvent>

Get mutable command event at given index

source

pub fn script_info(&self) -> &SsaScriptInfo

Get script info struct

source

pub fn script_info_mut(&mut self) -> &mut SsaScriptInfo

Get mutable script info struct

source

pub fn styles(&self) -> &[SsaStyle]

Get list of styles as a slice

source

pub fn styles_mut(&mut self) -> &mut [SsaStyle]

Get list of styles as a mutable slice

source

pub fn fonts(&self) -> &[SubStationFont]

Get list of fonts as a slice

source

pub fn fonts_mut(&mut self) -> &mut [SubStationFont]

Get list of fonts as a mutable slice

source

pub fn graphics(&self) -> &[SubStationGraphic]

Get list of graphics as a slice

source

pub fn graphics_mut(&mut self) -> &mut [SubStationGraphic]

Get list of graphics as a mutable slice

Trait Implementations§

source§

impl Debug for SsaSubtitle

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for SsaSubtitle

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Display for SsaSubtitle

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&AssSubtitle> for SsaSubtitle

source§

fn from(value: &AssSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<&SsaSubtitle> for AssSubtitle

source§

fn from(value: &SsaSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<&SsaSubtitle> for SubRipSubtitle

source§

fn from(value: &SsaSubtitle) -> Self

Convert SubStation Alpha (.ssa) subtitles to .srt format

Replaces SubStation newline indicators (\N) with actual newlines. Additionally, converts .ssa style formatting tags to .srt formatting tags. Currently, bolded, italicised, or coloured text will be converted to their .srt counterparts. All other tags will be discarded.

source§

impl From<&SsaSubtitle> for TimedMicroDvdSubtitle

source§

fn from(value: &SsaSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<&SsaSubtitle> for WebVttSubtitle

source§

fn from(value: &SsaSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<&SubRipSubtitle> for SsaSubtitle

source§

fn from(value: &SubRipSubtitle) -> Self

Convert SubRip (.srt) subtitle to .ssa format.

This will replace newlines and convert HTML formatting tags (<b>, <i>, etc.) into .ssa style formatting tags

source§

impl From<&TimedMicroDvdSubtitle> for SsaSubtitle

source§

fn from(value: &TimedMicroDvdSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<&WebVttSubtitle> for SsaSubtitle

source§

fn from(value: &WebVttSubtitle) -> Self

Convert WebVTT (.vtt) format subtitle to .ssa format.

For each line, this will convert newlines into the appropriate representation, and it will also convert the basic HTML formatting tags (<b>, <i>, and <u>).

All other tags and styles are discarded.

source§

impl From<AssSubtitle> for SsaSubtitle

source§

fn from(value: AssSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<PlainSubtitle> for SsaSubtitle

source§

fn from(value: PlainSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<SsaSubtitle> for AssSubtitle

source§

fn from(value: SsaSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<SsaSubtitle> for SubRipSubtitle

source§

fn from(value: SsaSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<SsaSubtitle> for WebVttSubtitle

source§

fn from(value: SsaSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<SubRipSubtitle> for SsaSubtitle

source§

fn from(value: SubRipSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<TimedMicroDvdSubtitle> for SsaSubtitle

source§

fn from(value: TimedMicroDvdSubtitle) -> Self

Converts to this type from the input type.
source§

impl From<TimedSubtitleFile> for SsaSubtitle

source§

fn from(value: TimedSubtitleFile) -> Self

Converts to this type from the input type.
source§

impl From<WebVttSubtitle> for SsaSubtitle

source§

fn from(value: WebVttSubtitle) -> Self

Converts to this type from the input type.
source§

impl FromStr for SsaSubtitle

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Subtitle for SsaSubtitle

§

type Event = SsaEvent

Event type for the given subtitle format
source§

fn from_path_with_encoding( path: impl AsRef<Path>, encoding: Option<&'static Encoding> ) -> Result<Self, Error>

Load subtitle format from path using the given encoding Read more
source§

fn events(&self) -> &[SsaEvent]

Get list of events as a slice
source§

fn events_mut(&mut self) -> &mut [SsaEvent]

Get list of events as a mutable slice
source§

fn from_path(path: impl AsRef<Path>) -> Result<Self, Error>

Load subtitle from given path. Automatically attempts to detect the encoding to use from the file contents. Read more
source§

fn event(&self, index: usize) -> Option<&Self::Event>

Try to get event at given index
source§

fn event_mut(&mut self, index: usize) -> Option<&mut Self::Event>

Try to get mutable event at given index
source§

fn export(&self, path: impl AsRef<Path>) -> Result<(), Error>

Write subtitles to file at the given path Read more
source§

impl TextSubtitle for SsaSubtitle

source§

fn strip_formatting(&mut self)

Strip formatting tags from lines in addition to deleting styles

source§

impl TimedSubtitle for SsaSubtitle

source§

fn shift(&mut self, delta: TimeDelta)
where <Self as Subtitle>::Event: TimedEvent,

Shift all events in subtitle by given amount of time, in milliseconds.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.