Added set sail button and much nicer artist enrichment

This commit is contained in:
Connor Johnstone
2026-03-18 14:54:52 -04:00
parent 8b16859526
commit ff41233a96
8 changed files with 251 additions and 13 deletions

View File

@@ -24,6 +24,7 @@ pub struct TaskInfo {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
pub enum TaskStatus {
Pending,
Running,
Completed,
Failed,
@@ -56,6 +57,29 @@ impl TaskManager {
id
}
/// Register a new task as Pending (queued, not yet running). Returns the task ID.
pub fn register_pending(&self, task_type: &str) -> String {
let id = uuid::Uuid::new_v4().to_string();
let info = TaskInfo {
id: id.clone(),
task_type: task_type.to_string(),
status: TaskStatus::Pending,
progress: None,
started_at: Utc::now().naive_utc(),
completed_at: None,
result: None,
};
self.tasks.lock().unwrap().insert(id.clone(), info);
id
}
/// Transition a task from Pending to Running.
pub fn start(&self, id: &str) {
if let Some(task) = self.tasks.lock().unwrap().get_mut(id) {
task.status = TaskStatus::Running;
}
}
/// Update progress on a running task.
pub fn update_progress(&self, id: &str, current: u64, total: u64, message: &str) {
if let Some(task) = self.tasks.lock().unwrap().get_mut(id) {