-
-
Save apiarian/1022222 to your computer and use it in GitHub Desktop.
Prints the end time of the current QuickTime Player movie.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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