Skip to content

Instantly share code, notes, and snippets.

@apiarian
Created June 13, 2011 01:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apiarian/1022222 to your computer and use it in GitHub Desktop.
Save apiarian/1022222 to your computer and use it in GitHub Desktop.
Prints the end time of the current QuickTime Player movie.
#! /bin/sh
if [[ `ps -A | grep QuickTime | grep -v grep -c` -eq 1 ]]; then
if [[ `osascript -e 'tell app "QuickTime Player" to count documents'` -gt 0 ]]; then
t=`osascript -e 'tell app "QuickTime Player" to current time of first document as integer'`
d=`osascript -e 'tell app "QuickTime Player" to duration of first document as integer'`
cur=`date +%s`
end=`echo $cur + $d - $t | bc`
date -r $end +%H:%M:%S
else
echo Nothing is playing in QuickTime.
fi
else
echo QuickTime is not running.
fi
# vim : filetype=sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment