Created
October 7, 2014 13:41
-
-
Save fdgogogo/d011e0375bc90c24cf18 to your computer and use it in GitHub Desktop.
Automatically add subtitle to video files using folder action
This file contains 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
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