From 9e8f326518354e6bd3160eb17ee0e4d60623ad32 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 5 May 2026 19:11:26 +0000 Subject: [PATCH] sxyprn format changes vidara --- src/providers/sxyprn.rs | 41 ++++++---- src/videos.rs | 160 ++++++++++++++++++++-------------------- 2 files changed, 107 insertions(+), 94 deletions(-) diff --git a/src/providers/sxyprn.rs b/src/providers/sxyprn.rs index 48b3ece..32bb822 100644 --- a/src/providers/sxyprn.rs +++ b/src/providers/sxyprn.rs @@ -442,13 +442,26 @@ impl SxyprnProvider { let duration = parse_time_to_seconds(&raw_duration).unwrap_or(0) as u32; // stream urls - collect both lulustream and vidara.so URLs - let mut stream_urls = vec![format!( + let mut formats = vec![]; + + // Add sxyprn format + let sxyprn_url = format!( "{}/proxy/sxyprn/post/{}", options.public_url_base.as_deref().unwrap_or(""), id - )]; + ); + formats.push( + VideoFormat::new(sxyprn_url.clone(), "auto".to_string(), "mp4".to_string()) + .format_note( + sxyprn_url + .split("/") + .nth(4) + .unwrap_or("sxyprn") + .to_string(), + ), + ); - // Also collect and transform vidara.so URLs to proxy format + // Also collect and transform vidara.so URLs to proxy format and add as formats let vidara_urls: Vec = video_segment .split("extlink_icon extlink") .filter_map(|part| { @@ -469,21 +482,21 @@ impl SxyprnProvider { }) .collect(); - stream_urls.extend(vidara_urls); - - let formats: Vec = stream_urls - .into_iter() - .map(|url| { - VideoFormat::new(url.clone(), "auto".to_string(), "mp4".to_string()) + for vidara_url in vidara_urls { + formats.push( + VideoFormat::new(vidara_url.clone(), "1080".to_string(), "m3u8".to_string()) .format_note( - url.split("/") + vidara_url + .split("/") .nth(4) - .or_else(|| Some(&url)) - .unwrap_or_default() + .unwrap_or("vidara") .to_string(), ) - }) - .collect::>(); + .ext("m3u8".to_string()) + .format_id("hls".to_string()) + .video_ext("m3u8".to_string()), + ); + } let mut video_item = VideoItem::new( id.clone(), title, diff --git a/src/videos.rs b/src/videos.rs index 282a2c4..5aa0e02 100644 --- a/src/videos.rs +++ b/src/videos.rs @@ -329,86 +329,86 @@ impl VideoFormat { self.format_note = Some(format_note); self } - // pub fn filesize(mut self, filesize: u32) -> Self { - // self.filesize = Some(filesize); - // self - // } - // pub fn asr(mut self, asr: u32) -> Self { - // self.asr = Some(asr); - // self - // } - // pub fn fps(mut self, fps: u32) -> Self { - // self.fps = Some(fps); - // self - // } - // pub fn width(mut self, width: u32) -> Self { - // self.width = Some(width); - // self - // } - // pub fn height(mut self, height: u32) -> Self { - // self.height = Some(height); - // self - // } - // pub fn tbr(mut self, tbr: u32) -> Self { - // self.tbr = Some(tbr); - // self - // } - // pub fn language(mut self, language: String) -> Self { - // self.language = Some(language); - // self - // } - // pub fn language_preference(mut self, language_preference: u32) -> Self { - // self.language_preference = Some(language_preference); - // self - // } - // pub fn ext(mut self, ext: String) -> Self { - // self.ext = Some(ext); - // self - // } - // pub fn vcodec(mut self, vcodec: String) -> Self { - // self.vcodec = Some(vcodec); - // self - // } - // pub fn acodec(mut self, acodec: String) -> Self { - // self.acodec = Some(acodec); - // self - // } - // pub fn dynamic_range(mut self, dynamic_range: String) -> Self { - // self.dynamic_range = Some(dynamic_range); - // self - // } - // pub fn abr(mut self, abr: u32) -> Self { - // self.abr = Some(abr); - // self - // } - // pub fn vbr(mut self, vbr: u32) -> Self { - // self.vbr = Some(vbr); - // self - // } - // pub fn container(mut self, container: String) -> Self { - // self.container = Some(container); - // self - // } - // pub fn protocol(mut self, protocol: String) -> Self { - // self.protocol = Some(protocol); - // self - // } - // pub fn audio_ext(mut self, audio_ext: String) -> Self { - // self.audio_ext = Some(audio_ext); - // self - // } - // pub fn video_ext(mut self, video_ext: String) -> Self { - // self.video_ext = Some(video_ext); - // self - // } - // pub fn resolution(mut self, resolution: String) -> Self { - // self.resolution = Some(resolution); - // self - // } - // pub fn http_headers(mut self, http_headers: HashMap) -> Self { - // self.http_headers = Some(http_headers); - // self - // } + pub fn filesize(mut self, filesize: u32) -> Self { + self.filesize = Some(filesize); + self + } + pub fn asr(mut self, asr: u32) -> Self { + self.asr = Some(asr); + self + } + pub fn fps(mut self, fps: u32) -> Self { + self.fps = Some(fps); + self + } + pub fn width(mut self, width: u32) -> Self { + self.width = Some(width); + self + } + pub fn height(mut self, height: u32) -> Self { + self.height = Some(height); + self + } + pub fn tbr(mut self, tbr: u32) -> Self { + self.tbr = Some(tbr); + self + } + pub fn language(mut self, language: String) -> Self { + self.language = Some(language); + self + } + pub fn language_preference(mut self, language_preference: u32) -> Self { + self.language_preference = Some(language_preference); + self + } + pub fn ext(mut self, ext: String) -> Self { + self.ext = Some(ext); + self + } + pub fn vcodec(mut self, vcodec: String) -> Self { + self.vcodec = Some(vcodec); + self + } + pub fn acodec(mut self, acodec: String) -> Self { + self.acodec = Some(acodec); + self + } + pub fn dynamic_range(mut self, dynamic_range: String) -> Self { + self.dynamic_range = Some(dynamic_range); + self + } + pub fn abr(mut self, abr: u32) -> Self { + self.abr = Some(abr); + self + } + pub fn vbr(mut self, vbr: u32) -> Self { + self.vbr = Some(vbr); + self + } + pub fn container(mut self, container: String) -> Self { + self.container = Some(container); + self + } + pub fn protocol(mut self, protocol: String) -> Self { + self.protocol = Some(protocol); + self + } + pub fn audio_ext(mut self, audio_ext: String) -> Self { + self.audio_ext = Some(audio_ext); + self + } + pub fn video_ext(mut self, video_ext: String) -> Self { + self.video_ext = Some(video_ext); + self + } + pub fn resolution(mut self, resolution: String) -> Self { + self.resolution = Some(resolution); + self + } + pub fn http_headers(mut self, http_headers: HashMap) -> Self { + self.http_headers = Some(http_headers); + self + } } #[derive(serde::Serialize, Debug)] pub struct Videos {