mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-07 10:31:46 +00:00
Vocoder upload pipeline seems to work!
This commit is contained in:
1 parent
8696613477
commit
28512b685e
7 files changed
+46
-10
No files matched your search
@@ -30,17 +30,17 @@ CREATE TABLE generic_download_jobs (
|
||||
-- The first upload type will be "hifigan_model"
|
||||
download_type VARCHAR(32) NOT NULL,
|
||||
|
||||
-- Assume the same URL can be uploaded more than once (in case of errors or
|
||||
-- people sharing models)
|
||||
|
||||
download_url VARCHAR(512) NOT NULL,
|
||||
|
||||
-- The user-supplied title of the upload
|
||||
-- This might have different meanings for different upload types
|
||||
-- The "name" of the voice model, which might be complicated.
|
||||
-- If maybe_subject_token (etc.) is set, then it's authoritative instead.
|
||||
title VARCHAR(255) NOT NULL,
|
||||
|
||||
-- Assume the same URL can be uploaded more than once (in case of errors or
|
||||
-- people sharing models)
|
||||
|
||||
download_url VARCHAR(512) NOT NULL,
|
||||
|
||||
-- ========== CREATOR DETAILS AND PREFERENCES ==========
|
||||
|
||||
-- Foreign key to user
|
||||
|
||||
+2
-2
@@ -34,12 +34,12 @@ SET
|
||||
"#,
|
||||
args.job_token,
|
||||
args.uuid_idempotency_token,
|
||||
args.download_type,
|
||||
args.download_type.to_str(),
|
||||
args.download_url,
|
||||
args.title,
|
||||
args.creator_user_token,
|
||||
args.creator_ip_address,
|
||||
args.creator_set_visibility,
|
||||
args.creator_set_visibility.to_str(),
|
||||
);
|
||||
|
||||
let query_result = query.execute(args.mysql_pool)
|
||||
|
||||
@@ -56,7 +56,7 @@ SET
|
||||
private_bucket_object_name = ?
|
||||
"#,
|
||||
&model_token,
|
||||
args.vocoder_type,
|
||||
args.vocoder_type.to_str(),
|
||||
&args.title,
|
||||
&args.original_download_url,
|
||||
&args.original_filename,
|
||||
@@ -64,7 +64,7 @@ SET
|
||||
&args.creator_user_token,
|
||||
&args.creator_ip_address,
|
||||
&args.creator_ip_address,
|
||||
args.creator_set_visibility,
|
||||
args.creator_set_visibility.to_str(),
|
||||
args.private_bucket_hash,
|
||||
private_bucket_object_name,
|
||||
)
|
||||
|
||||
@@ -59,6 +59,10 @@ impl Tokens {
|
||||
random_prefix_crockford_token("JWINF:", 32, false)
|
||||
}
|
||||
|
||||
pub fn new_generic_upload_job() -> AnyhowResult<String> {
|
||||
random_prefix_crockford_token("JGUP:", 32, false)
|
||||
}
|
||||
|
||||
pub fn new_firehose_event() -> AnyhowResult<String> {
|
||||
random_prefix_crockford_token("EV:", 32, false)
|
||||
}
|
||||
|
||||
@@ -10,6 +10,22 @@ pub enum GenericDownloadType {
|
||||
HifiGan,
|
||||
}
|
||||
|
||||
/// NB: Legacy API for older code.
|
||||
impl GenericDownloadType {
|
||||
pub fn to_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::HifiGan=> "hifigan",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_str(value: &str) -> Result<Self, String> {
|
||||
match value {
|
||||
"hifigan" => Ok(Self::HifiGan),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::generic_download_type::GenericDownloadType;
|
||||
|
||||
@@ -5,6 +5,22 @@ pub enum VocoderType {
|
||||
HifiGan,
|
||||
}
|
||||
|
||||
/// NB: Legacy API for older code.
|
||||
impl VocoderType {
|
||||
pub fn to_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::HifiGan=> "hifigan",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_str(value: &str) -> Result<Self, String> {
|
||||
match value {
|
||||
"hifigan" => Ok(Self::HifiGan),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::test_helpers::assert_serialization;
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ pub async fn enqueue_generic_download_handler(
|
||||
}
|
||||
|
||||
// This token is returned to the client.
|
||||
let job_token = Tokens::new_tts_model_upload_job()
|
||||
let job_token = Tokens::new_generic_upload_job()
|
||||
.map_err(|e| {
|
||||
warn!("Error creating token");
|
||||
EnqueueGenericDownloadError::ServerError
|
||||
|
||||
Reference in new issue
Block a user