fix: scan extensions add jpg/png, /files status from DB (2/4 M4 items)
This commit is contained in:
@@ -94,7 +94,7 @@ async fn list_files(
|
|||||||
file_uuid: r.file_uuid,
|
file_uuid: r.file_uuid,
|
||||||
file_name: r.file_name,
|
file_name: r.file_name,
|
||||||
file_path: r.file_path,
|
file_path: r.file_path,
|
||||||
status: "ready".to_string(), // Hardcoded for now
|
status: r.status.unwrap_or_default(),
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
|||||||
@@ -1891,7 +1891,7 @@ async fn scan_files(State(state): State<AppState>) -> Result<Json<ScanFilesRespo
|
|||||||
.unwrap_or_else(|_| "/Users/accusys/momentry/var/sftpgo/data/demo".to_string());
|
.unwrap_or_else(|_| "/Users/accusys/momentry/var/sftpgo/data/demo".to_string());
|
||||||
let demo_dir = std::path::Path::new(&demo_dir_str);
|
let demo_dir = std::path::Path::new(&demo_dir_str);
|
||||||
|
|
||||||
let allowed_extensions = vec!["mp4", "mov", "mkv", "avi", "webm"];
|
let allowed_extensions = vec!["mp4", "mov", "mkv", "avi", "webm", "jpg", "jpeg", "png", "gif", "webp"];
|
||||||
|
|
||||||
// 1. Get registered files from DB (Map key: absolute file_path)
|
// 1. Get registered files from DB (Map key: absolute file_path)
|
||||||
let table = schema::table_name("videos");
|
let table = schema::table_name("videos");
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ pub struct FileRecord {
|
|||||||
pub file_uuid: String,
|
pub file_uuid: String,
|
||||||
pub file_path: String,
|
pub file_path: String,
|
||||||
pub file_name: String,
|
pub file_name: String,
|
||||||
|
pub status: Option<String>,
|
||||||
pub probe_json: Option<serde_json::Value>,
|
pub probe_json: Option<serde_json::Value>,
|
||||||
pub created_at: Option<chrono::DateTime<chrono::Utc>>,
|
pub created_at: Option<chrono::DateTime<chrono::Utc>>,
|
||||||
}
|
}
|
||||||
@@ -2358,7 +2359,7 @@ impl PostgresDb {
|
|||||||
|
|
||||||
pub async fn list_files(&self, limit: i32, offset: i64) -> Result<Vec<FileRecord>> {
|
pub async fn list_files(&self, limit: i32, offset: i64) -> Result<Vec<FileRecord>> {
|
||||||
let query = r#"
|
let query = r#"
|
||||||
SELECT file_uuid, file_path, file_name, probe_json, created_at
|
SELECT file_uuid, file_path, file_name, status, probe_json, created_at
|
||||||
FROM videos
|
FROM videos
|
||||||
ORDER BY created_at DESC
|
ORDER BY created_at DESC
|
||||||
LIMIT $1 OFFSET $2
|
LIMIT $1 OFFSET $2
|
||||||
@@ -2375,9 +2376,8 @@ impl PostgresDb {
|
|||||||
|
|
||||||
pub async fn get_file_by_uuid(&self, uuid: &str) -> Result<Option<FileRecord>> {
|
pub async fn get_file_by_uuid(&self, uuid: &str) -> Result<Option<FileRecord>> {
|
||||||
let query = r#"
|
let query = r#"
|
||||||
SELECT file_uuid, file_path, file_name, probe_json, created_at
|
SELECT file_uuid, file_path, file_name, status, probe_json, created_at
|
||||||
FROM videos
|
FROM videos WHERE file_uuid = $1
|
||||||
WHERE file_uuid = $1
|
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
let row = sqlx::query_as(query)
|
let row = sqlx::query_as(query)
|
||||||
|
|||||||
Reference in New Issue
Block a user