From 43ff9215fb10a7d26da2c6154a0a969ea0388175 Mon Sep 17 00:00:00 2001 From: osmarks Date: Wed, 26 Jun 2024 20:02:12 +0100 Subject: [PATCH] File metadata storage. The backend now knows how big images are, so the frontend can size images correctly before they're loaded. This should significantly improve the UI on slow connections. Also fix bug where videos weren't erased from the index properly. --- .gitignore | 3 +- ...50803117eea987d16e403a2c6873e31200ac3.json | 20 +++ ...c4e14cd25c2d08ea2b2731bd640be6539edce.json | 12 ++ ...a7042dc7b6e4d5948e53a6668df7b00dee3b.json} | 6 +- ...55e0f6503fddd369f2c3031f39c0759bb97a0.json | 6 + clipfront2/src/App.svelte | 4 +- src/main.rs | 166 +++++++++++++----- src/video_reader.rs | 16 +- 8 files changed, 177 insertions(+), 56 deletions(-) create mode 100644 .sqlx/query-80b42ff05db7c2ccd104f2c3e8b50803117eea987d16e403a2c6873e31200ac3.json create mode 100644 .sqlx/query-de6df63baa6ab4102d815e8d84bc4e14cd25c2d08ea2b2731bd640be6539edce.json rename .sqlx/{query-fccbb4262990c387079141c60a96d4e030ff82b93975f13d96539957b24f3c13.json => query-e5c8968dfb8e42d465912cde4ad8a7042dc7b6e4d5948e53a6668df7b00dee3b.json} (54%) diff --git a/.gitignore b/.gitignore index 536110d..c804eb0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ meme-rater/deploy_for_training.sh node_modules/* node_modules *sqlite3* -thumbtemp \ No newline at end of file +thumbtemp +mse-test-db-small \ No newline at end of file diff --git a/.sqlx/query-80b42ff05db7c2ccd104f2c3e8b50803117eea987d16e403a2c6873e31200ac3.json b/.sqlx/query-80b42ff05db7c2ccd104f2c3e8b50803117eea987d16e403a2c6873e31200ac3.json new file mode 100644 index 0000000..07fcd2f --- /dev/null +++ b/.sqlx/query-80b42ff05db7c2ccd104f2c3e8b50803117eea987d16e403a2c6873e31200ac3.json @@ -0,0 +1,20 @@ +{ + "db_name": "SQLite", + "query": "PRAGMA user_version", + "describe": { + "columns": [ + { + "name": "user_version", + "ordinal": 0, + "type_info": "Int" + } + ], + "parameters": { + "Right": 0 + }, + "nullable": [ + null + ] + }, + "hash": "80b42ff05db7c2ccd104f2c3e8b50803117eea987d16e403a2c6873e31200ac3" +} diff --git a/.sqlx/query-de6df63baa6ab4102d815e8d84bc4e14cd25c2d08ea2b2731bd640be6539edce.json b/.sqlx/query-de6df63baa6ab4102d815e8d84bc4e14cd25c2d08ea2b2731bd640be6539edce.json new file mode 100644 index 0000000..209e84c --- /dev/null +++ b/.sqlx/query-de6df63baa6ab4102d815e8d84bc4e14cd25c2d08ea2b2731bd640be6539edce.json @@ -0,0 +1,12 @@ +{ + "db_name": "SQLite", + "query": "UPDATE files SET metadata = ? WHERE filename = ?", + "describe": { + "columns": [], + "parameters": { + "Right": 2 + }, + "nullable": [] + }, + "hash": "de6df63baa6ab4102d815e8d84bc4e14cd25c2d08ea2b2731bd640be6539edce" +} diff --git a/.sqlx/query-fccbb4262990c387079141c60a96d4e030ff82b93975f13d96539957b24f3c13.json b/.sqlx/query-e5c8968dfb8e42d465912cde4ad8a7042dc7b6e4d5948e53a6668df7b00dee3b.json similarity index 54% rename from .sqlx/query-fccbb4262990c387079141c60a96d4e030ff82b93975f13d96539957b24f3c13.json rename to .sqlx/query-e5c8968dfb8e42d465912cde4ad8a7042dc7b6e4d5948e53a6668df7b00dee3b.json index a90ef33..ffba974 100644 --- a/.sqlx/query-fccbb4262990c387079141c60a96d4e030ff82b93975f13d96539957b24f3c13.json +++ b/.sqlx/query-e5c8968dfb8e42d465912cde4ad8a7042dc7b6e4d5948e53a6668df7b00dee3b.json @@ -1,12 +1,12 @@ { "db_name": "SQLite", - "query": "INSERT OR REPLACE INTO files (filename, embedding_time, thumbnail_time) VALUES (?, ?, ?)", + "query": "INSERT OR REPLACE INTO files (filename, embedding_time, thumbnail_time, metadata) VALUES (?, ?, ?, ?)", "describe": { "columns": [], "parameters": { - "Right": 3 + "Right": 4 }, "nullable": [] }, - "hash": "fccbb4262990c387079141c60a96d4e030ff82b93975f13d96539957b24f3c13" + "hash": "e5c8968dfb8e42d465912cde4ad8a7042dc7b6e4d5948e53a6668df7b00dee3b" } diff --git a/.sqlx/query-ec2da4ab11ede7a9a468ff3a50c55e0f6503fddd369f2c3031f39c0759bb97a0.json b/.sqlx/query-ec2da4ab11ede7a9a468ff3a50c55e0f6503fddd369f2c3031f39c0759bb97a0.json index b362e6b..8387e5a 100644 --- a/.sqlx/query-ec2da4ab11ede7a9a468ff3a50c55e0f6503fddd369f2c3031f39c0759bb97a0.json +++ b/.sqlx/query-ec2da4ab11ede7a9a468ff3a50c55e0f6503fddd369f2c3031f39c0759bb97a0.json @@ -42,6 +42,11 @@ "name": "thumbnails", "ordinal": 7, "type_info": "Blob" + }, + { + "name": "metadata", + "ordinal": 8, + "type_info": "Blob" } ], "parameters": { @@ -55,6 +60,7 @@ true, true, true, + true, true ] }, diff --git a/clipfront2/src/App.svelte b/clipfront2/src/App.svelte index 5b60163..acfc207 100644 --- a/clipfront2/src/App.svelte +++ b/clipfront2/src/App.svelte @@ -137,7 +137,7 @@ {#each displayedResults as result} {#key `${queryCounter}${result.file}`} -
+
{#if util.hasFormat(results, result, "VIDEO")}