sxyprn format changes vidara
This commit is contained in:
@@ -442,13 +442,26 @@ impl SxyprnProvider {
|
|||||||
let duration = parse_time_to_seconds(&raw_duration).unwrap_or(0) as u32;
|
let duration = parse_time_to_seconds(&raw_duration).unwrap_or(0) as u32;
|
||||||
|
|
||||||
// stream urls - collect both lulustream and vidara.so URLs
|
// 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/{}",
|
"{}/proxy/sxyprn/post/{}",
|
||||||
options.public_url_base.as_deref().unwrap_or(""),
|
options.public_url_base.as_deref().unwrap_or(""),
|
||||||
id
|
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<String> = video_segment
|
let vidara_urls: Vec<String> = video_segment
|
||||||
.split("extlink_icon extlink")
|
.split("extlink_icon extlink")
|
||||||
.filter_map(|part| {
|
.filter_map(|part| {
|
||||||
@@ -469,21 +482,21 @@ impl SxyprnProvider {
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
stream_urls.extend(vidara_urls);
|
for vidara_url in vidara_urls {
|
||||||
|
formats.push(
|
||||||
let formats: Vec<VideoFormat> = stream_urls
|
VideoFormat::new(vidara_url.clone(), "1080".to_string(), "m3u8".to_string())
|
||||||
.into_iter()
|
|
||||||
.map(|url| {
|
|
||||||
VideoFormat::new(url.clone(), "auto".to_string(), "mp4".to_string())
|
|
||||||
.format_note(
|
.format_note(
|
||||||
url.split("/")
|
vidara_url
|
||||||
|
.split("/")
|
||||||
.nth(4)
|
.nth(4)
|
||||||
.or_else(|| Some(&url))
|
.unwrap_or("vidara")
|
||||||
.unwrap_or_default()
|
|
||||||
.to_string(),
|
.to_string(),
|
||||||
)
|
)
|
||||||
})
|
.ext("m3u8".to_string())
|
||||||
.collect::<Vec<VideoFormat>>();
|
.format_id("hls".to_string())
|
||||||
|
.video_ext("m3u8".to_string()),
|
||||||
|
);
|
||||||
|
}
|
||||||
let mut video_item = VideoItem::new(
|
let mut video_item = VideoItem::new(
|
||||||
id.clone(),
|
id.clone(),
|
||||||
title,
|
title,
|
||||||
|
|||||||
160
src/videos.rs
160
src/videos.rs
@@ -329,86 +329,86 @@ impl VideoFormat {
|
|||||||
self.format_note = Some(format_note);
|
self.format_note = Some(format_note);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
// pub fn filesize(mut self, filesize: u32) -> Self {
|
pub fn filesize(mut self, filesize: u32) -> Self {
|
||||||
// self.filesize = Some(filesize);
|
self.filesize = Some(filesize);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn asr(mut self, asr: u32) -> Self {
|
pub fn asr(mut self, asr: u32) -> Self {
|
||||||
// self.asr = Some(asr);
|
self.asr = Some(asr);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn fps(mut self, fps: u32) -> Self {
|
pub fn fps(mut self, fps: u32) -> Self {
|
||||||
// self.fps = Some(fps);
|
self.fps = Some(fps);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn width(mut self, width: u32) -> Self {
|
pub fn width(mut self, width: u32) -> Self {
|
||||||
// self.width = Some(width);
|
self.width = Some(width);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn height(mut self, height: u32) -> Self {
|
pub fn height(mut self, height: u32) -> Self {
|
||||||
// self.height = Some(height);
|
self.height = Some(height);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn tbr(mut self, tbr: u32) -> Self {
|
pub fn tbr(mut self, tbr: u32) -> Self {
|
||||||
// self.tbr = Some(tbr);
|
self.tbr = Some(tbr);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn language(mut self, language: String) -> Self {
|
pub fn language(mut self, language: String) -> Self {
|
||||||
// self.language = Some(language);
|
self.language = Some(language);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn language_preference(mut self, language_preference: u32) -> Self {
|
pub fn language_preference(mut self, language_preference: u32) -> Self {
|
||||||
// self.language_preference = Some(language_preference);
|
self.language_preference = Some(language_preference);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn ext(mut self, ext: String) -> Self {
|
pub fn ext(mut self, ext: String) -> Self {
|
||||||
// self.ext = Some(ext);
|
self.ext = Some(ext);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn vcodec(mut self, vcodec: String) -> Self {
|
pub fn vcodec(mut self, vcodec: String) -> Self {
|
||||||
// self.vcodec = Some(vcodec);
|
self.vcodec = Some(vcodec);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn acodec(mut self, acodec: String) -> Self {
|
pub fn acodec(mut self, acodec: String) -> Self {
|
||||||
// self.acodec = Some(acodec);
|
self.acodec = Some(acodec);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn dynamic_range(mut self, dynamic_range: String) -> Self {
|
pub fn dynamic_range(mut self, dynamic_range: String) -> Self {
|
||||||
// self.dynamic_range = Some(dynamic_range);
|
self.dynamic_range = Some(dynamic_range);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn abr(mut self, abr: u32) -> Self {
|
pub fn abr(mut self, abr: u32) -> Self {
|
||||||
// self.abr = Some(abr);
|
self.abr = Some(abr);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn vbr(mut self, vbr: u32) -> Self {
|
pub fn vbr(mut self, vbr: u32) -> Self {
|
||||||
// self.vbr = Some(vbr);
|
self.vbr = Some(vbr);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn container(mut self, container: String) -> Self {
|
pub fn container(mut self, container: String) -> Self {
|
||||||
// self.container = Some(container);
|
self.container = Some(container);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn protocol(mut self, protocol: String) -> Self {
|
pub fn protocol(mut self, protocol: String) -> Self {
|
||||||
// self.protocol = Some(protocol);
|
self.protocol = Some(protocol);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn audio_ext(mut self, audio_ext: String) -> Self {
|
pub fn audio_ext(mut self, audio_ext: String) -> Self {
|
||||||
// self.audio_ext = Some(audio_ext);
|
self.audio_ext = Some(audio_ext);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn video_ext(mut self, video_ext: String) -> Self {
|
pub fn video_ext(mut self, video_ext: String) -> Self {
|
||||||
// self.video_ext = Some(video_ext);
|
self.video_ext = Some(video_ext);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn resolution(mut self, resolution: String) -> Self {
|
pub fn resolution(mut self, resolution: String) -> Self {
|
||||||
// self.resolution = Some(resolution);
|
self.resolution = Some(resolution);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// pub fn http_headers(mut self, http_headers: HashMap<String, String>) -> Self {
|
pub fn http_headers(mut self, http_headers: HashMap<String, String>) -> Self {
|
||||||
// self.http_headers = Some(http_headers);
|
self.http_headers = Some(http_headers);
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
#[derive(serde::Serialize, Debug)]
|
#[derive(serde::Serialize, Debug)]
|
||||||
pub struct Videos {
|
pub struct Videos {
|
||||||
|
|||||||
Reference in New Issue
Block a user