! Finalizing video fetch endpoint
With this the backend is officially at an MVP stage and now requires polishing Proper data streaming for larger clips is basically required for a really good backend(especially async streaming) and some better css for the video player
This commit is contained in:
@@ -37,9 +37,6 @@ pub async fn category(cat: PathBuf) -> Template {
|
||||
|
||||
#[get("/clip/<cat>/<file_base>")]
|
||||
pub async fn video(cat: PathBuf, file_base: PathBuf) -> Template {
|
||||
// NOTE: the "file name" does not include the
|
||||
println!("{:?}, {:?}", cat, file_base);
|
||||
|
||||
let mut h: HashMap<&'static str, &str> = HashMap::new();
|
||||
|
||||
let cat = cat.to_string_lossy();
|
||||
@@ -59,6 +56,8 @@ pub async fn video(cat: PathBuf, file_base: PathBuf) -> Template {
|
||||
let thumbnail = format!("/thumbnail/{}/{}", cat, file);
|
||||
h.insert("ogimg", &thumbnail);
|
||||
|
||||
let clip_url = format!("/video/{}/{}", &cat, &file);
|
||||
h.insert("clip_url", &clip_url);
|
||||
return Template::render("video", &h);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ pub fn list(cat: PathBuf) -> Option<Json<Vec<VideoPreview>>> {
|
||||
}
|
||||
|
||||
|
||||
#[get("/clip/<cat>/<file>")]
|
||||
#[get("/<cat>/<file>")]
|
||||
pub async fn get_video(cat: PathBuf, file: PathBuf) -> Option<NamedFile> {
|
||||
let clips_dir = get_clips_dir();
|
||||
let path = Path::new(&clips_dir).join(cat).join(file);
|
||||
|
||||
Reference in New Issue
Block a user