these changes were sitting for a while

This commit is contained in:
Anonymous 2022-08-01 19:03:29 -05:00
parent 3763a6b711
commit 87a424494b
10 changed files with 1215 additions and 1206 deletions

View File

@ -41,6 +41,14 @@ function getAvailableFileName(dir, name) {
return availableBaseName + ext; return availableBaseName + ext;
} }
function cleanTab(tab_text) {
return tab_text
.replace(/\[tab\]/g, '')
.replace(/\[\/tab\]/g, '')
.replace(/\[ch]/g, '')
.replace(/\[\/ch\]/g, '');
}
(async () => { (async () => {
// Clear out old output directory // Clear out old output directory
await fsExtra.emptyDir('./output/'); await fsExtra.emptyDir('./output/');
@ -85,6 +93,7 @@ function getAvailableFileName(dir, name) {
, tab_text , tab_text
FROM tabs FROM tabs
WHERE tab_text IS NOT NULL WHERE tab_text IS NOT NULL
ORDER BY rating * votes + votes
`, (err, row) => { `, (err, row) => {
if (err) throw err; if (err) throw err;
@ -93,17 +102,17 @@ function getAvailableFileName(dir, name) {
`${row.song_name} [${row.song_id}]: ${row.tab_url} `${row.song_name} [${row.song_id}]: ${row.tab_url}
By ${row.artist_name} [${row.artist_id}]: ${row.artist_url} By ${row.artist_name} [${row.artist_id}]: ${row.artist_url}
Rating: ${row.rating}, Votes: ${row.votes} Rating: ${row.rating}, Votes: ${row.votes}
Date: ${row.date} Tab By: ${row.username} [${row.user_id}] (${row.user_iq} iq)
Last Edit: ${new Date(row.date * 1000).toLocaleString()}${row.version_description ? '\n------------------------------------------------------------------------\n' + row.version_description : ''}
------------------------------------------------------------------------
${cleanTab(row.tab_text).trim()/* Remove [bbcode]tags[/bbcode] */}
------------------------------------------------------------------------
Tonality: ${row.tonality_name} Tonality: ${row.tonality_name}
Difficulty: ${row.difficulty} Difficulty: ${row.difficulty}
Tuning: ${row.tuning} Tuning: ${row.tuning}
Type: ${row.type_name} Type: ${row.type_name}
Tab By: ${row.username} [${row.user_id}] (${row.user_iq} iq)
Verified: ${row.verified} Verified: ${row.verified}
Version ${row.version} Version ${row.version}
${row.version_description || ''}
${row.tab_text}
`; `;
let typeDir = path.join('output', row.type_name ?? 'null'); let typeDir = path.join('output', row.type_name ?? 'null');
if (!fs.existsSync(typeDir)) { if (!fs.existsSync(typeDir)) {