mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-12-22 11:03:48 +01:00
fetch specific file id from server
This commit is contained in:
parent
fe5b2ec306
commit
25aba526b4
@ -191,7 +191,8 @@ function M.fetch_POST(request, response)
|
|||||||
|
|
||||||
local socket = printer:getId()
|
local socket = printer:getId()
|
||||||
local remote = settings.get('gcode_server')
|
local remote = settings.get('gcode_server')
|
||||||
io.popen("print-fetch.lua " .. socket .. " " .. remote)
|
local id = request:get("id")
|
||||||
|
io.popen("print-fetch.lua " .. socket .. " " .. remote .. " " .. id)
|
||||||
end
|
end
|
||||||
|
|
||||||
--requires: gcode(string) (the gcode to be appended)
|
--requires: gcode(string) (the gcode to be appended)
|
||||||
|
@ -10,7 +10,9 @@ local remote = arg[2]
|
|||||||
|
|
||||||
local finished = false
|
local finished = false
|
||||||
|
|
||||||
local info = JSON:decode(io.popen("wget -qO - " .. remote .. "/info/"):read("*a"))
|
local id = arg[3]
|
||||||
|
|
||||||
|
local info = JSON:decode(io.popen("wget -qO - " .. remote .. "/info/" .. id):read("*a"))
|
||||||
|
|
||||||
local current_line = 0
|
local current_line = 0
|
||||||
local total_lines = tonumber(info["lines"])
|
local total_lines = tonumber(info["lines"])
|
||||||
@ -18,7 +20,7 @@ local started = false
|
|||||||
|
|
||||||
while(not finished)
|
while(not finished)
|
||||||
do
|
do
|
||||||
local f = io.popen("wget -qO - " .. remote .. "/fetch/" .. current_line)
|
local f = io.popen("wget -qO - " .. remote .. "/fetch/" .. id .. "/" .. current_line)
|
||||||
local line = f:read()
|
local line = f:read()
|
||||||
while line ~= nil do
|
while line ~= nil do
|
||||||
printer:appendGcode(line)
|
printer:appendGcode(line)
|
||||||
|
Loading…
Reference in New Issue
Block a user