fix task creation

This commit is contained in:
Samuel Lorch 2024-06-23 23:01:42 +02:00
parent f861758704
commit 7232c30cfb

View file

@ -197,6 +197,10 @@ func createTask(ctx context.Context, r *http.Request) error {
if err != nil {
return fmt.Errorf("Parsing Task Type: %w", err)
}
ffmpeg_command, err := strconv.Atoi(r.FormValue("ffmpeg_command"))
if err != nil {
return fmt.Errorf("Parsing FFmpeg Command: %w", err)
}
slog.Info("Got Task Create", "library", library, "health", health, "type", typ)
@ -237,7 +241,7 @@ func createTask(ctx context.Context, r *http.Request) error {
*/
for _, file := range files {
_, err = db.Exec(r.Context(), "INSERT INTO tasks (file_id, type, status, data) VALUES ($1,$2,$3,$4)", file.ID, typ, constants.TASK_STATUS_QUEUED, data)
_, err = db.Exec(r.Context(), "INSERT INTO tasks (file_id, type, status, data, ffmpeg_command_id) VALUES ($1,$2,$3,$4,$5)", file.ID, typ, constants.TASK_STATUS_QUEUED, data, ffmpeg_command)
if err != nil {
return fmt.Errorf("Inserting Task: %w", err)
}