Lua - Auto Show Report...

Open Source software contributions and discussions that supplement or extend the Palette / Light Palette software
Post Reply
User avatar
JohnGrimshaw
Posts: 1233
Joined: Tue Oct 16, 2007 12:51 pm
Primary Venue / Use: Other
Where I Am: International Man of Mystery
Location: Sydney, Australia
Contact:

Lua - Auto Show Report...

Post by JohnGrimshaw » Fri Jun 20, 2008 8:06 am

OK - here is a neat combination of tools. Use this to teach yourself how to trigger LUA code, and understand how to make minor modifications to it to suit your installation...

This Lua code allows you to trigger and EXTERNAL TEXT FILE as a lua script:
dofile('D:\\current_show.txt')

If nothing else, this makes it MUCH easier to edit code quickly once you know what you are doing. In the attached zip file, you will find that text file. ALL it does is "name" some variables. Unzip this and the other files to your D drive of your Palette.

Then, in the FIRST cue of your show, you have the following code:
dofile('D:\\current_show.txt')
dofile('D:\\LuaCode\\current_show_start.txt')


In the LAST cue of ACT 1, you have the following code:
dofile('D:\\current_show.txt')
dofile('D:\\LuaCode\\current_show_interval_start.txt')


In the FIRST cue of ACT 2, you have the following code:
dofile('D:\\current_show.txt')
dofile('D:\\LuaCode\\current_show_interval_end.txt')


In the LAST cue of the show, you have the following code:
dofile('D:\\current_show.txt')
dofile('D:\\LuaCode\\current_show_end.txt')


... a Text file is created, and then added to every time you run your show. In there you will find something like:
Show Report for Paragram Theatre Company production of Moving Pictures on 09/04/07
14:37:42 - House Lights down and show commenced
14:37:42 - House Lights up for interval
14:37:42 - House Lights down and Act 2 commenced
14:37:43 - House Lights up and show complete
---
THEN - if you wanted to note the time of an incident or happening, you could have a macro ready to trigger that does this:
dofile('D:\\current_show.txt')
dofile('D:\\LuaCode\\current_show_incident.txt')

... and this is added to your text file
INCIDENT... Occurred for Paragram Theatre Company production of Moving Pictures on 09/04/07
15:16:09
THEN - if you turn ON the web browser already built into your Palette, and this text file was saved into the web folder as "index.html" (instead of its current name), your stage manager could access and download the report by simply dialing in the IP address of the console. You would do this by replacing this line in each text file:
local f = io.open(ReportLocation..ShowName..'_showreport.txt', 'a')
with
local f = io.open('d:\\webserver\\index.html', 'a')
(not sure if that is the right path on a Palette - but it is something like that)
Attachments
ShowReport.zip
(3.1 KiB) Downloaded 63 times
...and for more entertainment industry trivia and useless facts, just ask:
John Grimshaw
Managing Director
Stage Fast Pty Ltd

User avatar
BobbyHarrell
Posts: 2278
Joined: Fri Oct 12, 2007 10:51 am
Location: Livingston, NJ
Contact:

Re: Lua - Auto Show Report...

Post by BobbyHarrell » Fri Jun 20, 2008 1:39 pm

So after a frustrating few minutes with Robert patiently helping me, I have these working. They are rather interesting and I have a few comments.

Lua may be very powerful in what it does but I can speak for a lot of programmers and say that I'm not interested in learning a programming language. I imagine I will dragging and screaming the whole way but I'm not interested in the least.

That being said, I would want this to post directly to my laptop or the designer's laptop or the stage managers laptop, not just to the console.

I would want it to be able to be automatically emailed at a preschedule time to the distribution list of my choice.

Just a couple of thoughts.
Bobby Harrell - Product Specialist
Philips Entertainment - Strand Lighting

User avatar
RobertBell
Posts: 2421
Joined: Fri Oct 12, 2007 1:11 pm
Primary Venue / Use: Other
Where I Am: Horizon Control Inc
Location: On the dark side just north of Toronto
Contact:

Re: Lua - Auto Show Report...

Post by RobertBell » Fri Jun 20, 2008 2:12 pm

Very cool John. I heard you did this and was waiting for it. I took your idea of updating d:\web\index.html and ran with it. I also simplified the calls and extended the reportevent() macro.

Rather than calling two scripts macros (your dofile('blah")), I changed it to defining functions and puting the whole thing in an autoloading *.lua file.

INSTRUCTIONS:
  • download the attached file and place the unzipped contents (ShowReport.lua) in your show directory (where your show is saved)
  • edit the top two lines to match your show
  • open a show file which has been saved in the same directory where the .lua script is
  • at least once, run wipelogfile() to kill the old index.html shipped with your desk (this can be done by doing into the macro editor, script editor and typing wipelogfile() and pressing S4-Test)
  • on any relivant cues, add one of the following scripts
    • wipelogfile()
    • startshow()
    • startinterval()
    • endinterval()
    • endshow()
    • reportevent()
    • reportevent('My Text in Single Quotes')
    • logthiscue()
Make sure you go into HARDWARE SETUP|CONSOLE and check off Enable Web Server. Than, at any time, anybody on the network can read the log file. You do not need to run wipelogfile() each day as startshow() date stamps the files.
This is an image of me surfing my LightPalette from my desktop after a test. (Its IP address is 192.168.0.8)
ShowLog.gif
ShowLog.gif (46.49 KiB) Viewed 975 times
I imagine anybody creative can add more html code to make it look much sexier. Here is the text of the attached lua script:

Code: Select all

ShowName = "Moving Pictures"
CompanyName = "Paragram Theatre Company"


HC.Status('Show Report macros loaded')

function wipelogfile()
 local f = io.open('d:\\web\\index.html', 'w')
 f:write('<p>' .. os.date('%x') .. ' - Start of log</p>\n')
 f:close()
end

function startshow()
 local f = io.open('d:\\web\\index.html', 'a')
 f:write('<p> *************************************************************** \n')
 f:write('<p>Show Report for ' .. CompanyName .. ' production of ' .. ShowName .. ' on ' .. os.date('%x') .. '</p>\n')
 f:write('<p>' .. os.date('%X') .. ' - House Lights down and show commenced</p>\n')
 f:close()
 HC.Status('Show Report Updated with Start of show marker')
end

function startinterval()
 local f = io.open('d:\\web\\index.html', 'a')
 f:write('<p>' ..os.date('%X') .. '- Start of Interval</p>\n')
 f:close()
 HC.Status('Show Report Updated with Start of interval marker')
end

function endinterval()
 local f = io.open('d:\\web\\index.html', 'a')
 f:write('<p>' ..os.date('%X') .. ' - End of Interval</p>\n')
 f:close()
 HC.Status('Show Report Updated with End of interval marker')
end

function endshow()
 local f = io.open('d:\\web\\index.html', 'a')
 f:write('<p>' ..os.date('%X') .. ' - Show comes down</p>\n')
 f:close()
 HC.Status('Show Report Updated with End of show')
end

function logthiscue()
 local f = io.open('d:\\web\\index.html', 'a')
 local qnum = HC.GetScriptSource('number')
 qnum = tonumber(qnum)/1000
 local qlabel = HC.GetScriptSource('name')
 f:write('<p>' ..os.date('%X') .. ' - Cue '.. qnum .. ' ' .. qlabel .. ' ran</p>\n')
 f:close()
 HC.Status('Cue Logged in show report')
end


function reportevent(event)
 if event == nil then
   event = "Unspecified Event"
 end
 local f = io.open('d:\\web\\index.html', 'a')
 f:write('<p>' ..os.date('%X') .. ' - EVENT: ' .. event ..  '</p>\n')
 f:close()
 HC.Status('Show Report Updated with event marker ' .. event)
end

Attachments
ShowReport.zip
(674 Bytes) Downloaded 75 times
Robert Bell - Product Manager - Horizon Control Inc.

User avatar
JohnGrimshaw
Posts: 1233
Joined: Tue Oct 16, 2007 12:51 pm
Primary Venue / Use: Other
Where I Am: International Man of Mystery
Location: Sydney, Australia
Contact:

Re: Lua - Auto Show Report...

Post by JohnGrimshaw » Fri Jun 20, 2008 4:20 pm

Robert - very neat updating!
BobbyHarrell wrote: That being said, I would want this to post directly to my laptop or the designer's laptop or the stage managers laptop, not just to the console.
That should be easy enough...
It would be a case of identifying the "network path", and copying the file there as a new action. Obvious that code would fail if that remote location was not there, so it might be easier to just tell them a network address they can dial in from their own laptop. Network storage is cheap these days. You could even get your showfile mirror saved there, and the Stage Manager could then just download what they need.
BobbyHarrell wrote: I would want it to be able to be automatically emailed at a preschedule time to the distribution list of my choice.
Well, that is also possible BUT it does mean that EITHER the console has to be set up for email (I would suggest that is not the greatest idea), or someone takes that above idea of a remote network storage...
If that network storage was a computer that was set up for email, you could write a neat bit of code that runs there, and it simply emails (or sends an SMS) of that day's log at 2am every day.

Thinking this another step ahead, once the above was set up, it would be easy to email/SMS an EVENT or INCIDENT as a separate and immediate action.
...and for more entertainment industry trivia and useless facts, just ask:
John Grimshaw
Managing Director
Stage Fast Pty Ltd

User avatar
RobertBell
Posts: 2421
Joined: Fri Oct 12, 2007 1:11 pm
Primary Venue / Use: Other
Where I Am: Horizon Control Inc
Location: On the dark side just north of Toronto
Contact:

Re: Lua - Auto Show Report...

Post by RobertBell » Fri Jun 20, 2008 9:51 pm

viewtopic.php?f=34&t=1144 trumps all of the above
Robert Bell - Product Manager - Horizon Control Inc.

Post Reply