mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 17:38:10 +00:00
store scene token in engine render record
This commit is contained in:
1 parent
0d2580f481
commit
bede3246e9
9 files changed
+63
-21
No files matched your search
+26
-10
@@ -23,56 +23,68 @@ use crate::queries::generic_synthetic_ids::transactional_increment_generic_synth
|
||||
pub struct InsertArgs<'a> {
|
||||
pub pool: &'a MySqlPool,
|
||||
|
||||
// Creator info
|
||||
pub maybe_creator_user_token: Option<&'a UserToken>,
|
||||
pub maybe_creator_anonymous_visitor_token: Option<&'a AnonymousVisitorTrackingToken>,
|
||||
pub creator_ip_address: &'a str,
|
||||
pub creator_set_visibility: Visibility,
|
||||
|
||||
// Important database indices
|
||||
pub media_class: MediaFileClass,
|
||||
pub media_type: MediaFileType,
|
||||
// TODO: is_intermediate_system_file, is_user_upload
|
||||
|
||||
// Origin and categorization
|
||||
// Product and other origination information
|
||||
pub origin_category: MediaFileOriginCategory,
|
||||
pub origin_product_category: MediaFileOriginProductCategory,
|
||||
pub maybe_origin_model_type: Option<MediaFileOriginModelType>,
|
||||
pub maybe_origin_model_token: Option<&'a ModelWeightToken>,
|
||||
pub maybe_origin_filename: Option<String>,
|
||||
|
||||
// If batch generated, this is the batch token.
|
||||
pub maybe_batch_token: Option<&'a BatchGenerationToken>,
|
||||
|
||||
// Media info
|
||||
pub maybe_mime_type: Option<&'a str>,
|
||||
|
||||
pub file_size_bytes: u64,
|
||||
pub maybe_duration_millis: Option<u64>,
|
||||
pub maybe_audio_encoding: Option<&'a str>,
|
||||
pub maybe_video_encoding: Option<&'a str>,
|
||||
pub maybe_frame_width: Option<u32>,
|
||||
pub maybe_frame_height: Option<u32>,
|
||||
pub maybe_prompt_token: Option<&'a PromptToken>,
|
||||
pub checksum_sha2: &'a str,
|
||||
|
||||
// User text information
|
||||
pub maybe_title: Option<&'a str>,
|
||||
pub maybe_text_transcript: Option<&'a str>,
|
||||
|
||||
// If generated from a scene, this is the scene media file token.
|
||||
pub maybe_scene_source_media_file_token: Option<&'a MediaFileToken>,
|
||||
|
||||
// If additional prompt details are stored, this is the prompt token.
|
||||
pub maybe_prompt_token: Option<&'a PromptToken>,
|
||||
|
||||
// If batch generated, this is the batch token.
|
||||
pub maybe_batch_token: Option<&'a BatchGenerationToken>,
|
||||
|
||||
// Storage details
|
||||
pub public_bucket_directory_hash: &'a str,
|
||||
pub maybe_public_bucket_prefix: Option<&'a str>,
|
||||
pub maybe_public_bucket_extension: Option<&'a str>,
|
||||
|
||||
// Counters
|
||||
pub maybe_creator_file_synthetic_id_category: IdCategory,
|
||||
pub maybe_creator_category_synthetic_id_category: IdCategory,
|
||||
|
||||
/// Extra polymorphic data stored in `extra_file_modification_info`
|
||||
/// Extra polymorphic data stored in `extra_file_modification_info` column.
|
||||
/// This differs on a per media type basis and can depend on the product
|
||||
/// that generates the media file.
|
||||
pub maybe_extra_media_info: Option<&'a MediaFileExtraInfo>,
|
||||
|
||||
// Modification and generation info
|
||||
pub maybe_mod_user_token: Option<&'a UserToken>,
|
||||
// Worker generation info
|
||||
pub is_generated_on_prem: bool,
|
||||
pub generated_by_worker: Option<&'a str>,
|
||||
pub generated_by_cluster: Option<&'a str>,
|
||||
|
||||
// Moderation details (deprecated)
|
||||
pub maybe_mod_user_token: Option<&'a UserToken>,
|
||||
}
|
||||
|
||||
pub async fn insert_media_file_generic(
|
||||
@@ -140,6 +152,8 @@ pub async fn insert_media_file_generic(
|
||||
maybe_title = ?,
|
||||
maybe_text_transcript = ?,
|
||||
|
||||
maybe_scene_source_media_file_token = ?,
|
||||
|
||||
public_bucket_directory_hash = ?,
|
||||
maybe_public_bucket_prefix = ?,
|
||||
maybe_public_bucket_extension = ?,
|
||||
@@ -187,6 +201,8 @@ pub async fn insert_media_file_generic(
|
||||
args.maybe_title,
|
||||
args.maybe_text_transcript,
|
||||
|
||||
args.maybe_scene_source_media_file_token.map(|t| t.as_str()),
|
||||
|
||||
args.public_bucket_directory_hash,
|
||||
args.maybe_public_bucket_prefix,
|
||||
args.maybe_public_bucket_extension,
|
||||
@@ -219,4 +235,4 @@ pub async fn insert_media_file_generic(
|
||||
|
||||
transaction.commit().await?;
|
||||
Ok((result_token, record_id))
|
||||
}
|
||||
}
|
||||
+23
-10
@@ -8,7 +8,6 @@ use enums::by_table::media_files::media_file_origin_model_type::MediaFileOriginM
|
||||
use enums::by_table::media_files::media_file_origin_product_category::MediaFileOriginProductCategory;
|
||||
use enums::by_table::media_files::media_file_type::MediaFileType;
|
||||
use errors::AnyhowResult;
|
||||
use tokens::tokens::anonymous_visitor_tracking::AnonymousVisitorTrackingToken;
|
||||
use tokens::tokens::batch_generations::BatchGenerationToken;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
@@ -21,53 +20,66 @@ use crate::queries::media_files::create::generic_insert::insert_media_file_gener
|
||||
|
||||
pub struct InsertFromJobArgs<'a> {
|
||||
pub pool: &'a MySqlPool,
|
||||
|
||||
// Job record provides some information: creator details, IP address, etc.
|
||||
pub job: &'a AvailableInferenceJob,
|
||||
|
||||
// Important database indices
|
||||
pub media_class: MediaFileClass,
|
||||
pub media_type: MediaFileType,
|
||||
// TODO: is_intermediate_system_file, is_user_upload
|
||||
|
||||
// Origin and categorization
|
||||
// Product and other origination information
|
||||
pub origin_category: MediaFileOriginCategory,
|
||||
pub origin_product_category: MediaFileOriginProductCategory,
|
||||
pub maybe_origin_model_type: Option<MediaFileOriginModelType>,
|
||||
pub maybe_origin_model_token: Option<&'a ModelWeightToken>,
|
||||
pub maybe_origin_filename: Option<String>,
|
||||
|
||||
// If batch generated, this is the batch token.
|
||||
pub maybe_batch_token: Option<&'a BatchGenerationToken>,
|
||||
|
||||
// Media info
|
||||
pub maybe_mime_type: Option<&'a str>,
|
||||
|
||||
pub file_size_bytes: u64,
|
||||
pub maybe_duration_millis: Option<u64>,
|
||||
pub maybe_audio_encoding: Option<&'a str>,
|
||||
pub maybe_video_encoding: Option<&'a str>,
|
||||
pub maybe_frame_width: Option<u32>,
|
||||
pub maybe_frame_height: Option<u32>,
|
||||
pub maybe_prompt_token: Option<&'a PromptToken>,
|
||||
pub checksum_sha2: &'a str,
|
||||
|
||||
// User text information
|
||||
pub maybe_title: Option<&'a str>,
|
||||
pub maybe_text_transcript: Option<&'a str>,
|
||||
|
||||
// If generated from a scene, this is the scene media file token.
|
||||
pub maybe_scene_source_media_file_token: Option<&'a MediaFileToken>,
|
||||
|
||||
// If additional prompt details are stored, this is the prompt token.
|
||||
pub maybe_prompt_token: Option<&'a PromptToken>,
|
||||
|
||||
// If batch generated, this is the batch token.
|
||||
pub maybe_batch_token: Option<&'a BatchGenerationToken>,
|
||||
|
||||
// Storage details
|
||||
pub public_bucket_directory_hash: &'a str,
|
||||
pub maybe_public_bucket_prefix: Option<&'a str>,
|
||||
pub maybe_public_bucket_extension: Option<&'a str>,
|
||||
|
||||
// Counters
|
||||
pub maybe_creator_file_synthetic_id_category: IdCategory,
|
||||
pub maybe_creator_category_synthetic_id_category: IdCategory,
|
||||
|
||||
/// Extra polymorphic data stored in `extra_file_modification_info`
|
||||
/// Extra polymorphic data stored in `extra_file_modification_info` column.
|
||||
/// This differs on a per media type basis and can depend on the product
|
||||
/// that generates the media file.
|
||||
pub maybe_extra_media_info: Option<&'a MediaFileExtraInfo>,
|
||||
|
||||
// Modification and generation info
|
||||
pub maybe_mod_user_token: Option<&'a UserToken>,
|
||||
// Worker generation info
|
||||
pub is_generated_on_prem: bool,
|
||||
pub generated_by_worker: Option<&'a str>,
|
||||
pub generated_by_cluster: Option<&'a str>,
|
||||
|
||||
// Moderation details (deprecated)
|
||||
pub maybe_mod_user_token: Option<&'a UserToken>,
|
||||
}
|
||||
|
||||
pub async fn insert_media_file_generic_from_job(
|
||||
@@ -100,6 +112,7 @@ pub async fn insert_media_file_generic_from_job(
|
||||
maybe_prompt_token: args.maybe_prompt_token,
|
||||
maybe_public_bucket_extension: args.maybe_public_bucket_extension,
|
||||
maybe_public_bucket_prefix: args.maybe_public_bucket_prefix,
|
||||
maybe_scene_source_media_file_token: args.maybe_scene_source_media_file_token,
|
||||
maybe_text_transcript: args.maybe_text_transcript,
|
||||
maybe_title: args.maybe_title,
|
||||
maybe_video_encoding: args.maybe_video_encoding,
|
||||
|
||||
+1
@@ -88,6 +88,7 @@ pub async fn insert_media_file_from_gptsovits(
|
||||
maybe_prompt_token: None,
|
||||
maybe_extra_media_info: None,
|
||||
maybe_mod_user_token: None,
|
||||
maybe_scene_source_media_file_token: None,
|
||||
}).await?;
|
||||
|
||||
Ok(new_media_token)
|
||||
|
||||
+1
@@ -99,6 +99,7 @@ pub async fn insert_media_file_from_live_portrait(
|
||||
maybe_batch_token: None,
|
||||
maybe_prompt_token: None,
|
||||
maybe_mod_user_token: None,
|
||||
maybe_scene_source_media_file_token: None,
|
||||
}).await?;
|
||||
|
||||
Ok(new_media_token)
|
||||
|
||||
+6
@@ -24,6 +24,9 @@ pub struct InsertStudioSceneRenderArgs<'a> {
|
||||
pub creator_ip_address: &'a str,
|
||||
pub creator_set_visibility: Visibility,
|
||||
|
||||
// If generated from a scene, this is the scene media file token.
|
||||
pub maybe_scene_source_media_file_token: Option<&'a MediaFileToken>,
|
||||
|
||||
// Probably mp4, but could change.
|
||||
pub media_type: MediaFileType,
|
||||
pub maybe_mime_type: Option<&'a str>,
|
||||
@@ -70,6 +73,9 @@ pub async fn insert_media_file_from_studio_scene_render(
|
||||
// Dynamic bits (file data)
|
||||
maybe_title: args.maybe_title,
|
||||
|
||||
// Dynamic bits (foreign keys)
|
||||
maybe_scene_source_media_file_token: args.maybe_scene_source_media_file_token,
|
||||
|
||||
// Dynamic bits (bucket storage)
|
||||
public_bucket_directory_hash: args.public_bucket_directory_hash,
|
||||
maybe_public_bucket_prefix: args.maybe_public_bucket_prefix,
|
||||
|
||||
+1
@@ -216,6 +216,7 @@ pub async fn process_job(args: FbxToGltfJobArgs<'_>) -> Result<JobSuccessResult,
|
||||
generated_by_cluster: Some(&args.job_dependencies.job.info.container.cluster_name),
|
||||
maybe_text_transcript: None,
|
||||
maybe_title: None,
|
||||
maybe_scene_source_media_file_token: None,
|
||||
})
|
||||
.await
|
||||
.map_err(|e| ProcessSingleJobError::Other(e))?;
|
||||
|
||||
+1
@@ -286,6 +286,7 @@ pub async fn process_job_inference(
|
||||
generated_by_worker: Some(&args.job_dependencies.job.info.container.hostname),
|
||||
generated_by_cluster: Some(&args.job_dependencies.job.info.container.cluster_name),
|
||||
maybe_title: None,
|
||||
maybe_scene_source_media_file_token: None,
|
||||
}).await?;
|
||||
|
||||
if maybe_first_media_file_token.is_none() {
|
||||
|
||||
+1
@@ -285,6 +285,7 @@ pub async fn process_job(args: BvhToWorkflowJobArgs<'_>) -> Result<JobSuccessRes
|
||||
generated_by_cluster: Some(&args.job_dependencies.job.info.container.cluster_name),
|
||||
maybe_title: None,
|
||||
maybe_text_transcript: None,
|
||||
maybe_scene_source_media_file_token: None, // TODO: The scene token should be available, but we might not revisit this job
|
||||
})
|
||||
.await
|
||||
.map_err(|e| ProcessSingleJobError::Other(e))?;
|
||||
|
||||
+3
-1
@@ -296,9 +296,11 @@ pub async fn upload_studio_shot_media_file_handler(
|
||||
file_size_bytes,
|
||||
maybe_audio_encoding: None, // TODO
|
||||
maybe_video_encoding: None, // TODO
|
||||
//maybe_scene_source_media_file_token: None, // TODO
|
||||
//is_intermediate_system_file: false, // TODO
|
||||
// TODO: Frame rate.
|
||||
maybe_scene_source_media_file_token: form.maybe_scene_source_media_file_token
|
||||
.as_ref()
|
||||
.map(|token| &token.0),
|
||||
maybe_frame_width: video_file_details
|
||||
.dimensions
|
||||
.as_ref()
|
||||
|
||||
Reference in new issue
Block a user