Skip to content

Commit

Permalink
Media data extraction task
Browse files Browse the repository at this point in the history
  • Loading branch information
fogodev committed Apr 29, 2024
1 parent b3b4050 commit a3016be
Show file tree
Hide file tree
Showing 6 changed files with 371 additions and 25 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 21 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[workspace]
resolver = "2"
members = [
"core",
"core/crates/*",
"crates/*",
"apps/cli",
"apps/p2p-relay",
"apps/desktop/src-tauri",
"apps/desktop/crates/*",
"apps/mobile/modules/sd-core/core",
"apps/mobile/modules/sd-core/android/crate",
"apps/mobile/modules/sd-core/ios/crate",
"apps/server",
"core",
"core/crates/*",
"crates/*",
"apps/cli",
"apps/p2p-relay",
"apps/desktop/src-tauri",
"apps/desktop/crates/*",
"apps/mobile/modules/sd-core/core",
"apps/mobile/modules/sd-core/android/crate",
"apps/mobile/modules/sd-core/ios/crate",
"apps/server",
]

[workspace.package]
Expand All @@ -22,19 +22,19 @@ repository = "https://github.com/spacedriveapp/spacedrive"
[workspace.dependencies]
# First party dependencies
prisma-client-rust = { git = "https://github.com/spacedriveapp/prisma-client-rust", rev = "f99d6f5566570f3ab1edecb7a172ad25b03d95af", features = [
"specta",
"sqlite-create-many",
"migrations",
"sqlite",
"specta",
"sqlite-create-many",
"migrations",
"sqlite",
], default-features = false }
prisma-client-rust-cli = { git = "https://github.com/spacedriveapp/prisma-client-rust", rev = "f99d6f5566570f3ab1edecb7a172ad25b03d95af", features = [
"specta",
"sqlite-create-many",
"migrations",
"sqlite",
"specta",
"sqlite-create-many",
"migrations",
"sqlite",
], default-features = false }
prisma-client-rust-sdk = { git = "https://github.com/spacedriveapp/prisma-client-rust", rev = "f99d6f5566570f3ab1edecb7a172ad25b03d95af", features = [
"sqlite",
"sqlite",
], default-features = false }

tracing = "0.1.40"
Expand Down Expand Up @@ -66,7 +66,7 @@ image = "0.24.7"
itertools = "0.12.0"
lending-stream = "1.0.0"
normpath = "1.1.1"
once_cell = "1.18.0"
once_cell = "1.19.0"
pin-project-lite = "0.2.13"
rand = "0.8.5"
rand_chacha = "0.3.1"
Expand Down
1 change: 1 addition & 0 deletions core/crates/heavy-lifting/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ futures-concurrency = { workspace = true }
globset = { workspace = true }
itertools = { workspace = true }
lending-stream = { workspace = true }
once_cell = { workspace = true }
prisma-client-rust = { workspace = true }
rmp-serde = { workspace = true }
rmpv = { workspace = true }
Expand Down
2 changes: 2 additions & 0 deletions core/crates/heavy-lifting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ pub enum NonCriticalError {
Indexer(#[from] indexer::NonCriticalError),
#[error(transparent)]
FileIdentifier(#[from] file_identifier::NonCriticalError),
#[error(transparent)]
MediaProcessor(#[from] media_processor::NonCriticalError),
}

#[repr(i32)]
Expand Down
18 changes: 18 additions & 0 deletions core/crates/heavy-lifting/src/media_processor/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
use sd_prisma::prisma::file_path;
use sd_utils::error::FileIOError;

use std::path::PathBuf;

use serde::{Deserialize, Serialize};
use specta::Type;

mod tasks;

#[derive(thiserror::Error, Debug)]
Expand All @@ -18,3 +24,15 @@ impl From<Error> for rspc::Error {
Self::with_cause(rspc::ErrorCode::InternalServerError, e.to_string(), e)
}
}

#[derive(thiserror::Error, Debug, Serialize, Deserialize, Type)]
pub enum NonCriticalError {
#[error("failed to extract media data from <image='{}'>: {1}", .0.display())]
FailedToExtractImageMediaData(PathBuf, String),
#[error("processing thread panicked while extracting media data from <image='{}'>: {1}", .0.display())]
PanicWhileExtractingImageMediaData(PathBuf, String),
#[error("file path missing object id: <file_path_id='{0}'>")]
FilePathMissingObjectId(file_path::id::Type),
#[error("failed to construct isolated file path data: <file_path_id='{0}'>: {1}")]
FailedToConstructIsolatedFilePathData(file_path::id::Type, String),
}
Loading

0 comments on commit a3016be

Please sign in to comment.