work
This commit is contained in:
parent
e431d3b745
commit
311b315990
7 changed files with 490 additions and 370 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1 @@
|
|||
/target
|
||||
/target
|
832
Cargo.lock
generated
832
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
17
Dockerfile
Normal file
17
Dockerfile
Normal file
|
@ -0,0 +1,17 @@
|
|||
FROM rust:buster as builder
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
|
||||
RUN cargo build --release
|
||||
|
||||
FROM ubuntu
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y
|
||||
RUN apt-get install -y ca-certificates openssl mkvtoolnix sqlite3
|
||||
|
||||
COPY --from=builder /app/target/release/watchdogs /watchdogs
|
||||
|
||||
WORKDIR /
|
||||
|
||||
CMD ["/watchdogs"]
|
|
@ -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");
|
||||
|
|
BIN
videos.db
BIN
videos.db
Binary file not shown.
Loading…
Add table
Reference in a new issue