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.
|
// Explicit index prevents desync when JS and native queue pointers diverge.
|
||||||
_nsBridge('seekToIndex', ni, 0);
|
_nsBridge('seekToIndex', ni, 0);
|
||||||
_nsBridge('play');
|
_nsBridge('play');
|
||||||
|
}
|
||||||
// else: ni = -1 means end of queue with no repeat — let ExoPlayer stop naturally.
|
// else: ni = -1 means end of queue with no repeat — let ExoPlayer stop naturally.
|
||||||
if (S.radioMode && S.queue.length - S.qIdx < 5) fillRadioQueue();
|
if (S.radioMode && S.queue.length - S.qIdx < 5) fillRadioQueue();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -610,11 +610,15 @@ export async function executeDownload() {
|
|||||||
if(!S.downloadTarget || !S.cfg.backendUrl) return;
|
if(!S.downloadTarget || !S.cfg.backendUrl) return;
|
||||||
closeDlModal();
|
closeDlModal();
|
||||||
const jobId = 'job_' + Date.now();
|
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 = {
|
const payload = {
|
||||||
type: S.dlType,
|
type: S.dlType,
|
||||||
artist: S.downloadTarget.artistName || 'Unknown Artist',
|
artist: _artist,
|
||||||
title: S.downloadTarget.trackName || S.downloadTarget.collectionName || 'Unknown',
|
title: _title,
|
||||||
album: S.downloadTarget.collectionName || '',
|
album: _album,
|
||||||
artworkUrl: S.downloadTarget.artworkUrl100 || S.downloadTarget.artworkUrl60 || '',
|
artworkUrl: S.downloadTarget.artworkUrl100 || S.downloadTarget.artworkUrl60 || '',
|
||||||
itunesId: S.downloadTarget.trackId || S.downloadTarget.collectionId || null,
|
itunesId: S.downloadTarget.trackId || S.downloadTarget.collectionId || null,
|
||||||
collectionId: S.downloadTarget.collectionId || null,
|
collectionId: S.downloadTarget.collectionId || null,
|
||||||
@@ -624,6 +628,9 @@ export async function executeDownload() {
|
|||||||
discNum: S.downloadTarget.discNumber || undefined,
|
discNum: S.downloadTarget.discNumber || undefined,
|
||||||
discTotal: S.downloadTarget.discCount || undefined,
|
discTotal: S.downloadTarget.discCount || undefined,
|
||||||
durationMs: S.downloadTarget.trackTimeMillis || 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);
|
addJob(jobId, payload.title, payload.artist, payload.type, payload.album);
|
||||||
try {
|
try {
|
||||||
@@ -644,11 +651,23 @@ export async function executeSpotifyDownload({ type, title, artist, artworkUrl,
|
|||||||
if (!S.cfg.backendUrl) { toast('⚠ Kein Backend konfiguriert'); return; }
|
if (!S.cfg.backendUrl) { toast('⚠ Kein Backend konfiguriert'); return; }
|
||||||
const jobId = 'job_' + Date.now();
|
const jobId = 'job_' + Date.now();
|
||||||
addJob(jobId, title, artist, type);
|
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 {
|
try {
|
||||||
const res = await fetch(`${S.cfg.backendUrl}/api/download`, {
|
const res = await fetch(`${S.cfg.backendUrl}/api/download`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
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}`);
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||||
pollJob(jobId);
|
pollJob(jobId);
|
||||||
|
|||||||
Reference in new issue
Block a user