Start playing partially downloaded videos in VLC

Mar 06, '08 07:30:01AM

Contributed by: cdfmrl

I frequently download video files from a web server, and would like to start watching them before the download completes -- VLC, for one, can start playing a video while Safari downloads it. This AppleScript automates that task. Simply select the .download file in the Finder and run the script. You'll probably want to save this script as an Application Bundle:

on run
  tell application "Finder"
    copy selection to fileName0
  end tell
  set fileName to fileName0 as string
  if fileName ends with ".download" then
    set AppleScript's text item delimiters to ":"
    set listNames to text items of fileName
    set AppleScript's text item delimiters to ""
    set baseName to last item of listNames
    set videoName to (items 1 thru -10 of baseName as text)
    set fullVideoName to fileName & ":" & videoName
    tell application "VLC"
      open fullVideoName
    end tell
  end if
end run
When VLC opens certain incomplete video files, it will give a few errors. To get rid of these, go to Preferences in VLC, then the Interfaces section. Check Advanced at the bottom to show all the options, and make sure that Be Quiet is checked, and Interface Interaction is unchecked. You may also want to check Always on Top or Fullscreen Video Output in the Video section.

The result is that you can select a .download file, then run the script, and your video will begin playing without errors.

Comments (5)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20080228231004753