Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

VLC new instance and open file / record

Hi,

I use VLC multiple instances with:

on run

do shell script "open -n /Applications/VLC.app"

tell application "VLC" to activate

end run


on open theFiles

repeat with theFile in theFiles

do shell script "open -na /Applications/VLC.app " & quote & (POSIX path of theFile) & quote

end repeat

tell application "VLC" to activate

end open


Actually, I get a url .m3u8 by applescript and manually paste it in VLC open network, then, as the video shows, click record.


How could I pass directly an url in the script above?


Then (in plus):

-it would be possible to pass a comand to record as the stream starts?

-sometimes the stream stops/disconnects, and I have to submit again; it would be possible to make an automatic re-connection?


Thanks in advance for any help.

MacBook, OS X Yosemite (10.10.3)

Posted on Feb 10, 2016 4:17 AM

Reply
2 replies

Feb 10, 2016 7:41 AM in response to Andyam

I have a script which I ran under OSX 10.4.11 which does all that but it is probably only understandable by me. However, two tips I can provide:


1) This starts up VLC and dumps the raw audio output into a file (use extension .raw in SaveToFile below). It does produce an icon in your Dock but it is otherwise largely a background process:


property VLCpath : "/Applications/VLC/Contents/MacOS/VLC" -- Path to VLC binary inside the bundle for the application. E.g., /Applications/VLC/Contents/MacOS/VLC


property StreamURL : "http://stream.mp3" -- The http URL of the actual stream itself, not just a web site for the station.


property SaveToFile : -- Path and file to which to save stream.


Global pid -- process ID


set VLCcmmnd to VLCpath & " " & StreamURL & " --sout=file/raw:" & SaveToFile

do shell script VLCcmmnd & " &> /dev/null 2>&1& echo $!"

set pid to the result -- capture process ID


Note: I don't know if this will work under a newer Applescript. I only last used it under OSX 10.4.11.


2) There is nothing you can do about disconnecting. Instead of checking for disconnecting I instead wrote a section of script to check the output file modification time every 10 minutes. If there was no change then the stream had disconnected. The script would then kill the process and loop back to the start, restarting VLC. I also added a timestamp feature (removed from the code above) so it would write to a different file.

VLC new instance and open file / record

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.