redtube fix

This commit is contained in:
Simon
2026-04-07 12:32:41 +00:00
parent a7e38c97a6
commit 81e8158161
5 changed files with 160 additions and 111 deletions

View File

@@ -82,6 +82,7 @@ pub struct UploaderVideoRef {
}
impl UploaderVideoRef {
#[allow(dead_code)]
pub fn from_video_item(item: &VideoItem, uploader_name: &str, uploader_id: &str) -> Self {
Self {
id: item.id.clone(),
@@ -117,6 +118,7 @@ pub struct UploaderLayoutRow {
}
impl UploaderLayoutRow {
#[allow(dead_code)]
pub fn horizontal(title: Option<String>, video_ids: Vec<String>) -> Self {
Self {
rowType: UploaderLayoutRowType::Horizontal,
@@ -125,6 +127,7 @@ impl UploaderLayoutRow {
}
}
#[allow(dead_code)]
pub fn videos(title: Option<String>) -> Self {
Self {
rowType: UploaderLayoutRowType::Videos,
@@ -150,12 +153,14 @@ pub fn normalize_optional_string(value: Option<String>) -> Option<String> {
})
}
#[allow(dead_code)]
pub fn iso_timestamp_from_unix(value: Option<u64>) -> Option<String> {
let timestamp = value?;
let dt = Utc.timestamp_opt(timestamp as i64, 0).single()?;
Some(dt.to_rfc3339_opts(SecondsFormat::Millis, true))
}
#[allow(dead_code)]
fn normalize_rating(value: f32) -> u32 {
value.clamp(0.0, 100.0).round() as u32
}