#!"D:\Program Files\Fusion\eyeonScript.exe" -q
-- it is assumed that this is normal instalation of fusion or fusion slave, which has eyeon.scriptlib in its script path.
master = '192.168.10.5' -- default render master machine
remote = os.getenv('REMOTE_ADDR')
referer = os.getenv("HTTP_REFERER")
-- List of remote hosts from which operation is allowed.
ops = {
'192.168.10.12',
'192.168.10.16',
'192.168.10.18',
}
if eyeon.isin(ops,remote) then
operator=true
else
operator=false
end
function unescape (str)
str = string.gsub(str, "+", " ")
return string.gsub(str, "%%(%x%x)", function (x)
return strchar(tonumber(x, 16))
end)
end
function decode (s)
cgi={}
string.gsub(s, "([^&=]*)=([^&=]*)&?",
function (key, value)
key=unescape(key)
value=unescape(value)
cgi[key]=value
end)
end
function back()
if referer~=nil then
print("Location:"..referer)
end
end
decode(os.getenv("QUERY_STRING")) -- The magic :-)
if cgi["master"] then master=cgi["master"] end
f = Fusion(master)
if not f then
print()
print('No Fusion manager is running at '..master)
end
rm = f.RenderManager
attr=rm:GetAttrs()
jobs = rm:GetJobList()
slaves = rm:GetSlaveList()
--[[
RQUEUEB_Verbose = true
RQUEUES_QueueName = Autosave2007-07-19-0002
RQUEUEB_Paused = true
]]
if operator then
if cgi['up'] then
num=tonumber(cgi['up'])
rm:MoveJob(jobs[num], -1)
wait(1)
back()
end
if cgi['down'] then
num=tonumber(cgi['down'])
rm:MoveJob(jobs[num], 1)
wait(1)
back()
end
if cgi['rem'] then
numr=tonumber(cgi['rem'])
rm:RemoveJob(jobs[numr], 1)
wait(1)
back()
end
if cgi['sq'] then
rm:SaveQueue(attr.RQUEUES_QueueName)
back()
end
end
--SaveQueue
--RQUEUEB_Paused
--RQUEUES_QueueName
print("Content-type: text/html\n\n")
--os.getenv("SCRIPT_NAME")
print([[
Render Status ]]..master..[[
]])
if string.len(tostring(attr.RQUEUES_QueueName)) >1 then
print('Queue name: ('..attr.RQUEUES_QueueName..')')
else
print("QUEUE IS NOT SAVED!!!!!!!!!!!!!")
end
if operator then
print('[save queue]')
end
print([[
reloading in:
]])
table.sort(slaves)
if table.getn(slaves) == 0 then
print("No Slaves on "..master)
else
print([[
| Slave |
Status |
job |
Groups |
v |
|---|
]])
for i, v in slaves do
slv = v:GetAttrs()
job=''
if(slv.RSLVN_Status==9) then
job =eyeon.parseFilename(v:GetJob():GetAttrs().RJOBS_Name).FullName
end
print( [[
| ]]..slv.RSLVS_IP.." \t\t|\t\t"..slv.RSLVS_Name..[[ | ]]..slv.RSLVS_Status..[[ | ]]..job..[[ | ]]..slv.RSLVS_Groups..[[ | ]]..slv.RSLVS_Version..[[ |
]])
end
print([[
]])
end
print([[
| ## | Render job | Groups | Status | Done/Total-(Left) | Queued By | delete |
]])
if table.getn(jobs) == 0 then
print('| No Jobs In Queue |
')
else
for i,v in jobs do
a = v:GetAttrs()
print([[
| ]])
if operator then
print([[up | down]])
else
print('up | down')
end
print([[ |
]])
--print(td_e)
--dump(a.RJOBS_Name)
print(eyeon.parseFilename(a.RJOBS_Name).FullName..[[ |
]]..a.RJOBS_Groups..[[ |
]]..a.RJOBS_Status)
if a.RJOBN_RenderingFrames > 0 then
print(a.RJOBN_RenderingFrames)
end
print([[ |
]]..a.RJOBN_RenderedFrames..[[ / ]]..(a.RJOBN_UnrenderedFrames + a.RJOBN_RenderedFrames + a.RJOBN_RenderingFrames)..[[ - (]]..a.RJOBN_UnrenderedFrames..[[)]]..''..[[ |
]]..a.RJOBS_QueuedBy..[[ |
]])
if operator then
print([[X]])
else
print('X')
end
print([[ |
]])
end
end
print([[
]])