Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
alii committed Feb 27, 2024
1 parent 16582e3 commit 837e81d
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/pages/experiments/rekordbox-history-parser.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
import {useState} from 'react';

function parseTitleAndArtist(title: string, artist: string) {
if (artist === '') {
const [actualTitle, actualArtist] = title.split('-');

if (actualTitle && actualArtist) {
return {
title: actualTitle.trim(),
artist: actualArtist.trim(),
};
}
}

return {
title,
artist,
};
}

export default function RekordboxHistoryParser() {
const [state, setState] = useState('');

Expand All @@ -18,9 +36,11 @@ export default function RekordboxHistoryParser() {
string,
];

const {title: actualTitle, artist: actualArtist} = parseTitleAndArtist(title, artist);

return {
title,
artist,
title: actualTitle,
artist: actualArtist,
album,
bpm,
time,
Expand Down

0 comments on commit 837e81d

Please sign in to comment.