Skip to content

Instantly share code, notes, and snippets.

@SunRunAway
Last active August 29, 2015 14:15
Show Gist options
  • Save SunRunAway/98fa28032d1f6ea995e6 to your computer and use it in GitHub Desktop.
Save SunRunAway/98fa28032d1f6ea995e6 to your computer and use it in GitHub Desktop.
获取字幕.workflow
on run {input, parameters}
set SSCL to "~/bin/sscl"
set theList to input as list
set theLog to ""
do shell script "mkdir -p ~/Library/Application\\ Support/SPlayerX/SVPSub/"
do shell script "echo test > ~/Library/Application\\ Support/SPlayerX/SVPSub/README"
do shell script "mkdir -p ~/Library/Application\\ Support/SPlayerX/SVPSub.bak/"
do shell script "mv ~/Library/Application\\ Support/SPlayerX/SVPSub/* ~/Library/Application\\ Support/SPlayerX/SVPSub.bak/"
#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 run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment