Last active
May 7, 2019 06:46
-
-
Save NikhilNarayana/2d6dfbfdc3656fbb2f13091bfe7a11a0 to your computer and use it in GitHub Desktop.
SLP file sorter. Windows executable can be found here: https://drive.google.com/file/d/1JISMLoQZ2pSi0w4dH0tB-gwuI4KemYjv/view?usp=sharing
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
const { default: SlippiGame } = require('slp-parser-js'); | |
const path = require('path'); | |
const fs = require('fs'); | |
var inputPath = './input/'; | |
var outputPath = './output/'; | |
function sortSLP() { | |
files = fs.readdirSync(inputPath); | |
files.forEach((file) => { | |
let filep = path.join(inputPath, file); | |
let game = new SlippiGame(filep); | |
let metadata = game.getMetadata(); | |
let settings = game.getSettings(); | |
let nickname = metadata.consoleNick || "unknown"; | |
if (settings.isTeams) { | |
fs.mkdir(path.join(outputPath, nickname, "/doubles/"), { recursive: true }, (err) => { | |
fs.rename(filep, path.join(outputPath, nickname, "/doubles/", file), (err) => {return;}); | |
}); | |
} else { | |
fs.mkdir(path.join(outputPath, nickname, "/singles/"), { recursive: true }, (err) => { | |
fs.rename(filep, path.join(outputPath, nickname, "/singles/", file), (err) => {return;}); | |
}); | |
} | |
}); | |
} | |
console.time("sorting"); | |
sortSLP(); | |
console.timeEnd("sorting"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
a new addition to the zip is this version of the sorter that sorts in the format that Fizzi requires for slippi.gg