// 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