Add Transcode Status Filter for Task Creation
All checks were successful
/ release (push) Successful in 39s

This commit is contained in:
Samuel Lorch 2024-07-06 16:35:59 +02:00
parent eb3cfbfdba
commit 8046093e9e
2 changed files with 10 additions and 1 deletions

View file

@ -260,6 +260,7 @@ func createTask(ctx context.Context, r *http.Request) error {
}
library := r.FormValue("library")
health := r.FormValue("health")
transcode := r.FormValue("transcode")
typ, err := strconv.Atoi(r.FormValue("type"))
if err != nil {
return fmt.Errorf("Parsing Task Type: %w", err)
@ -271,7 +272,7 @@ func createTask(ctx context.Context, r *http.Request) error {
slog.Info("Got Task Create", "library", library, "health", health, "type", typ)
rows, err := db.Query(r.Context(), "SELECT id, path, size, status, health, transcode, md5, updated_at FROM files where library_id = $1 AND status = $2 AND (-1 = $3 OR health = $3)", library, constants.FILE_STATUS_EXISTS, health)
rows, err := db.Query(r.Context(), "SELECT id, path, size, status, health, transcode, md5, updated_at FROM files where library_id = $1 AND status = $2 AND (-1 = $3 OR health = $3) AND (-1 = $4 OR transcode = $4)", library, constants.FILE_STATUS_EXISTS, health, transcode)
if err != nil {
return fmt.Errorf("Query Files: %w", err)
}

View file

@ -15,6 +15,14 @@
<option value="1">Damaged</option>
<option value="2">Healthy</option>
</select>
<label for="transcode">Transcode Status</label>
<select id="transcode" name="transcode">
<option value="-1">All</option>
<option value="0">Unknown</option>
<option value="1">None</option>
<option value="2">Failed</option>
<option value="2">Success</option>
</select>
<label for="type">Type</label>
<select id="type" name="type">
<option value="0">Health Check</option>