Created
July 5, 2021 18:40
-
-
Save findscode/84560cfbd30903f033d7c1a292e2d59e to your computer and use it in GitHub Desktop.
A track name beautifier used by me to manage around 1k of Liquid D&B files
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 fs = require('fs'); | |
const path = require('path'); | |
const directory = './Liquid'; | |
(async () => { | |
const files = await fs.promises.readdir(directory); | |
for (const file of files) { | |
const name = file | |
.replace(/^[0-9]+\ - /, '') | |
.replace(/ +(?= )/g, '') | |
.replace(/ *\[[^)]*\] */g, '') | |
.replace('feat ', 'ft ') | |
.replace('ft ', 'ft. ') | |
.replace('Ft.', 'ft.') | |
.replace('_-_', ' - ') | |
.replace('_', '') | |
.replace('—', '-'); | |
await fs.promises.rename(path.join(directory, file), path.join(directory, name)); | |
console.log(`[${file}] -> (${name})`); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment