From 86b06da686a7d6d5c9af50ca6cc00e61d26e0a5b Mon Sep 17 00:00:00 2001 From: Alistair Smith Date: Tue, 27 Feb 2024 00:17:58 +0000 Subject: [PATCH] =?UTF-8?q?freaking=20rekordbox=20man=20=F0=9F=98=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../experiments/rekordbox-history-parser.tsx | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/pages/experiments/rekordbox-history-parser.tsx diff --git a/src/pages/experiments/rekordbox-history-parser.tsx b/src/pages/experiments/rekordbox-history-parser.tsx new file mode 100644 index 0000000..9b326e5 --- /dev/null +++ b/src/pages/experiments/rekordbox-history-parser.tsx @@ -0,0 +1,40 @@ +import {useState} from 'react'; + +export default function RekordboxHistoryParser() { + const [state, setState] = useState(''); + + const result = state + .split('\n') + .map(l => l.split('\t')) + .slice(1) + .map(l => { + const [, title, artist, album, bpm, time, key] = l as [ + string, + string, + string, + string, + string, + string, + string, + ]; + + return { + title, + artist, + album, + bpm, + time, + key, + }; + }) + .map(l => `${l.title} - ${l.artist}`) + .join('\n'); + + return ( +
+