Skip to content

Instantly share code, notes, and snippets.

@fdgogogo
Created October 7, 2014 13:41
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 fdgogogo/d011e0375bc90c24cf18 to your computer and use it in GitHub Desktop.
Save fdgogogo/d011e0375bc90c24cf18 to your computer and use it in GitHub Desktop.
Automatically add subtitle to video files using folder action
on adding folder items to this_folder after receiving added_items
set SSCL to "~/Applications/sscl"
set theList to added_items as list
set theLog to ""
do shell script "rm -rf ~/Library/Application\\ Support/SPlayerX/SVPSub/"
repeat with theItem in theList
set theFile to theItem as alias
set thePath to POSIX path of theFile as string
tell application "Finder"
set theName to the name of theFile
set theFolder to POSIX path of ((container of theFile) as alias)
end tell
try
do shell script SSCL & " --video-file " & quoted form of thePath & " --pull >/dev/null 2>&1"
set theLog to ((theLog) & "[成功]: " & theName & "
")
do shell script "mv ~/Library/Application\\ Support/SPlayerX/SVPSub/* " & quoted form of theFolder
on error
set theLog to ((theLog) & "[失败]: " & theName & "
")
end try
end repeat
display dialog theLog buttons "好" default button "好" giving up after 60
end adding folder items to
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment