forked from hkc/cc-stuff
Fixed argument parsing
This commit is contained in:
parent
5e1d23b4bb
commit
abe0b37f7d
|
@ -33,11 +33,11 @@ while args[1] ~= nil and string.sub(args[1], 1, 1) == "-" do
|
||||||
elseif k == "J" or k == "info-json" then
|
elseif k == "J" or k == "info-json" then
|
||||||
local req = assert(http.get(table.remove(args, 1)))
|
local req = assert(http.get(table.remove(args, 1)))
|
||||||
local info = textutils.unserializeJSON(req.readAll())
|
local info = textutils.unserializeJSON(req.readAll())
|
||||||
delay = info.frametime
|
delay = info.frame_time
|
||||||
n_frames = info.frame_count
|
n_frames = info.frame_count
|
||||||
video_url = info.video
|
video_url = info.video
|
||||||
audio_url_l = info.audio.l
|
audio_url_l = info.audio.l
|
||||||
audio_url_l = info.audio.r
|
audio_url_r = info.audio.r
|
||||||
req.close()
|
req.close()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -52,7 +52,8 @@ if not speakers.l then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if #args < 3 and not n_frames and not video_url and not audio_url_l then
|
if not n_frames and not video_url and not audio_url_l then
|
||||||
|
if #args < 3 then
|
||||||
printError("Usage: video [-w] [-b BUFSZ] [-t THREADS] [-J URL] [-m MONITOR] [-l SPK_L] [-r SPK_R] [-d FRAME_T] <N_FRAMES> <VIDEO_TEMPLATE> <LEFT_CHANNEL> [RIGHT_CHANNEL]")
|
printError("Usage: video [-w] [-b BUFSZ] [-t THREADS] [-J URL] [-m MONITOR] [-l SPK_L] [-r SPK_R] [-d FRAME_T] <N_FRAMES> <VIDEO_TEMPLATE> <LEFT_CHANNEL> [RIGHT_CHANNEL]")
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
|
@ -61,6 +62,7 @@ else
|
||||||
audio_url_l = table.remove(args, 1)
|
audio_url_l = table.remove(args, 1)
|
||||||
audio_url_r = #args > 0 and table.remove(args, 1) or nil
|
audio_url_r = #args > 0 and table.remove(args, 1) or nil
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
print(string.format("Using monitor %s", peripheral.getName(monitor)))
|
print(string.format("Using monitor %s", peripheral.getName(monitor)))
|
||||||
if speakers.r then
|
if speakers.r then
|
||||||
|
|
Loading…
Reference in New Issue