Qlab log files

979 views
Skip to first unread message

Lee Crellin

unread,
Mar 9, 2020, 8:39:23 AM3/9/20
to QLab
Hi folks,

Not sure if this is possible so I've been told this is the best place to ask.

I work on alot of high profile sports events mainly in the uk. From time to time im asked to provide a log of what's been played out with dates and times etc. Does anyone know if there's a option on qlab for this , or if there's a script avalible somewhere which will allow me to do this ?.


Thanks in advance ,

Lee

micpool

unread,
Mar 9, 2020, 9:03:31 AM3/9/20
to QLab
I think this links to the last time we examined this in any detail in the group 

Lee Crellin

unread,
Mar 9, 2020, 11:03:30 AM3/9/20
to QLab
Hi mic ,

Thanks for this , looks exactly what I'm after . I shall download it tonight, will have a look and report back.

Thanks again ,

Lee

benb...@gmail.com

unread,
Jun 29, 2022, 1:05:57 AM6/29/22
to QLab
Hi Lee,

This was my latest attempt at this script... I actually made a seperate runtime program for this exact use case, as I am also an A1/Sound Sup down in New Zealand. 
The app became everthing I wanted it to be, but unfortuantely it is effectively retired due to filemaker runtime being unsupported and me being unable to update it. 

I was hopeful that QLab would build a better logging system but that hasn't happened. 

For now, this script will log any audio cues, the cue name given in Qlab, and will then pull the relevant metadata from the file and will store in a csv file. This gets placed on your desktop. 
NB/ Ensure that there is a Qlab 4 workspace open before running the script.

Please feel to reach out, or if anyone wants to pick this up again in the future i'd love to be involved. 

Cheers
Ben
QLogger.png
Qlogger_v1_2_script.scpt

Rich Walsh

unread,
Jun 29, 2022, 7:51:43 AM6/29/22
to ql...@googlegroups.com
I’ve given it a bit of a checkup and tested it in Monterey. The output is tab-delimited, not csv.

You need to export the script as an application from Script Editor: I can’t attach it as an app…

Rich
(* QLogger: see Description tab or theExplanation variable

Written by Rich Walsh & Ben Bull; inspired by Mic Pool – see https://groups.google.com/g/qlab/c/Trvs5-O_GAw/m/qjjJFKxgDQAJ

v0.9: 22/03/18 Rich "STOP logger"
v0.9.5: 17/08/18 Rich Added mdls query to capture further information about stopped files
v1.0: 23/09/18 Ben "QLogger" v1 FMP 
v1.1: 10/11/21 Ben Standalone script, continue on null / error
v1.2: 29/06/22 Rich General tidying & retesting

-- ###FIXME### This has not been tested much beyond proving that it works in principal; there is no real error protection
-- ###FIXME### Notifications don't work well when multiple cues stop at the same time
-- ###FIXME### Action elapsed is affected by scrubbing, so is not a true reflection in general of how long a cue _played_ for
-- ###FIXME### v1.2: Can take a long time to actually quit after announcing that intention; hanging occasionally too?

-- ###TODO### mdls output seems to be alphabetical; find a way to control metadata order

<<< Last run with QLab 4.6.12, macOS 12.4 >>> *)

(*

/// HOW DOES IT WORK? ///

-- Essentially, this script repeatedly polls QLab for a list of running Audio Cues and then compares that list with the last result
-- Any cues no longer in the list must have stopped so the script writes information about them to a text file on the Desktop
-- A command line tool ("mdls") gathers metadata from the audio files that QLab can't itself report

*)

-- Explanations

property theExplanation : "Run this app alongside QLab to write a text file to the Desktop of how long Audio Cues had played for when they stop" & ¬
"(rounded down to the nearest second)

TO QUIT: close all workspaces (the app won't run if there aren't any)"

-- User-defined variables

set userBypassExplanation to false -- Set this to true if you don't want to see the explanation dialog each time you run the application

set userLogFilenameSuffix to " | QLogger Logs" -- Text to append to log file names

set userFileTimestampFormat to "+%d/%m/%y %H:%M:%S" -- Set the format for timestamps;
(* the structure of this string follows the conversion specifiers of strftime: run "man strftime" in Terminal to see more *)

set userNotificationsOn to true -- Set this to false if you don't want notifications

set userPollingInterval to 1 -- Set how many seconds between iterations (accuracy will be roughly ±userPollingInterval)

-- Declarations

property dialogTitle : "QLogger"

global currentTIDs

-- Preamble

set currentTIDs to AppleScript's text item delimiters

if userBypassExplanation is false then
display dialog theExplanation with title dialogTitle with icon 1 buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel"
end if

-- Check QLab is running

tell application "System Events"
set qLabIsRunning to exists (processes whose bundle identifier is "com.figure53.QLab.4")
end tell
if qLabIsRunning is false then
my exitStrategy("Quitting: QLab is not running.", 5)
return
end if

-- Test for a workspace

tell application id "com.figure53.QLab.4"
try
set workspaceName to q number of front workspace
on error
set workspaceName to false
end try
end tell
if workspaceName is false then
my exitStrategy("Quitting: no workspaces open in QLab.", 5)
return
end if

-- Get setup details

tell application id "com.figure53.QLab.4" to activate

set theFilePath to "" & (POSIX path of (path to desktop)) & "QLab | " & workspaceName & userLogFilenameSuffix & ".txt"

set capturedAudioCueIDs to {}
set capturedAudioCueElapses to {}

set AppleScript's text item delimiters to tab

-- Run the loop

repeat

-- Get the latest news

try
tell application id "com.figure53.QLab.4" to tell front workspace
set latestAudioCueIDs to uniqueID of cues whose running is true and q type is "Audio"
set latestAudioCueElapses to action elapsed of cues whose running is true and q type is "Audio"
end tell
on error
activate
my exitStrategy("Quitting: no workspaces open in QLab.", 5)
return -- Quit if no workspace open
end try

-- Compare against the last capture and log accordingly

if latestAudioCueIDscapturedAudioCueIDs then
set logTime to do shell script "date " & quoted form of userFileTimestampFormat
repeat with i from 1 to count capturedAudioCueIDs
if item i of capturedAudioCueIDs is not in latestAudioCueIDs then
set elapsedTime to makeMSS(item i of capturedAudioCueElapses)
tell application id "com.figure53.QLab.4" to tell front workspace
set stoppedCue to q list name of cue id (item i of capturedAudioCueIDs)
set stoppedFile to file target of cue id (item i of capturedAudioCueIDs)
end tell
try
set fileInfo to paragraphs of ¬
(do shell script "mdls -name kMDItemTitle -name kMDItemAlbum " & ¬
"-name kMDItemAudioTrackNumber -name kMDItemComposer -name kMDItemCopyright " & ¬
quoted form of POSIX path of stoppedFile & " | awk '{n=index($0,\"=\");print substr($0,n+2)}'")
(* ###FIXME### output is NOT in this order!!!! *)
set cleanInfo to {} -- Remove surrounding quotes from mdls output
repeat with eachItem in fileInfo
set end of cleanInfo to my stripSurroundingQuotes(contents of eachItem)
end repeat
on error
set cleanInfo to {}
repeat 5 times -- Change this to match the number of kMDItems above
set end of cleanInfo to "(null)" -- This matches the string returned by mdls for missing metadata
end repeat
end try
set theMessage to ({logTime, stoppedCue, elapsedTime} & cleanInfo & POSIX path of stoppedFile) as text
do shell script "echo " & quoted form of theMessage & " >> " & quoted form of theFilePath
if userNotificationsOn then display notification stoppedCue & " stopped at " & elapsedTime with title dialogTitle subtitle "Event logged"
end if
end repeat
end if

-- Update the cache

set capturedAudioCueIDs to latestAudioCueIDs
set capturedAudioCueElapses to latestAudioCueElapses

-- Wait…

delay userPollingInterval

end repeat

-- Subroutines

(* === OUTPUT === *)

on exitStrategy(theMessage, givingUp) -- [Shared subroutine]
if theMessage is not false then
if givingUp is not false then
display dialog theMessage with title dialogTitle with icon 0 buttons {"OK"} default button "OK" giving up after givingUp
else
display dialog theMessage with title dialogTitle with icon 0 buttons {"OK"} default button "OK"
end if
end if
set AppleScript's text item delimiters to currentTIDs
end exitStrategy

(* === TIME === *)

on makeMSS(howLong) -- [Shared subroutine]
set howManyMinutes to howLong div 60
set howManySeconds to howLong mod 60 div 1
return (howManyMinutes as text) & ":" & my padNumber(howManySeconds, 2)
end makeMSS

(* === TEXT WRANGLING === *)

on padNumber(theNumber, minimumDigits) -- [Shared subroutine]
set paddedNumber to theNumber as text
repeat while (count paddedNumber) < minimumDigits
set paddedNumber to "0" & paddedNumber
end repeat
return paddedNumber
end padNumber

on stripSurroundingQuotes(theText)
set quoteMark to "\""
if first character of theText is quoteMark and last character of theText is quoteMark then
return text 2 thru -2 of theText
else
return theText
end if
end stripSurroundingQuotes

(* END: QLogger *)

Ben Bull

unread,
Jun 30, 2022, 12:33:18 AM6/30/22
to ql...@googlegroups.com
Good stuff, thanks for the update Rich.
Obviously you are right about it being tab not csv. I'm blaming covid brain this week, hence why I have time to look at old projects :P

Occasionally I get the following error, seems to be tied to the MakeMMS function or that elapsedTime is not returning correctly. This causes the entire script to bomb, so I think it needs an error handler to set elapsedTime to null or error as text if this happens. 

Regards
Ben



--
Contact support anytime: sup...@figure53.com
Follow QLab on Twitter: https://twitter.com/QLabApp
User Group Code of Conduct: https://qlab.app/code-of-conduct/
---
You received this message because you are subscribed to a topic in the Google Groups "QLab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/qlab/QbyVJL4Om7g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to qlab+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qlab/B7BCDD6E-DF7B-437C-86AB-B15639421126%40mac.com.
Screen Shot 2022-06-30 at 8.00.25 AM.png

Rich Walsh

unread,
Jun 30, 2022, 4:05:05 AM6/30/22
to ql...@googlegroups.com
It’s more insidious than a handler failing: I think it means that latestAudioCueIDs has captured a longer list than latestAudioCueElapses due to some cues stopping in the short interval between those two queries.

Try this version (if you’re running in Script Editor it’s worth being in the Replies tab at the bottom as then you’ll see exactly which bit failed – although it can slow everything down):

(* QLogger: see Description tab or theExplanation variable

Written by Rich Walsh & Ben Bull; inspired by Mic Pool – see https://groups.google.com/g/qlab/c/Trvs5-O_GAw/m/qjjJFKxgDQAJ

v0.9: 22/03/18 Rich "STOP logger"
v0.9.5: 17/08/18 Rich Added mdls query to capture further information about stopped files
v1.0: 23/09/18 Ben "QLogger" v1 FMP 
v1.1: 10/11/21 Ben Standalone script, continue on null / error
v1.2: 29/06/22 Rich General tidying & retesting
v1.3: 30/06/22 Rich Added protection against latestAudioCueIDs & latestAudioCueElapses being different lengths due to cues stopping between
capturing these two lists
-- Check these lists are the same length, just in case some cues stopped between the two queries


repeat until (count latestAudioCueIDs) = (count latestAudioCueElapses)
set latestAudioCueIDs to uniqueID of cues whose running is true and q type is "Audio"
set latestAudioCueElapses to action elapsed of cues whose running is true and q type is "Audio"
end repeat

Rich

justin.m

unread,
Nov 15, 2023, 4:44:45 AM11/15/23
to QLab
Hello all-
Another solution that is not automatic, and requires a decent text editor (vim, BBEdit, etc), but is still quite easily achieved:

Before your show starts go to "Window>Workspace Status", open the "Logs" tab, and check "Cue triggers"
This will record every cue played during the show.
Copy/Paste this log into your favorite text editor and remove unwanted lines:

For vim:
Remove all lines not containing "wav"
`:v/wav/d`

In my case I have fade cues that also show up so I remove them with
`:g/fade/d`

For BBEdit the tool is found in "Text>Process Lines Containing..."

I'm sure your favorite text editor has a similar tool.

Cheers-
Justin

justin.m

unread,
Nov 15, 2023, 4:46:59 AM11/15/23
to QLab
Ok, apologies, I thought markdown would work.
What is the syntax for code/commands? It's obviously not a single back quote...

sftechguy

unread,
Nov 21, 2023, 11:29:33 PM11/21/23
to QLab
If you are running QLab 5, there is now a QLab preference called "Log Media Playback" that I think does what you're looking for, all built-in, nice and neat.

-s

Reply all
Reply to author
Forward
0 new messages