fix: build error in nextSong + apply romaji overrides to downloads
- Fix missing closing brace for `if (ni >= 0...)` in nextSong — the removed
`else { _nsBridge('next') }` left the inner if-block unclosed, causing
vite/rollup to reject player.js as invalid JS
- Apply romaji override map to iTunes (executeDownload) and Spotify
(executeSpotifyDownload) download payloads — sends artistSort/albumArtistSort/
titleSort/albumSort fields so the backend writes correct sort tags to the
downloaded file and can organize into the right artist folder
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
8c3a23ad14
commit
0a2736e893
2 files changed
+24
-4
No files matched your search
@@ -716,6 +716,7 @@ export function nextSong() {
|
||||
// Explicit index prevents desync when JS and native queue pointers diverge.
|
||||
_nsBridge('seekToIndex', ni, 0);
|
||||
_nsBridge('play');
|
||||
}
|
||||
// else: ni = -1 means end of queue with no repeat — let ExoPlayer stop naturally.
|
||||
if (S.radioMode && S.queue.length - S.qIdx < 5) fillRadioQueue();
|
||||
return;
|
||||
|
||||
@@ -610,11 +610,15 @@ export async function executeDownload() {
|
||||
if(!S.downloadTarget || !S.cfg.backendUrl) return;
|
||||
closeDlModal();
|
||||
const jobId = 'job_' + Date.now();
|
||||
const ov = getRomajiOverrides();
|
||||
const _artist = S.downloadTarget.artistName || 'Unknown Artist';
|
||||
const _title = S.downloadTarget.trackName || S.downloadTarget.collectionName || 'Unknown';
|
||||
const _album = S.downloadTarget.collectionName || '';
|
||||
const payload = {
|
||||
type: S.dlType,
|
||||
artist: S.downloadTarget.artistName || 'Unknown Artist',
|
||||
title: S.downloadTarget.trackName || S.downloadTarget.collectionName || 'Unknown',
|
||||
album: S.downloadTarget.collectionName || '',
|
||||
artist: _artist,
|
||||
title: _title,
|
||||
album: _album,
|
||||
artworkUrl: S.downloadTarget.artworkUrl100 || S.downloadTarget.artworkUrl60 || '',
|
||||
itunesId: S.downloadTarget.trackId || S.downloadTarget.collectionId || null,
|
||||
collectionId: S.downloadTarget.collectionId || null,
|
||||
@@ -624,6 +628,9 @@ export async function executeDownload() {
|
||||
discNum: S.downloadTarget.discNumber || undefined,
|
||||
discTotal: S.downloadTarget.discCount || undefined,
|
||||
durationMs: S.downloadTarget.trackTimeMillis || undefined,
|
||||
...(ov[_artist] && { artistSort: ov[_artist], albumArtistSort: ov[_artist] }),
|
||||
...(ov[_title] && { titleSort: ov[_title] }),
|
||||
...(ov[_album] && { albumSort: ov[_album] }),
|
||||
};
|
||||
addJob(jobId, payload.title, payload.artist, payload.type, payload.album);
|
||||
try {
|
||||
@@ -644,11 +651,23 @@ export async function executeSpotifyDownload({ type, title, artist, artworkUrl,
|
||||
if (!S.cfg.backendUrl) { toast('⚠ Kein Backend konfiguriert'); return; }
|
||||
const jobId = 'job_' + Date.now();
|
||||
addJob(jobId, title, artist, type);
|
||||
const ov = getRomajiOverrides();
|
||||
const enrichedTracks = (tracks || []).map(t => {
|
||||
const a = t.artistName || '';
|
||||
const n = t.trackName || '';
|
||||
const al = t.collectionName || '';
|
||||
return {
|
||||
...t,
|
||||
...(ov[a] && { artistSort: ov[a], albumArtistSort: ov[a] }),
|
||||
...(ov[n] && { titleSort: ov[n] }),
|
||||
...(ov[al] && { albumSort: ov[al] }),
|
||||
};
|
||||
});
|
||||
try {
|
||||
const res = await fetch(`${S.cfg.backendUrl}/api/download`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ jobId, type, title, artist, artworkUrl, tracks }),
|
||||
body: JSON.stringify({ jobId, type, title, artist, artworkUrl, tracks: enrichedTracks }),
|
||||
});
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
pollJob(jobId);
|
||||
|
||||
Reference in new issue
Block a user