Last active
January 16, 2016 06:07
-
-
Save kkotaro0111/8fc2a2f90874581ea1dc to your computer and use it in GitHub Desktop.
マイクラの /assets/objects/ から、ogg音源を取り出すNodeスクリプト
This file contains hidden or 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
console.log("start"); | |
var fs = require('fs'); | |
const MINECRAFT_PATH = "<need specified your minecraft dir path>/minecraft/"; | |
const SPATH = MINECRAFT_PATH + "assets/objects/"; | |
const DPATH = "<need specified your destination dir path>/"; | |
var json = require(MINECRAFT_PATH + 'assets/indexes/1.8.json'); | |
var o = json.objects; | |
for( var key in o ){ | |
if( /.*\.ogg$/.test(key)){ | |
var swap_key = key.replace(/\//g, "_"); | |
var hash = o[key].hash; | |
var dir = hash.substr(0, 2); | |
console.log(key, dir + "/" + hash); | |
var stat = fs.statSync( SPATH + dir + "/" + hash ); | |
var ws = fs.createWriteStream( DPATH + swap_key ); | |
fs.createReadStream( SPATH + dir + "/" + hash).pipe( ws ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment