@@ -85,7 +85,13 @@ local config = tables.createArgumentTable(arg, {
85
85
helpPath = ' help' ,
86
86
configPath = ' config' ,
87
87
emptyPath = ' config' ,
88
- schema = CONFIG_SCHEMA
88
+ schema = CONFIG_SCHEMA ,
89
+ aliases = {
90
+ h = ' help' ,
91
+ ll = ' loglevel' ,
92
+ p = ' project' ,
93
+ s = ' source' ,
94
+ },
89
95
});
90
96
91
97
-- Apply configured log level
@@ -209,9 +215,11 @@ local function enqueueCommand(args, id, outputFile)
209
215
end
210
216
211
217
local function endExport (exportContext , webSocket , exitCode )
212
- exportContext .exitCode = exitCode
213
- webSocket :close ()
214
- Map .deleteValues (exportContexts , exportContext )
218
+ return webSocket :sendTextMessage (' \n -- exit code ' .. tostring (exitCode ).. ' ------\n\n ' ):finally (function ()
219
+ logger :info (' end export' )
220
+ Map .deleteValues (exportContexts , exportContext )
221
+ return webSocket :close ()
222
+ end )
215
223
end
216
224
217
225
local function startExportCommand (exportContext , webSocket , index )
@@ -331,6 +339,17 @@ local httpContexts = {
331
339
exportContexts [exportId ] = nil
332
340
end
333
341
end ,
342
+ [' getExport?method=POST' ] = function (exchange )
343
+ local exportId = exchange :getRequest ():getBody ()
344
+ local exportContext = exportContexts [exportId ]
345
+ if exportContext then
346
+ return {
347
+ commands = exportContext .commands ,
348
+ }
349
+ end
350
+ HttpExchange .notFound (exchange , ' Export not found' )
351
+ return false
352
+ end ,
334
353
[' export(requestJson)?method=POST&Content-Type=application/json' ] = function (exchange , parameters )
335
354
local commands = ffmpeg :createCommands (parameters .filename , parameters .parts , parameters .options or {}, parameters .seekDelayMs )
336
355
local exportId = strings .formatInteger (system .currentTimeMillis (), 64 )
@@ -356,6 +375,7 @@ local httpContexts = {
356
375
end
357
376
table.insert (header , ' ' )
358
377
webSocket :sendTextMessage (table.concat (header , ' \n ' ))
378
+ logger :info (' start export %s' , exportId )
359
379
startExportCommand (exportContext , webSocket , 1 )
360
380
end
361
381
}),
0 commit comments