├── .gitignore ├── Automator └── Convert SMI to SRT 💬.workflow │ └── Contents │ ├── Info.plist │ ├── QuickLook │ └── Thumbnail.png │ └── document.wflow ├── LICENSE ├── README.md ├── package.json └── smi2srt.js /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | node_modules 31 | jspm_packages 32 | 33 | # Optional npm cache directory 34 | .npm 35 | 36 | # Optional REPL history 37 | .node_repl_history 38 | 39 | # Mac 40 | .DS_Store 41 | -------------------------------------------------------------------------------- /Automator/Convert SMI to SRT 💬.workflow/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSServices 6 | 7 | 8 | NSMenuItem 9 | 10 | default 11 | Convert SMI to SRT 💬 12 | 13 | NSMessage 14 | runWorkflowAsService 15 | NSRequiredContext 16 | 17 | NSApplicationIdentifier 18 | com.apple.finder 19 | 20 | NSSendFileTypes 21 | 22 | public.item 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Automator/Convert SMI to SRT 💬.workflow/Contents/QuickLook/Thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axfree/smi2srt/b14d22f7bf337ba92ce50e4b45d60a48fc1f5695/Automator/Convert SMI to SRT 💬.workflow/Contents/QuickLook/Thumbnail.png -------------------------------------------------------------------------------- /Automator/Convert SMI to SRT 💬.workflow/Contents/document.wflow: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AMApplicationBuild 6 | 419 7 | AMApplicationVersion 8 | 2.6 9 | AMDocumentVersion 10 | 2 11 | actions 12 | 13 | 14 | action 15 | 16 | AMAccepts 17 | 18 | Container 19 | List 20 | Optional 21 | 22 | Types 23 | 24 | com.apple.cocoa.string 25 | 26 | 27 | AMActionVersion 28 | 2.0.3 29 | AMApplication 30 | 31 | Automator 32 | 33 | AMParameterProperties 34 | 35 | COMMAND_STRING 36 | 37 | CheckedForUserDefaultShell 38 | 39 | inputMethod 40 | 41 | shell 42 | 43 | source 44 | 45 | 46 | AMProvides 47 | 48 | Container 49 | List 50 | Types 51 | 52 | com.apple.cocoa.string 53 | 54 | 55 | ActionBundlePath 56 | /System/Library/Automator/Run Shell Script.action 57 | ActionName 58 | Run Shell Script 59 | ActionParameters 60 | 61 | COMMAND_STRING 62 | PATH=/usr/local/bin:/opt/homebrew/bin:$PATH 63 | smi2srt -n "$@" > /tmp/smi2srt.log 2>&1 64 | if [ $? -ne 0 ]; then 65 | osascript -e "display dialog \"`cat /tmp/smi2srt.log`\" with title \"smi2srt\"" 66 | else 67 | osascript -e "display notification \"`cat /tmp/smi2srt.log`\" with title \"smi2srt\"" 68 | fi 69 | exit 0 70 | CheckedForUserDefaultShell 71 | 72 | inputMethod 73 | 1 74 | shell 75 | /bin/bash 76 | source 77 | 78 | 79 | BundleIdentifier 80 | com.apple.RunShellScript 81 | CFBundleVersion 82 | 2.0.3 83 | CanShowSelectedItemsWhenRun 84 | 85 | CanShowWhenRun 86 | 87 | Category 88 | 89 | AMCategoryUtilities 90 | 91 | Class Name 92 | RunShellScriptAction 93 | InputUUID 94 | CE1D7C85-4B77-4CAD-8E57-1D33131A7DCC 95 | Keywords 96 | 97 | Shell 98 | Script 99 | Command 100 | Run 101 | Unix 102 | 103 | OutputUUID 104 | 96BFF7D7-81AC-4C13-AF26-95DF3F9A21EB 105 | ShowWhenRun 106 | 107 | UUID 108 | E876D736-6DCA-4CE8-9A7B-593F2161A487 109 | UnlocalizedApplications 110 | 111 | Automator 112 | 113 | arguments 114 | 115 | 0 116 | 117 | default value 118 | 0 119 | name 120 | inputMethod 121 | required 122 | 0 123 | type 124 | 0 125 | uuid 126 | 0 127 | 128 | 1 129 | 130 | default value 131 | 132 | name 133 | source 134 | required 135 | 0 136 | type 137 | 0 138 | uuid 139 | 1 140 | 141 | 2 142 | 143 | default value 144 | 145 | name 146 | CheckedForUserDefaultShell 147 | required 148 | 0 149 | type 150 | 0 151 | uuid 152 | 2 153 | 154 | 3 155 | 156 | default value 157 | 158 | name 159 | COMMAND_STRING 160 | required 161 | 0 162 | type 163 | 0 164 | uuid 165 | 3 166 | 167 | 4 168 | 169 | default value 170 | /bin/sh 171 | name 172 | shell 173 | required 174 | 0 175 | type 176 | 0 177 | uuid 178 | 4 179 | 180 | 181 | isViewVisible 182 | 183 | location 184 | 402.500000:253.000000 185 | nibPath 186 | /System/Library/Automator/Run Shell Script.action/Contents/Resources/English.lproj/main.nib 187 | 188 | isViewVisible 189 | 190 | 191 | 192 | connectors 193 | 194 | variables 195 | 196 | 197 | UUID 198 | 2FB9AEE0-905E-4F62-AA9B-C508FE796E8B 199 | identifier 200 | com.apple.Automator.Variable.Storage 201 | name 202 | Output 203 | 204 | 205 | workflowMetaData 206 | 207 | serviceApplicationBundleID 208 | com.apple.finder 209 | serviceApplicationPath 210 | /System/Library/CoreServices/Finder.app 211 | serviceInputTypeIdentifier 212 | com.apple.Automator.fileSystemObject 213 | serviceOutputTypeIdentifier 214 | com.apple.Automator.nothing 215 | serviceProcessesInput 216 | 0 217 | workflowTypeIdentifier 218 | com.apple.Automator.servicesMenu 219 | 220 | 221 | 222 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 AX Free 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # smi2srt 2 | Convert subtitles in ".smi" or ".ass" format to ".srt" format. 3 | 4 | ## Prerequisits 5 | [Node.js](https://nodejs.org) 6 | 7 | ## Installation 8 |
 9 | $ sudo npm install -g smi2srt
10 | 
11 | 12 | ## Usage 13 |
14 | Usage: smi2srt [options] <file>
15 | 
16 | smi2srt by axfree
17 | 
18 | Options:
19 | 
20 | 
21 |   -h, --help                          output usage information
22 |   -v, --version                       output the version number
23 |   -n                                  do not overwrite an existing file
24 |   -d, --output-directory <directory>  specify optional output directory
25 |   -l, --list-subtitles                list subtitles
26 |   -t, --time-offset <offset>          specify the time offset in miliseconds
27 |   -b, --time-begin <time>             specify the time begin for offset in miliseconds or H:mm:ss
28 |   -x, --remove-original-file          remove original file after successful conversion
29 |   -i, --install-automator             install smi2srt OS X Automator
30 | 
31 | 32 | ## License 33 | MIT 34 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "smi2srt", 3 | "version": "1.2.6", 4 | "description": "", 5 | "main": "smi2srt.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "bin": { 10 | "smi2srt": "smi2srt.js" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/axfree/smi2srt.git" 15 | }, 16 | "author": "AX Free (http://axfree.net)", 17 | "license": "MIT", 18 | "bugs": { 19 | "url": "https://github.com/axfree/smi2srt/issues" 20 | }, 21 | "homepage": "https://github.com/axfree/smi2srt#readme", 22 | "dependencies": { 23 | "charset-detector": "0.0.2", 24 | "cheerio": "^0.22.0", 25 | "commander": "^2.9.0", 26 | "iconv-lite": "^0.4.13", 27 | "langdetect": "^0.2.1", 28 | "locale-codes": "^1.3.1", 29 | "sprintf-js": "^1.1.2" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /smi2srt.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | var argv = require('commander'); 6 | var fs = require('fs'); 7 | var path = require('path'); 8 | var ps = require('child_process'); 9 | var sprintf = require('sprintf-js').sprintf; 10 | var charsetDetector 11 | = require("charset-detector"); 12 | var locale = require('locale-codes'); 13 | var languageDetector 14 | = require('langdetect'); 15 | var iconv = require('iconv-lite'); 16 | var cheerio = require('cheerio'); 17 | 18 | argv 19 | .version(require('./package').version, '-v, --version') 20 | .description('smi2srt by axfree') 21 | .arguments('') 22 | .option('-n', 'do not overwrite an existing file') 23 | .option('-d, --output-directory ', 'specify optional output directory') 24 | .option('-l, --list-subtitles', 'list subtitles') 25 | .option('-t, --time-offset ', 'specify the time offset in miliseconds', parseInt, 0) 26 | .option('-b, --time-begin