pub struct JsonSubtitle {
pub body: Vec<JsonSubtitleBody>,
}Expand description
Contains information inside a Bilibili JSON subtitle.
§Convert to other subtitle format
use bilibili_extractor_lib::subtitle::{JsonSubtitle, JsonSubtitleBody};
let json_subtitle = JsonSubtitle {
body: vec![JsonSubtitleBody {
from: 0.,
to: 1.,
content: "Subtitle".into(),
}],
};
println!("{}", json_subtitle.to_ssa().to_string())Fields§
§body: Vec<JsonSubtitleBody>Implementations§
Source§impl JsonSubtitle
impl JsonSubtitle
Sourcepub fn new_from_episode(
episode: &EpisodeMetadata<impl AsRef<Path>>,
subtitle_language: &str,
) -> Result<Self>
pub fn new_from_episode( episode: &EpisodeMetadata<impl AsRef<Path>>, subtitle_language: &str, ) -> Result<Self>
Fetch the json subtitle of an episode.
Sourcepub fn new_from_normal_episode(
episode: &NormalEpisodeMetadata<impl AsRef<Path>>,
subtitle_language: &str,
) -> Result<Self>
pub fn new_from_normal_episode( episode: &NormalEpisodeMetadata<impl AsRef<Path>>, subtitle_language: &str, ) -> Result<Self>
Fetch the json subtitle of a normal episode.
Sourcepub fn new_from_special_episode(
episode: &SpecialEpisodeMetadata<impl AsRef<Path>>,
subtitle_language: &str,
) -> Result<Self>
pub fn new_from_special_episode( episode: &SpecialEpisodeMetadata<impl AsRef<Path>>, subtitle_language: &str, ) -> Result<Self>
Fetch the json subtitle of a special episode.
Sourcepub fn new_from_path(path: impl AsRef<Path>) -> Result<Self>
pub fn new_from_path(path: impl AsRef<Path>) -> Result<Self>
Create a JsonSubtitle from path.
Sourcepub fn to_subtitle(self) -> Subtitle
pub fn to_subtitle(self) -> Subtitle
Convert to Subtitle.
Trait Implementations§
Source§impl Clone for JsonSubtitle
impl Clone for JsonSubtitle
Source§fn clone(&self) -> JsonSubtitle
fn clone(&self) -> JsonSubtitle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for JsonSubtitle
impl Debug for JsonSubtitle
Source§impl<'de> Deserialize<'de> for JsonSubtitle
impl<'de> Deserialize<'de> for JsonSubtitle
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<JsonSubtitle> for SRTFile
impl From<JsonSubtitle> for SRTFile
Source§fn from(value: JsonSubtitle) -> Self
fn from(value: JsonSubtitle) -> Self
Converts to this type from the input type.
Source§impl From<JsonSubtitle> for SSAFile
impl From<JsonSubtitle> for SSAFile
Source§fn from(value: JsonSubtitle) -> Self
fn from(value: JsonSubtitle) -> Self
Converts to this type from the input type.
Source§impl From<JsonSubtitle> for Subtitle
impl From<JsonSubtitle> for Subtitle
Source§fn from(value: JsonSubtitle) -> Self
fn from(value: JsonSubtitle) -> Self
Converts to this type from the input type.
Source§impl From<JsonSubtitle> for VTTFile
impl From<JsonSubtitle> for VTTFile
Source§fn from(value: JsonSubtitle) -> Self
fn from(value: JsonSubtitle) -> Self
Converts to this type from the input type.
Source§impl PartialEq for JsonSubtitle
impl PartialEq for JsonSubtitle
Source§impl PartialOrd for JsonSubtitle
impl PartialOrd for JsonSubtitle
Source§impl Serialize for JsonSubtitle
impl Serialize for JsonSubtitle
impl StructuralPartialEq for JsonSubtitle
Auto Trait Implementations§
impl Freeze for JsonSubtitle
impl RefUnwindSafe for JsonSubtitle
impl Send for JsonSubtitle
impl Sync for JsonSubtitle
impl Unpin for JsonSubtitle
impl UnwindSafe for JsonSubtitle
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