work
This commit is contained in:
parent
e431d3b745
commit
311b315990
7 changed files with 490 additions and 370 deletions
|
@ -2,11 +2,10 @@ use ring::digest::{Context, SHA256};
|
|||
use std::io::Read;
|
||||
|
||||
pub fn is_video_file(filename: &str) -> bool {
|
||||
let video_extensions = vec![r"\.mp4$", r"\.mkv$", r"\.webm$", r"\.avi$"];
|
||||
let video_extensions = vec!["mp4", "mkv", "webm"];
|
||||
|
||||
for ext in video_extensions {
|
||||
let regex = regex::Regex::new(ext).unwrap();
|
||||
if regex.is_match(filename) {
|
||||
if filename.ends_with(ext) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ impl Video {
|
|||
}
|
||||
|
||||
tx.execute(
|
||||
"INSERT INTO videos (sha256, directory, path, title) VALUES (?1, ?2, ?3, ?4)",
|
||||
"INSERT OR REPLACE INTO videos (sha256, directory, path, title) VALUES (?1, ?2, ?3, ?4)",
|
||||
[&id, &dir, v.to_str().unwrap(), &file_name],
|
||||
)
|
||||
.unwrap();
|
||||
|
|
|
@ -4,6 +4,8 @@ mod library;
|
|||
mod pages;
|
||||
mod yt_meta;
|
||||
|
||||
// TODO : Add User Auth DB
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
std::env::set_var("RUST_LOG", "info");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue