mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-15 06:12:18 +00:00
fixes for empty title, add duration field for engine assets
This commit is contained in:
1 parent
907c12c368
commit
cac930f1bc
10 files changed
+38
-14
No files matched your search
@@ -0,0 +1,13 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
-- Set all featured media items public
|
||||
-- NB: using join since subquery was doing a full table scan despite looking reasonable.
|
||||
UPDATE media_files m INNER JOIN featured_items items
|
||||
ON items.entity_token = m.token
|
||||
AND items.entity_type = 'media_file'
|
||||
SET m.creator_set_visibility = 'public'
|
||||
WHERE m.creator_set_visibility IN ('private', 'hidden')
|
||||
AND items.deleted_at IS NULL;
|
||||
|
||||
+3
-4
@@ -42,13 +42,10 @@ pub struct InsertMediaFileFromUploadArgs<'a> {
|
||||
|
||||
pub maybe_mime_type: Option<&'a str>,
|
||||
pub file_size_bytes: u64,
|
||||
pub duration_millis: u64,
|
||||
pub sha256_checksum: &'a str,
|
||||
|
||||
// TODO: Media duration.
|
||||
//pub duration_millis: u64,
|
||||
|
||||
pub maybe_title: Option<&'a str>,
|
||||
pub maybe_duration_millis: Option<u64>,
|
||||
|
||||
pub public_bucket_directory_hash: &'a str,
|
||||
pub maybe_public_bucket_prefix: Option<&'a str>,
|
||||
@@ -114,6 +111,7 @@ SET
|
||||
checksum_sha2 = ?,
|
||||
|
||||
maybe_title = ?,
|
||||
maybe_duration_millis = ?,
|
||||
|
||||
public_bucket_directory_hash = ?,
|
||||
maybe_public_bucket_prefix = ?,
|
||||
@@ -151,6 +149,7 @@ SET
|
||||
args.sha256_checksum,
|
||||
|
||||
args.maybe_title,
|
||||
args.maybe_duration_millis,
|
||||
|
||||
args.public_bucket_directory_hash,
|
||||
args.maybe_public_bucket_prefix,
|
||||
|
||||
+1
-1
@@ -209,7 +209,7 @@ pub async fn create_scene_handler(
|
||||
maybe_animation_type: None,
|
||||
maybe_mime_type: Some(mime_type),
|
||||
file_size_bytes: file_size_bytes as u64,
|
||||
duration_millis: 0, // None
|
||||
maybe_duration_millis: None,
|
||||
sha256_checksum: &hash,
|
||||
maybe_title: upload_media_request.title.as_deref(),
|
||||
public_bucket_directory_hash: public_upload_path.get_object_hash(),
|
||||
|
||||
+1
-1
@@ -334,7 +334,7 @@ pub async fn process_upload_media_file(
|
||||
maybe_animation_type: None,
|
||||
maybe_mime_type: Some(mime_type),
|
||||
file_size_bytes: file_size_bytes as u64,
|
||||
duration_millis: 0, // TODO
|
||||
maybe_duration_millis: None,
|
||||
sha256_checksum: &hash,
|
||||
maybe_title: upload_media_request.title.as_deref(),
|
||||
public_bucket_directory_hash: public_upload_path.get_object_hash(),
|
||||
|
||||
+1
-1
@@ -330,7 +330,7 @@ pub async fn upload_audio_media_file_handler(
|
||||
maybe_animation_type: None,
|
||||
maybe_mime_type: Some(&mimetype),
|
||||
file_size_bytes: file_size_bytes as u64,
|
||||
duration_millis: maybe_duration_millis.unwrap_or(0),
|
||||
maybe_duration_millis,
|
||||
sha256_checksum: &hash,
|
||||
maybe_title: maybe_title.as_deref(),
|
||||
public_bucket_directory_hash: public_upload_path.get_object_hash(),
|
||||
|
||||
+1
-1
@@ -220,7 +220,7 @@ pub async fn upload_engine_asset_media_file_handler(
|
||||
maybe_animation_type: upload_media_request.maybe_animation_type,
|
||||
maybe_mime_type: Some(mimetype),
|
||||
file_size_bytes: file_size_bytes as u64,
|
||||
duration_millis: 0,
|
||||
maybe_duration_millis: None, // NB: We're migrating to a new endpoint.
|
||||
sha256_checksum: &hash,
|
||||
maybe_title: upload_media_request.maybe_title.as_deref(),
|
||||
public_bucket_directory_hash: public_upload_path.get_object_hash(),
|
||||
|
||||
+1
-1
@@ -359,7 +359,7 @@ pub async fn process_upload_media_file(
|
||||
maybe_animation_type: None,
|
||||
maybe_mime_type: Some(mime_type),
|
||||
file_size_bytes: file_size_bytes as u64,
|
||||
duration_millis: 0, // TODO
|
||||
maybe_duration_millis: None, // TODO: Fix this?
|
||||
sha256_checksum: &hash,
|
||||
maybe_title: upload_media_request.title.as_deref(),
|
||||
public_bucket_directory_hash: public_upload_path.get_object_hash(),
|
||||
|
||||
+12
-2
@@ -71,6 +71,11 @@ pub struct UploadNewEngineAssetFileForm {
|
||||
#[multipart(limit = "2 KiB")]
|
||||
#[schema(value_type = Option<String>, format = Binary)]
|
||||
maybe_animation_type: Option<Text<MediaFileAnimationType>>,
|
||||
|
||||
/// Optional: The duration, for files that are animations.
|
||||
#[multipart(limit = "2 KiB")]
|
||||
#[schema(value_type = Option<u64>, format = Binary)]
|
||||
maybe_duration_millis: Option<Text<u64>>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, ToSchema)]
|
||||
@@ -170,9 +175,14 @@ pub async fn upload_new_engine_asset_media_file_handler(
|
||||
|
||||
let engine_category = form.engine_category.0;
|
||||
|
||||
let maybe_duration_millis = form.maybe_duration_millis
|
||||
.map(|duration| duration.0);
|
||||
|
||||
let maybe_animation_type = form.maybe_animation_type.map(|t| t.0);
|
||||
|
||||
let maybe_title = form.maybe_title.map(|title| title.to_string());
|
||||
let maybe_title = form.maybe_title
|
||||
.map(|title| title.trim().to_string())
|
||||
.filter(|title| !title.is_empty());
|
||||
|
||||
let creator_set_visibility = form.maybe_visibility
|
||||
.map(|visibility| visibility.0)
|
||||
@@ -263,7 +273,7 @@ pub async fn upload_new_engine_asset_media_file_handler(
|
||||
maybe_animation_type,
|
||||
maybe_mime_type: Some(mimetype),
|
||||
file_size_bytes: file_size_bytes as u64,
|
||||
duration_millis: 0,
|
||||
maybe_duration_millis,
|
||||
sha256_checksum: &hash,
|
||||
maybe_title: maybe_title.as_deref(),
|
||||
public_bucket_directory_hash: public_upload_path.get_object_hash(),
|
||||
|
||||
+4
-2
@@ -164,7 +164,9 @@ pub async fn upload_new_scene_media_file_handler(
|
||||
|
||||
// ==================== UPLOAD METADATA ==================== //
|
||||
|
||||
let maybe_title = form.maybe_title.map(|title| title.to_string());
|
||||
let maybe_title = form.maybe_title
|
||||
.map(|title| title.trim().to_string())
|
||||
.filter(|title| !title.is_empty());
|
||||
|
||||
let creator_set_visibility = form.maybe_visibility
|
||||
.map(|visibility| visibility.0)
|
||||
@@ -242,7 +244,7 @@ pub async fn upload_new_scene_media_file_handler(
|
||||
maybe_animation_type: None,
|
||||
maybe_mime_type: Some(MIMETYPE),
|
||||
file_size_bytes: file_size_bytes as u64,
|
||||
duration_millis: 0,
|
||||
maybe_duration_millis: None,
|
||||
sha256_checksum: &hash,
|
||||
maybe_title: maybe_title.as_deref(),
|
||||
public_bucket_directory_hash: public_upload_path.get_object_hash(),
|
||||
|
||||
+1
-1
@@ -229,7 +229,7 @@ pub async fn upload_video_media_file_handler(
|
||||
maybe_animation_type: None,
|
||||
maybe_mime_type: Some(mimetype),
|
||||
file_size_bytes: file_size_bytes as u64,
|
||||
duration_millis: mp4_info.duration_millis as u64,
|
||||
maybe_duration_millis: Some(mp4_info.duration_millis as u64),
|
||||
sha256_checksum: &hash,
|
||||
maybe_title: upload_media_request.title.as_deref(),
|
||||
public_bucket_directory_hash: public_upload_path.get_object_hash(),
|
||||
|
||||
Reference in new issue
Block a user