Created
April 10, 2014 09:35
-
-
Save phoenixlzx/10361811 to your computer and use it in GitHub Desktop.
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
// ass2txt convert script | |
if (process.argv.length < 3) { | |
console.log('Usage: node ' + process.argv[1] + ' FILENAME'); | |
process.exit(1); | |
} | |
var fs = require('fs') | |
, filename = process.argv[2]; | |
fs.readFile(filename, 'utf8', function(err, data) { | |
if (err) throw err; | |
var lines = data.split("\n"); | |
lines.forEach(function(line) { | |
if (line.startsWith('Dialogue:')) { | |
var text = line.split(","); | |
if (text[9].indexOf('{\\') !== -1 && text.length >= 10) { | |
for (var i = 10; i < text.length; i++) { | |
text[9] += text[i]; | |
} | |
} | |
console.log(text[9]); | |
} | |
}); | |
}); | |
if (typeof String.prototype.startsWith != 'function') { | |
String.prototype.startsWith = function (str){ | |
return this.slice(0, str.length) == str; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment