Implement Queue Health On New File and Queue Transcode on Health Success
All checks were successful
/ release (push) Successful in 32s

This commit is contained in:
speatzle 2024-10-11 17:07:52 +02:00
parent f08a07e87d
commit 12f700d1d0
7 changed files with 60 additions and 24 deletions

View file

@ -18,8 +18,8 @@ type LibrariesData struct {
type Library struct {
ID string `db:"id"`
HealthCommand *int `db:"health_command"`
TranscodeCommand *int `db:"transcode_command"`
HealthCommandID *int `db:"health_command_id"`
TranscodeCommandID *int `db:"transcode_command_id"`
Name string `db:"name"`
Path string `db:"path"`
Enable bool `db:"enable"`
@ -102,21 +102,21 @@ func createLibrary(r *http.Request) error {
scan_changed_queue_transcode := r.FormValue("scan_changed_queue_transcode") == "on"
health_ok_queue_transcode := r.FormValue("health_ok_queue_transcode") == "on"
var health_command *int = nil
var transcode_command *int = nil
var health_command_id *int = nil
var transcode_command_id *int = nil
h, err := strconv.Atoi(r.FormValue("health_command"))
h, err := strconv.Atoi(r.FormValue("health_command_id"))
if err == nil {
health_command = &h
health_command_id = &h
}
t, err := strconv.Atoi(r.FormValue("transcode_command"))
t, err := strconv.Atoi(r.FormValue("transcode_command_id"))
if err == nil {
transcode_command = &t
transcode_command_id = &t
}
slog.Info("Got Library Create", "name", name, "path", path, "enable", enable)
_, err = db.Exec(r.Context(), "INSERT INTO Libraries (name, path, enable, scan_new_queue_health, scan_changed_queue_health, scan_new_queue_transcode, scan_changed_queue_transcode, health_ok_queue_transcode, transcode_replace, transcode_path, health_command, transcode_command) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12)", name, path, enable, scan_new_queue_health, scan_changed_queue_health, scan_new_queue_transcode, scan_changed_queue_transcode, health_ok_queue_transcode, transcode_replace, transcode_path, health_command, transcode_command)
_, err = db.Exec(r.Context(), "INSERT INTO Libraries (name, path, enable, scan_new_queue_health, scan_changed_queue_health, scan_new_queue_transcode, scan_changed_queue_transcode, health_ok_queue_transcode, transcode_replace, transcode_path, health_command_id, transcode_command_id) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12)", name, path, enable, scan_new_queue_health, scan_changed_queue_health, scan_new_queue_transcode, scan_changed_queue_transcode, health_ok_queue_transcode, transcode_replace, transcode_path, health_command_id, transcode_command_id)
if err != nil {
return fmt.Errorf("Inserting Library: %w", err)
}