Skip to content

Commit

Permalink
feat: introduce playlist support
Browse files Browse the repository at this point in the history
  • Loading branch information
nanochromatic committed Sep 18, 2023
1 parent 6975a34 commit ad39caf
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 5 deletions.
7 changes: 4 additions & 3 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ git_commit() {
git checkout --orphan prod
timestamp=$(date "+%b %d %Y")
git add bgm.min.json
git add playlist.min.json
git commit -m "GitHub Actions: $timestamp (Build $GITHUB_RUN_NUMBER)"
}

Expand All @@ -19,13 +20,13 @@ git_push() {
}

setup_git
changed=$(git diff --name-only HEAD~1 HEAD | grep -E "bgm/|locale/" | wc -l)
changed=$(git diff --name-only HEAD~1 HEAD | grep -E "bgm/|locale/|playlist/" | wc -l)

if [ $changed -ne 0 ]; then
echo "Change in ./bgm detected. Merging and pushing to prod branch..."
echo "Change in files detected. Merging and pushing to prod branch..."
yarn merge
git_commit
git_push
else
echo "No changes in ./bgm"
echo "No change in files"
fi
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"name": "maplebgm-db",
"version": "2023.3",
"dependencies": {
"jsonc-parser": "^3.2.0"
},
"devDependencies": {
"ajv": "^6.5.5",
"eslint": "^7.4.0",
Expand All @@ -16,6 +19,6 @@
"scripts": {
"test": "jest",
"prettier": "prettier --write .",
"merge": "node -e \"require('./utils').mergeBgmDatabase('./bgm')\""
"merge": "node -e \"require('./utils').mergeBgmDatabase('./bgm', './playlist')\""
}
}
25 changes: 25 additions & 0 deletions playlist/blockbuster/BlackHeaven.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "Black Heaven",
"description": "First Blockbuster of MapleStory, featuring the battle between the Maple Alliance and the Black Wings",
"tracks": [
"Bgm40/SecretMission",
"Bgm40/SecretMissionBase",
"Bgm40/RabbitsDream",
"Bgm40/BattleOnTheDeck",
"Bgm40/BlackHeavenTheme",
"Bgm40/BlackHeavenTheme_parade",
"Bgm40/TheDollMaster",
"Bgm40/JunkYard",
"Bgm40/HeroComes",
"Bgm41/BigMachine",
"Bgm41/BigMachine_mission",
"Bgm41/Gravity Core",
"Bgm41/Gravity Lord",
"Bgm41/Gravity Lord Rise",
"Bgm41/HeavenAgain",
"Bgm41/HeavenAgain_reprise",
"Bgm41/PromiseOfHeaven",
"Bgm41/PromiseOfHeaven_vocaless",
"Bgm41/Haven Theme"
]
}
13 changes: 13 additions & 0 deletions playlist/collaboration/DJMAX.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "DJMAX RESPECT V collaboration",
"description": "2023 DJMAX RESPECT V collaboration",
"tracks": [
"BgmEvent3/Mycin.T x ned - Story of Maple_AR",
"BgmEvent3/Paul Bazooka - Moonlight Shadow (Paul Bazooka Remix)",
"BgmEvent3/SOPHI - Missing You (SOPHI Remix)",
"BgmEvent3/Pan - Fairytale (Pan Remix)",
"BgmEvent3/ned - Ariant (ned Remix)",
"BgmEvent3/jam-jam - The Lake of Oblivion(jam-jam Remix)",
"BgmEvent3/Parang - The Tune of the Azure Light (Parang Remix)"
]
}
13 changes: 13 additions & 0 deletions playlist/event/Autumn.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "Autumn Events",
"description": "Autumn events",
"tracks": [
"BgmEvent/halloweenMainHall", // 2012
"BgmEvent2/ClubHalloween", // 2018
"BgmEvent2/goblinMarket", // 2019
"BgmEvent/fullMoonParty", // 2020
"BgmEvent/chuchu", // 2021
"BgmEvent3/ignitionFullMoonParty", // 2022
"BgmEvent3/Minar_Autumn_Picnic" // 2023
]
}
18 changes: 18 additions & 0 deletions playlist/event/Spring.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "Spring Events",
"description": "Spring and anniversary events",
"tracks": [
// 2011 - 8th
"BgmUI/Title_8th",
"BgmEvent2/risingStar2",
"BgmEvent2/tenthBoard", // 2013 - 10th
"Bgm43/MonsterWorld", // 2015 - 12th
"BgmEvent/mapleGalaxy", // 2017 - 14th
"BgmEvent/WelcomeToThe15thStreet", // 2018 - 15th
"BgmEvent2/Newtro_Kingdom", // 2019 - 16th
"BgmEvent/17th_Event", // 2020 - 17th
"BgmEvent/18th_Event", // 2021 - 18th
"BgmEvent/19th_Event", // 2022 - 19th
"BgmEvent3/Mapril_Island" // 2023 - 20th
]
}
12 changes: 12 additions & 0 deletions playlist/event/Summer.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "Summer Events",
"description": "Summer events",
"tracks": [
"BgmEvent2/Outlaw of the Lonely Island", // 2017
"BgmEvent2/glory_Base", // 2019
"BgmEvent/awake_Event", // 2020
"BgmEvent/mapleLIVE", // 2021
"BgmEvent/ignition", // 2022
"BgmEvent3/Dancing_Sea_Otter" // 2023
]
}
11 changes: 11 additions & 0 deletions playlist/event/Winter.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "Winter Events",
"description": "Winter events",
"tracks": [
"BgmEvent2/adventureIsland", // 2018
"BgmEvent/salonRise", // 2019
"BgmEvent/NeoCastle", // 2020
"BgmEvent/StarlightSymphony", // 2021
"BgmEvent3/wonstaurant" // 2022
]
}
15 changes: 14 additions & 1 deletion utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require('fs');
const path = require('path');
const jsoncParser = require('jsonc-parser');

const locales = ['ko', 'ja', 'zh-CN', 'zh-TW'];

Expand Down Expand Up @@ -41,10 +42,22 @@ function mergeLocaleData(db) {
});
}

function mergeBgmDatabase(dir) {
function getPlaylists(dir) {
const playlists = [];
traverseDirectory(dir)
.filter((fullPath) => path.extname(fullPath) === '.jsonc')
.forEach((fullPath) => {
playlists.push(jsoncParser.parse(fs.readFileSync(fullPath, 'utf8')));
});
return playlists;
}

function mergeBgmDatabase(dir, playlistDir) {
const db = getBgmDatabase(dir);
mergeLocaleData(db);
fs.writeFileSync('bgm.min.json', JSON.stringify(db));
const playlists = getPlaylists(playlistDir);
fs.writeFileSync('playlist.min.json', JSON.stringify(playlists));
}

module.exports = {
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2379,6 +2379,11 @@ json5@^2.1.0:
dependencies:
minimist "^1.2.0"

jsonc-parser@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76"
integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==

jsprim@^1.2.2:
version "1.4.1"
resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2"
Expand Down

0 comments on commit ad39caf

Please sign in to comment.