diff --git a/Cargo.lock b/Cargo.lock index 0def4cd..d933457 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -996,6 +996,28 @@ dependencies = [ "regex-automata 0.1.10", ] +[[package]] +name = "maud" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df518b75016b4289cdddffa1b01f2122f4a49802c93191f3133f6dc2472ebcaa" +dependencies = [ + "itoa", + "maud_macros", +] + +[[package]] +name = "maud_macros" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa453238ec218da0af6b11fc5978d3b5c3a45ed97b722391a2a11f3306274e18" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "md-5" version = "0.10.6" @@ -1353,6 +1375,29 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro2" version = "1.0.83" @@ -2626,6 +2671,7 @@ dependencies = [ "futures", "hex", "log", + "maud", "rayon", "regex", "ring", diff --git a/Cargo.toml b/Cargo.toml index df2454a..a040f9b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,3 +20,4 @@ serde_json = "1.0.111" tokio = { version = "1.35.1", features = ["full"] } uuid = { version = "1.8.0", features = ["v4", "serde"] } sqlx = { version = "0.8", features = ["postgres", "runtime-tokio-native-tls", "derive", "uuid", "chrono", "json"] } +maud = "0.26.0" diff --git a/migrations/0001_init.sql b/migrations/0001_init.sql index 26e02dc..877c1ac 100644 --- a/migrations/0001_init.sql +++ b/migrations/0001_init.sql @@ -4,7 +4,6 @@ CREATE TABLE IF NOT EXISTS "youtube_meta" ( "description" TEXT, "uploader_name" TEXT, "uploader_id" TEXT, - "duration" INTEGER, "views" INTEGER, "upload_date" DATE, PRIMARY KEY("id") @@ -28,8 +27,8 @@ CREATE TABLE IF NOT EXISTS "videos" ( "id" UUID NOT NULL PRIMARY KEY DEFAULT gen_random_uuid(), "directory" TEXT NOT NULL, "path" TEXT NOT NULL, - "duration" INTEGER, - "title" TEXT, + "duration" FLOAT NOT NULL, + "title" TEXT NOT NULL, "youtube_id" TEXT, FOREIGN KEY("youtube_id") REFERENCES "youtube_meta"("id") ); diff --git a/src/library/mod.rs b/src/library/mod.rs index 1448cf0..59dc468 100644 --- a/src/library/mod.rs +++ b/src/library/mod.rs @@ -42,7 +42,7 @@ impl Library { } pub async fn get_directory_videos(&self, dir: &str) -> Vec