forked from hummypkg/webif
41 lines
1020 B
Plaintext
Executable File
41 lines
1020 B
Plaintext
Executable File
#!/mod/bin/jimsh
|
|
|
|
source /mod/webif/lib/setup
|
|
require queue.class json
|
|
|
|
httpheader "application/json"
|
|
|
|
puts "\["
|
|
set flag 0
|
|
foreach q [queue all] {
|
|
set name [string map {
|
|
"/mnt/hd2/My Video/" ""
|
|
"/media/drive1/Video/" ""
|
|
"/media/" ""
|
|
".ts" ""
|
|
} [$q get file]]
|
|
set submitted [clock format [$q get submitted] \
|
|
-format {%d/%m/%Y %H:%M:%S}]
|
|
|
|
if {$flag} { puts "," } else { incr flag }
|
|
puts "{"
|
|
puts " \"qid\": [$q get id],"
|
|
puts " \"submitted\": \"$submitted\","
|
|
puts " \"file\": \"[::json::escape $name]\","
|
|
puts " \"action\": \"[::json::escape [$q get action]]\","
|
|
puts " \"args\": \"[::json::escape [$q get args]]\","
|
|
puts " \"status\": \"[$q get status]\","
|
|
puts " \"log\": \"[::json::escape [$q get log]]\","
|
|
if {[$q get runtime] > 0} {
|
|
set time [clock format [lindex [split [$q get runtime] .] 0] \
|
|
-format "%T"]
|
|
puts " \"runtime\": \"$time\","
|
|
} else {
|
|
puts " \"runtime\": \"0\","
|
|
}
|
|
puts " \"retries\": \"[$q get retries]\""
|
|
puts -nonewline "}"
|
|
}
|
|
puts "\n]"
|
|
|