Check if setting is broadcasting?

Hi,

I am streaming video through quicktime broadcaster 24 hours a day, and sometimes it stops broadcasting randomly or shuts off. I want to write a script that checks to see if it’s broadcasting, and if not, make sure it’s using the right settings and then start again.

I know how to open the settings file and start broadcasting, but I don’t know how to actually find out if it’s currently broadcasting. Does anyone know how I could do this?

Here is the current state of my script:


set user_settings to alias "Macintosh HD:Users:webcast:Desktop:FinalSettings.qtbr"

activate application "QuickTime Broadcaster"

if (exists document 1) then

  start document 1 -- here is where I need to see if it's already going, and if not, then open user_settings and start document 1. 
                           -- Ideally, I would also be able to determine if document 1 is using the right settings file. 
  return "broadcast"
end if
end tell


Thanks a lot for any help you can give!

Model: Mac Mini
Browser: Firefox 2.0.0.3
Operating System: Mac OS X (10.4)

Maybe try the following:


set openPorts to "none"
try
	set openPorts to do shell script "netstat -an|grep ESTABLISHED"
end try
if openPorts contains "x.xxx" then -- run the netstat command in terminal to see what unique features there are for the stream you want to check
	set isStreaming to true
else
	set isStreaming to false
end if

Note:

  • The shell command option is “-an[vertical bar]grep”.
  • There may be a short delay before changes in network status are reflected in netstat command results
  • It sounds like you would have to tell this script when to check the network status e.g. every ten minutes or some other alarm event.
    Hope this helps.

Edited August 17, 2008 22:10.
AppleScript: 2.0.1
Browser: Opera/9.51 (Macintosh; Intel Mac OS X; U; en)
Operating System: Mac OS X (10.5)