! 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:
shockrah
2021-10-16 18:14:04 -07:00
parent d6b076970f
commit c53d9a293e
5 changed files with 15 additions and 12 deletions

View File

@@ -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);
}

View File

@@ -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);