Eradicate all t-as-lambda-param shadowing across codebase
Renamed t -> trk (or tab as contextually appropriate) in all lambda/callback parameters across 6 files that import t from i18n. This prevents vite-plugin-svelte CSS extraction failures (PostCSS "Unknown word" errors) caused by t shadowing the i18n store. Files: +page.svelte, PlaylistDetailView, FavoritesView, TrackReplacementModal, Sidebar, SuggestionsPanel
This commit is contained in:
1 parent
386a66c905
commit
4df3fa52a4
6 files changed
+255
-255
No files matched your search
@@ -722,7 +722,7 @@
|
|||||||
try {
|
try {
|
||||||
const prefs = await invoke<FavoritesPreferences>('get_favorites_preferences');
|
const prefs = await invoke<FavoritesPreferences>('get_favorites_preferences');
|
||||||
// Filter out 'playlists' from tab order for sidebar display
|
// Filter out 'playlists' from tab order for sidebar display
|
||||||
favoritesTabOrder = (prefs.tab_order || ['tracks', 'albums', 'artists']).filter(t => t !== 'playlists');
|
favoritesTabOrder = (prefs.tab_order || ['tracks', 'albums', 'artists']).filter(tab => tab !== 'playlists');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.debug('[Sidebar] Failed to load favorites preferences:', err);
|
console.debug('[Sidebar] Failed to load favorites preferences:', err);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
limit: 20
|
limit: 20
|
||||||
});
|
});
|
||||||
// Filter out non-streamable tracks
|
// Filter out non-streamable tracks
|
||||||
results = response.items.filter(t => t.streamable !== false);
|
results = response.items.filter(trk => trk.streamable !== false);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Search failed:', err);
|
console.error('Search failed:', err);
|
||||||
results = [];
|
results = [];
|
||||||
@@ -111,7 +111,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleConfirm() {
|
function handleConfirm() {
|
||||||
const selected = results.find(t => t.id === selectedTrackId);
|
const selected = results.find(trk => trk.id === selectedTrackId);
|
||||||
if (selected) {
|
if (selected) {
|
||||||
onSelect(selected);
|
onSelect(selected);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
// Extract tracks for recommendations
|
// Extract tracks for recommendations
|
||||||
let tracks: Track[] = [];
|
let tracks: Track[] = [];
|
||||||
if (artist.tracks_appears_on?.items) {
|
if (artist.tracks_appears_on?.items) {
|
||||||
const filtered = artist.tracks_appears_on.items.filter(t => t.id !== trackId);
|
const filtered = artist.tracks_appears_on.items.filter(trk => trk.id !== trackId);
|
||||||
tracks = dedupeByExactTitle(filtered);
|
tracks = dedupeByExactTitle(filtered);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,13 +127,13 @@
|
|||||||
offset: 0
|
offset: 0
|
||||||
});
|
});
|
||||||
if (artistTracks.items) {
|
if (artistTracks.items) {
|
||||||
const filtered = artistTracks.items.filter(t => t.id !== trackId);
|
const filtered = artistTracks.items.filter(trk => trk.id !== trackId);
|
||||||
const deduped = dedupeByExactTitle(filtered);
|
const deduped = dedupeByExactTitle(filtered);
|
||||||
// Merge with existing, prioritizing new tracks
|
// Merge with existing, prioritizing new tracks
|
||||||
const existingIds = new Set(tracks.map(t => t.id));
|
const existingIds = new Set(tracks.map(trk => trk.id));
|
||||||
for (const t of deduped) {
|
for (const trk of deduped) {
|
||||||
if (!existingIds.has(t.id)) {
|
if (!existingIds.has(trk.id)) {
|
||||||
tracks.push(t);
|
tracks.push(trk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -695,7 +695,7 @@
|
|||||||
if (type === 'tracks') {
|
if (type === 'tracks') {
|
||||||
favoriteTracks = items as FavoriteTrack[];
|
favoriteTracks = items as FavoriteTrack[];
|
||||||
// Sync to local cache for other views
|
// Sync to local cache for other views
|
||||||
const trackIds = favoriteTracks.map(t => t.id);
|
const trackIds = favoriteTracks.map(trk => trk.id);
|
||||||
void syncTrackCache(trackIds);
|
void syncTrackCache(trackIds);
|
||||||
} else if (type === 'albums') {
|
} else if (type === 'albums') {
|
||||||
favoriteAlbums = items as FavoriteAlbum[];
|
favoriteAlbums = items as FavoriteAlbum[];
|
||||||
@@ -1041,32 +1041,32 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function buildFavoritesQueueTracks(tracks: FavoriteTrack[]) {
|
function buildFavoritesQueueTracks(tracks: FavoriteTrack[]) {
|
||||||
return tracks.map(t => ({
|
return tracks.map(trk => ({
|
||||||
id: t.id,
|
id: trk.id,
|
||||||
title: t.title,
|
title: trk.title,
|
||||||
artist: t.performer?.name || 'Unknown Artist',
|
artist: trk.performer?.name || 'Unknown Artist',
|
||||||
album: t.album?.title || 'Favorites',
|
album: trk.album?.title || 'Favorites',
|
||||||
duration_secs: t.duration,
|
duration_secs: trk.duration,
|
||||||
artwork_url: t.album?.image?.large || t.album?.image?.thumbnail || t.album?.image?.small || '',
|
artwork_url: trk.album?.image?.large || trk.album?.image?.thumbnail || trk.album?.image?.small || '',
|
||||||
hires: t.hires ?? false,
|
hires: trk.hires ?? false,
|
||||||
bit_depth: t.maximum_bit_depth ?? null,
|
bit_depth: trk.maximum_bit_depth ?? null,
|
||||||
sample_rate: t.maximum_sampling_rate ?? null,
|
sample_rate: trk.maximum_sampling_rate ?? null,
|
||||||
is_local: false,
|
is_local: false,
|
||||||
album_id: t.album?.id || null,
|
album_id: trk.album?.id || null,
|
||||||
artist_id: t.performer?.id ?? null,
|
artist_id: trk.performer?.id ?? null,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accessor functions for VirtualizedTrackList (adapts FavoriteTrack to expected interface)
|
// Accessor functions for VirtualizedTrackList (adapts FavoriteTrack to expected interface)
|
||||||
const getFavoriteTrackId = (t: FavoriteTrack) => t.id;
|
const getFavoriteTrackId = (trk: FavoriteTrack) => trk.id;
|
||||||
const getFavoriteTrackNumber = (t: FavoriteTrack, idx: number) => t.track_number || idx + 1;
|
const getFavoriteTrackNumber = (trk: FavoriteTrack, idx: number) => trk.track_number || idx + 1;
|
||||||
const getFavoriteTrackTitle = (t: FavoriteTrack) => t.title;
|
const getFavoriteTrackTitle = (trk: FavoriteTrack) => trk.title;
|
||||||
const getFavoriteTrackArtist = (t: FavoriteTrack) => t.performer?.name;
|
const getFavoriteTrackArtist = (trk: FavoriteTrack) => trk.performer?.name;
|
||||||
const getFavoriteTrackDuration = (t: FavoriteTrack) => t.duration;
|
const getFavoriteTrackDuration = (trk: FavoriteTrack) => trk.duration;
|
||||||
const getFavoriteTrackAlbumKey = (t: FavoriteTrack) => t.album?.id;
|
const getFavoriteTrackAlbumKey = (trk: FavoriteTrack) => trk.album?.id;
|
||||||
const getFavoriteTrackAlbum = (t: FavoriteTrack) => t.album?.title;
|
const getFavoriteTrackAlbum = (trk: FavoriteTrack) => trk.album?.title;
|
||||||
const getFavoriteArtistId = (t: FavoriteTrack) => t.performer?.id;
|
const getFavoriteArtistId = (trk: FavoriteTrack) => trk.performer?.id;
|
||||||
const getFavoriteAlbumId = (t: FavoriteTrack) => t.album?.id;
|
const getFavoriteAlbumId = (trk: FavoriteTrack) => trk.album?.id;
|
||||||
|
|
||||||
// VirtualizedTrackList requires this but we don't have disc info in favorites
|
// VirtualizedTrackList requires this but we don't have disc info in favorites
|
||||||
function buildFavoritesAlbumSections(tracks: FavoriteTrack[]) {
|
function buildFavoritesAlbumSections(tracks: FavoriteTrack[]) {
|
||||||
@@ -1104,7 +1104,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleTrackClick(track: FavoriteTrack, index: number) {
|
async function handleTrackClick(track: FavoriteTrack, index: number) {
|
||||||
const trackIds = filteredTracks.map(t => t.id);
|
const trackIds = filteredTracks.map(trk => trk.id);
|
||||||
await setFavoritesContext(trackIds, index);
|
await setFavoritesContext(trackIds, index);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -1123,7 +1123,7 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await setFavoritesQueue(0);
|
await setFavoritesQueue(0);
|
||||||
await setFavoritesContext(filteredTracks.map(t => t.id), 0);
|
await setFavoritesContext(filteredTracks.map(trk => trk.id), 0);
|
||||||
onTrackPlay(buildDisplayTrack(filteredTracks[0], 0));
|
onTrackPlay(buildDisplayTrack(filteredTracks[0], 0));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to set queue:', err);
|
console.error('Failed to set queue:', err);
|
||||||
@@ -1138,7 +1138,7 @@
|
|||||||
const shuffled = [...filteredTracks].sort(() => Math.random() - 0.5);
|
const shuffled = [...filteredTracks].sort(() => Math.random() - 0.5);
|
||||||
const queueTracks = buildFavoritesQueueTracks(shuffled);
|
const queueTracks = buildFavoritesQueueTracks(shuffled);
|
||||||
await invoke('set_queue', { tracks: queueTracks, startIndex: 0 });
|
await invoke('set_queue', { tracks: queueTracks, startIndex: 0 });
|
||||||
await setFavoritesContext(shuffled.map(t => t.id), 0);
|
await setFavoritesContext(shuffled.map(trk => trk.id), 0);
|
||||||
onTrackPlay(buildDisplayTrack(shuffled[0], 0));
|
onTrackPlay(buildDisplayTrack(shuffled[0], 0));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to shuffle queue:', err);
|
console.error('Failed to shuffle queue:', err);
|
||||||
@@ -1573,8 +1573,8 @@
|
|||||||
getQualityBadge={getQualityLabel}
|
getQualityBadge={getQualityLabel}
|
||||||
buildAlbumSections={buildFavoritesAlbumSections}
|
buildAlbumSections={buildFavoritesAlbumSections}
|
||||||
onTrackPlay={handleVirtualizedTrackPlay}
|
onTrackPlay={handleVirtualizedTrackPlay}
|
||||||
onTrackPlayNext={onTrackPlayNext ? (t) => onTrackPlayNext(buildDisplayTrackFromFavorite(t)) : undefined}
|
onTrackPlayNext={onTrackPlayNext ? (trk) => onTrackPlayNext(buildDisplayTrackFromFavorite(trk)) : undefined}
|
||||||
onTrackPlayLater={onTrackPlayLater ? (t) => onTrackPlayLater(buildDisplayTrackFromFavorite(t)) : undefined}
|
onTrackPlayLater={onTrackPlayLater ? (trk) => onTrackPlayLater(buildDisplayTrackFromFavorite(trk)) : undefined}
|
||||||
onTrackAddToPlaylist={onTrackAddToPlaylist}
|
onTrackAddToPlaylist={onTrackAddToPlaylist}
|
||||||
getTrackId={getFavoriteTrackId}
|
getTrackId={getFavoriteTrackId}
|
||||||
getTrackNumber={getFavoriteTrackNumber}
|
getTrackNumber={getFavoriteTrackNumber}
|
||||||
@@ -1591,14 +1591,14 @@
|
|||||||
hideFavorite={false}
|
hideFavorite={false}
|
||||||
isFavoriteOverride={true}
|
isFavoriteOverride={true}
|
||||||
getOfflineCacheStatus={getTrackOfflineCacheStatus}
|
getOfflineCacheStatus={getTrackOfflineCacheStatus}
|
||||||
onDownload={onTrackDownload ? (t) => onTrackDownload(buildDisplayTrackFromFavorite(t)) : undefined}
|
onDownload={onTrackDownload ? (trk) => onTrackDownload(buildDisplayTrackFromFavorite(trk)) : undefined}
|
||||||
onRemoveDownload={onTrackRemoveDownload}
|
onRemoveDownload={onTrackRemoveDownload}
|
||||||
onShareQobuz={onTrackShareQobuz}
|
onShareQobuz={onTrackShareQobuz}
|
||||||
onShareSonglink={onTrackShareSonglink ? (t) => onTrackShareSonglink(buildDisplayTrackFromFavorite(t)) : undefined}
|
onShareSonglink={onTrackShareSonglink ? (trk) => onTrackShareSonglink(buildDisplayTrackFromFavorite(trk)) : undefined}
|
||||||
onGoToAlbum={onTrackGoToAlbum}
|
onGoToAlbum={onTrackGoToAlbum}
|
||||||
onGoToArtist={onTrackGoToArtist}
|
onGoToArtist={onTrackGoToArtist}
|
||||||
onShowInfo={onTrackShowInfo}
|
onShowInfo={onTrackShowInfo}
|
||||||
onReDownload={onTrackReDownload ? (t) => onTrackReDownload(buildDisplayTrackFromFavorite(t)) : undefined}
|
onReDownload={onTrackReDownload ? (trk) => onTrackReDownload(buildDisplayTrackFromFavorite(trk)) : undefined}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -370,7 +370,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const qobuzTrackIds = tracks.filter(t => !t.isLocal).map(t => t.id);
|
const qobuzTrackIds = tracks.filter(trk => !trk.isLocal).map(trk => trk.id);
|
||||||
if (qobuzTrackIds.length === 0) {
|
if (qobuzTrackIds.length === 0) {
|
||||||
tracksWithLocalCopies = new Set();
|
tracksWithLocalCopies = new Set();
|
||||||
return;
|
return;
|
||||||
@@ -436,7 +436,7 @@
|
|||||||
...track,
|
...track,
|
||||||
playlist_position: pending.trackIds.length + idx // Local tracks come after Qobuz tracks
|
playlist_position: pending.trackIds.length + idx // Local tracks come after Qobuz tracks
|
||||||
}));
|
}));
|
||||||
localTracksMap = new Map(localTracks.map(t => [t.id, t]));
|
localTracksMap = new Map(localTracks.map(trk => [trk.id, trk]));
|
||||||
} else {
|
} else {
|
||||||
localTracks = [];
|
localTracks = [];
|
||||||
localTracksMap = new Map();
|
localTracksMap = new Map();
|
||||||
@@ -445,7 +445,7 @@
|
|||||||
// Regular playlist - use existing command
|
// Regular playlist - use existing command
|
||||||
const result = await invoke<PlaylistLocalTrack[]>('playlist_get_local_tracks_with_position', { playlistId });
|
const result = await invoke<PlaylistLocalTrack[]>('playlist_get_local_tracks_with_position', { playlistId });
|
||||||
localTracks = result;
|
localTracks = result;
|
||||||
localTracksMap = new Map(result.map(t => [t.id, t]));
|
localTracksMap = new Map(result.map(trk => [trk.id, trk]));
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to load local tracks:', err);
|
console.error('Failed to load local tracks:', err);
|
||||||
@@ -704,15 +704,15 @@
|
|||||||
const trackIds: [number, boolean][] = [];
|
const trackIds: [number, boolean][] = [];
|
||||||
|
|
||||||
// Add Qobuz tracks first (in original order)
|
// Add Qobuz tracks first (in original order)
|
||||||
for (const t of allTracks) {
|
for (const trk of allTracks) {
|
||||||
if (!t.isLocal) {
|
if (!trk.isLocal) {
|
||||||
trackIds.push([t.id, false]);
|
trackIds.push([trk.id, false]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add local tracks (by their position)
|
// Add local tracks (by their position)
|
||||||
for (const t of localTracksInPlaylist) {
|
for (const trk of localTracksInPlaylist) {
|
||||||
trackIds.push([t.id, true]);
|
trackIds.push([trk.id, true]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save to backend
|
// Save to backend
|
||||||
@@ -880,9 +880,9 @@
|
|||||||
if (selectedIndices[0] === 0) return;
|
if (selectedIndices[0] === 0) return;
|
||||||
|
|
||||||
// Build new order: swap each selected with the one above
|
// Build new order: swap each selected with the one above
|
||||||
const currentOrder = displayTracks.map(t => ({
|
const currentOrder = displayTracks.map(trk => ({
|
||||||
id: t.isLocal ? Math.abs(t.id) : t.id,
|
id: trk.isLocal ? Math.abs(trk.id) : trk.id,
|
||||||
isLocal: t.isLocal ?? false
|
isLocal: trk.isLocal ?? false
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Move from top to bottom to avoid conflicts
|
// Move from top to bottom to avoid conflicts
|
||||||
@@ -923,9 +923,9 @@
|
|||||||
if (selectedIndices[0] === displayTracks.length - 1) return;
|
if (selectedIndices[0] === displayTracks.length - 1) return;
|
||||||
|
|
||||||
// Build new order: swap each selected with the one below
|
// Build new order: swap each selected with the one below
|
||||||
const currentOrder = displayTracks.map(t => ({
|
const currentOrder = displayTracks.map(trk => ({
|
||||||
id: t.isLocal ? Math.abs(t.id) : t.id,
|
id: trk.isLocal ? Math.abs(trk.id) : trk.id,
|
||||||
isLocal: t.isLocal ?? false
|
isLocal: trk.isLocal ?? false
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Move from bottom to top to avoid conflicts
|
// Move from bottom to top to avoid conflicts
|
||||||
@@ -1037,10 +1037,10 @@
|
|||||||
let filtered = result;
|
let filtered = result;
|
||||||
if (searchQuery.trim()) {
|
if (searchQuery.trim()) {
|
||||||
const query = searchQuery.toLowerCase();
|
const query = searchQuery.toLowerCase();
|
||||||
filtered = result.filter(t =>
|
filtered = result.filter(trk =>
|
||||||
t.title.toLowerCase().includes(query) ||
|
trk.title.toLowerCase().includes(query) ||
|
||||||
(t.artist?.toLowerCase().includes(query)) ||
|
(trk.artist?.toLowerCase().includes(query)) ||
|
||||||
(t.album?.toLowerCase().includes(query))
|
(trk.album?.toLowerCase().includes(query))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1135,30 +1135,30 @@
|
|||||||
|
|
||||||
function buildQueueTracks(tracks: DisplayTrack[]) {
|
function buildQueueTracks(tracks: DisplayTrack[]) {
|
||||||
// Filter out blacklisted artists before building queue
|
// Filter out blacklisted artists before building queue
|
||||||
const filteredTracks = tracks.filter(t => {
|
const filteredTracks = tracks.filter(trk => {
|
||||||
if (t.isLocal) return true; // Local tracks are never blacklisted
|
if (trk.isLocal) return true; // Local tracks are never blacklisted
|
||||||
if (!t.artistId) return true; // No artist ID, can't check blacklist
|
if (!trk.artistId) return true; // No artist ID, can't check blacklist
|
||||||
return !isArtistBlacklisted(t.artistId);
|
return !isArtistBlacklisted(trk.artistId);
|
||||||
});
|
});
|
||||||
|
|
||||||
const queueTracks = filteredTracks.map(t => ({
|
const queueTracks = filteredTracks.map(trk => ({
|
||||||
id: t.isLocal ? Math.abs(t.id) : t.id,
|
id: trk.isLocal ? Math.abs(trk.id) : trk.id,
|
||||||
title: t.title,
|
title: trk.title,
|
||||||
artist: t.artist || 'Unknown Artist',
|
artist: trk.artist || 'Unknown Artist',
|
||||||
album: t.album || playlist?.name || 'Playlist',
|
album: trk.album || playlist?.name || 'Playlist',
|
||||||
duration_secs: t.durationSeconds,
|
duration_secs: trk.durationSeconds,
|
||||||
artwork_url: t.albumArt || getPlaylistImage(),
|
artwork_url: trk.albumArt || getPlaylistImage(),
|
||||||
hires: t.hires ?? false,
|
hires: trk.hires ?? false,
|
||||||
bit_depth: t.bitDepth ?? null,
|
bit_depth: trk.bitDepth ?? null,
|
||||||
sample_rate: t.samplingRate != null ? (t.isLocal ? t.samplingRate * 1000 : t.samplingRate) : null,
|
sample_rate: trk.samplingRate != null ? (trk.isLocal ? trk.samplingRate * 1000 : trk.samplingRate) : null,
|
||||||
is_local: t.isLocal ?? false,
|
is_local: trk.isLocal ?? false,
|
||||||
album_id: t.isLocal ? null : (t.albumId || null),
|
album_id: trk.isLocal ? null : (trk.albumId || null),
|
||||||
artist_id: t.isLocal ? null : (t.artistId ?? null),
|
artist_id: trk.isLocal ? null : (trk.artistId ?? null),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const localIds = filteredTracks
|
const localIds = filteredTracks
|
||||||
.filter(t => t.isLocal)
|
.filter(trk => trk.isLocal)
|
||||||
.map(t => Math.abs(t.id));
|
.map(trk => Math.abs(trk.id));
|
||||||
|
|
||||||
return { queueTracks, localIds };
|
return { queueTracks, localIds };
|
||||||
}
|
}
|
||||||
@@ -1177,9 +1177,9 @@
|
|||||||
// Create playlist context before playing
|
// Create playlist context before playing
|
||||||
if (playlist) {
|
if (playlist) {
|
||||||
const trackIds = displayTracks
|
const trackIds = displayTracks
|
||||||
.filter(t => !t.isLocal) // Only Qobuz tracks in context
|
.filter(trk => !trk.isLocal) // Only Qobuz tracks in context
|
||||||
.map(t => t.id);
|
.map(trk => trk.id);
|
||||||
|
|
||||||
const contextIndex = trackIds.indexOf(track.id);
|
const contextIndex = trackIds.indexOf(track.id);
|
||||||
|
|
||||||
if (contextIndex >= 0 && trackIds.length > 0) {
|
if (contextIndex >= 0 && trackIds.length > 0) {
|
||||||
@@ -1288,7 +1288,7 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Get the current position of the track being replaced
|
// Get the current position of the track being replaced
|
||||||
const currentIndex = displayTracks.findIndex(t => t.id === trackToReplace!.id);
|
const currentIndex = displayTracks.findIndex(trk => trk.id === trackToReplace!.id);
|
||||||
|
|
||||||
// Remove the old track
|
// Remove the old track
|
||||||
await invoke('remove_tracks_from_playlist', {
|
await invoke('remove_tracks_from_playlist', {
|
||||||
@@ -1416,10 +1416,10 @@
|
|||||||
if (allTracks.length === 0) return;
|
if (allTracks.length === 0) return;
|
||||||
|
|
||||||
// Filter out blacklisted tracks
|
// Filter out blacklisted tracks
|
||||||
const playableTracks = allTracks.filter(t => {
|
const playableTracks = allTracks.filter(trk => {
|
||||||
if (t.isLocal) return true;
|
if (trk.isLocal) return true;
|
||||||
if (!t.artistId) return true;
|
if (!trk.artistId) return true;
|
||||||
return !isArtistBlacklisted(t.artistId);
|
return !isArtistBlacklisted(trk.artistId);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (playableTracks.length === 0) return;
|
if (playableTracks.length === 0) return;
|
||||||
@@ -1427,8 +1427,8 @@
|
|||||||
// Set playback context for playlist
|
// Set playback context for playlist
|
||||||
if (playlist) {
|
if (playlist) {
|
||||||
const trackIds = playableTracks
|
const trackIds = playableTracks
|
||||||
.filter(t => !t.isLocal) // Only Qobuz tracks in context
|
.filter(trk => !trk.isLocal) // Only Qobuz tracks in context
|
||||||
.map(t => t.id);
|
.map(trk => trk.id);
|
||||||
|
|
||||||
if (trackIds.length > 0) {
|
if (trackIds.length > 0) {
|
||||||
await setPlaybackContext(
|
await setPlaybackContext(
|
||||||
@@ -1449,7 +1449,7 @@
|
|||||||
// Play first playable track (handle local vs Qobuz)
|
// Play first playable track (handle local vs Qobuz)
|
||||||
const firstTrack = playableTracks[0];
|
const firstTrack = playableTracks[0];
|
||||||
if (firstTrack.isLocal && onLocalTrackPlay) {
|
if (firstTrack.isLocal && onLocalTrackPlay) {
|
||||||
const localTrack = localTracks.find(t => t.id === Math.abs(firstTrack.id));
|
const localTrack = localTracks.find(trk => trk.id === Math.abs(firstTrack.id));
|
||||||
if (localTrack) onLocalTrackPlay(localTrack);
|
if (localTrack) onLocalTrackPlay(localTrack);
|
||||||
} else if (onTrackPlay) {
|
} else if (onTrackPlay) {
|
||||||
onTrackPlay(firstTrack);
|
onTrackPlay(firstTrack);
|
||||||
@@ -1493,37 +1493,37 @@
|
|||||||
if (allTracks.length === 0) return;
|
if (allTracks.length === 0) return;
|
||||||
|
|
||||||
// Filter out blacklisted tracks
|
// Filter out blacklisted tracks
|
||||||
const playableTracks = allTracks.filter(t => {
|
const playableTracks = allTracks.filter(trk => {
|
||||||
if (t.isLocal) return true;
|
if (trk.isLocal) return true;
|
||||||
if (!t.artistId) return true;
|
if (!trk.artistId) return true;
|
||||||
return !isArtistBlacklisted(t.artistId);
|
return !isArtistBlacklisted(trk.artistId);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (playableTracks.length === 0) return;
|
if (playableTracks.length === 0) return;
|
||||||
|
|
||||||
// Collect local track IDs to add to set
|
// Collect local track IDs to add to set
|
||||||
const localIds = playableTracks
|
const localIds = playableTracks
|
||||||
.filter(t => t.isLocal)
|
.filter(trk => trk.isLocal)
|
||||||
.map(t => Math.abs(t.id));
|
.map(trk => Math.abs(trk.id));
|
||||||
|
|
||||||
// Add in reverse order so first track ends up right after current
|
// Add in reverse order so first track ends up right after current
|
||||||
for (let i = playableTracks.length - 1; i >= 0; i--) {
|
for (let i = playableTracks.length - 1; i >= 0; i--) {
|
||||||
const t = playableTracks[i];
|
const trk = playableTracks[i];
|
||||||
try {
|
try {
|
||||||
await invoke('add_to_queue_next', {
|
await invoke('add_to_queue_next', {
|
||||||
track: {
|
track: {
|
||||||
id: t.isLocal ? Math.abs(t.id) : t.id,
|
id: trk.isLocal ? Math.abs(trk.id) : trk.id,
|
||||||
title: t.title,
|
title: trk.title,
|
||||||
artist: t.artist || 'Unknown Artist',
|
artist: trk.artist || 'Unknown Artist',
|
||||||
album: t.album || playlist?.name || 'Playlist',
|
album: trk.album || playlist?.name || 'Playlist',
|
||||||
duration_secs: t.durationSeconds,
|
duration_secs: trk.durationSeconds,
|
||||||
artwork_url: t.albumArt || getPlaylistImage(),
|
artwork_url: trk.albumArt || getPlaylistImage(),
|
||||||
hires: t.hires ?? false,
|
hires: trk.hires ?? false,
|
||||||
bit_depth: t.bitDepth ?? null,
|
bit_depth: trk.bitDepth ?? null,
|
||||||
sample_rate: t.samplingRate != null ? (t.isLocal ? t.samplingRate * 1000 : t.samplingRate) : null,
|
sample_rate: trk.samplingRate != null ? (trk.isLocal ? trk.samplingRate * 1000 : trk.samplingRate) : null,
|
||||||
is_local: t.isLocal ?? false,
|
is_local: trk.isLocal ?? false,
|
||||||
album_id: t.isLocal ? null : (t.albumId || null),
|
album_id: trk.isLocal ? null : (trk.albumId || null),
|
||||||
artist_id: t.isLocal ? null : (t.artistId ?? null),
|
artist_id: trk.isLocal ? null : (trk.artistId ?? null),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -1542,33 +1542,33 @@
|
|||||||
if (allTracks.length === 0) return;
|
if (allTracks.length === 0) return;
|
||||||
|
|
||||||
// Filter out blacklisted tracks
|
// Filter out blacklisted tracks
|
||||||
const playableTracks = allTracks.filter(t => {
|
const playableTracks = allTracks.filter(trk => {
|
||||||
if (t.isLocal) return true;
|
if (trk.isLocal) return true;
|
||||||
if (!t.artistId) return true;
|
if (!trk.artistId) return true;
|
||||||
return !isArtistBlacklisted(t.artistId);
|
return !isArtistBlacklisted(trk.artistId);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (playableTracks.length === 0) return;
|
if (playableTracks.length === 0) return;
|
||||||
|
|
||||||
const queueTracks = playableTracks.map(t => ({
|
const queueTracks = playableTracks.map(trk => ({
|
||||||
id: t.isLocal ? Math.abs(t.id) : t.id,
|
id: trk.isLocal ? Math.abs(trk.id) : trk.id,
|
||||||
title: t.title,
|
title: trk.title,
|
||||||
artist: t.artist || 'Unknown Artist',
|
artist: trk.artist || 'Unknown Artist',
|
||||||
album: t.album || playlist?.name || 'Playlist',
|
album: trk.album || playlist?.name || 'Playlist',
|
||||||
duration_secs: t.durationSeconds,
|
duration_secs: trk.durationSeconds,
|
||||||
artwork_url: t.albumArt || getPlaylistImage(),
|
artwork_url: trk.albumArt || getPlaylistImage(),
|
||||||
hires: t.hires ?? false,
|
hires: trk.hires ?? false,
|
||||||
bit_depth: t.bitDepth ?? null,
|
bit_depth: trk.bitDepth ?? null,
|
||||||
sample_rate: t.samplingRate != null ? (t.isLocal ? t.samplingRate * 1000 : t.samplingRate) : null,
|
sample_rate: trk.samplingRate != null ? (trk.isLocal ? trk.samplingRate * 1000 : trk.samplingRate) : null,
|
||||||
is_local: t.isLocal ?? false,
|
is_local: trk.isLocal ?? false,
|
||||||
album_id: t.isLocal ? null : (t.albumId || null),
|
album_id: trk.isLocal ? null : (trk.albumId || null),
|
||||||
artist_id: t.isLocal ? null : (t.artistId ?? null),
|
artist_id: trk.isLocal ? null : (trk.artistId ?? null),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Collect local track IDs
|
// Collect local track IDs
|
||||||
const localIds = playableTracks
|
const localIds = playableTracks
|
||||||
.filter(t => t.isLocal)
|
.filter(trk => trk.isLocal)
|
||||||
.map(t => Math.abs(t.id));
|
.map(trk => Math.abs(trk.id));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await invoke('add_tracks_to_queue', { tracks: queueTracks });
|
await invoke('add_tracks_to_queue', { tracks: queueTracks });
|
||||||
@@ -1633,7 +1633,7 @@
|
|||||||
{:else}
|
{:else}
|
||||||
<div class="collage-wrapper">
|
<div class="collage-wrapper">
|
||||||
<PlaylistCollage
|
<PlaylistCollage
|
||||||
artworks={tracks.slice(0, 4).map(t => t.albumArt).filter((a): a is string => !!a)}
|
artworks={tracks.slice(0, 4).map(trk => trk.albumArt).filter((a): a is string => !!a)}
|
||||||
size={200}
|
size={200}
|
||||||
/>
|
/>
|
||||||
<div class="artwork-overlay">
|
<div class="artwork-overlay">
|
||||||
@@ -1920,7 +1920,7 @@
|
|||||||
playlistId={playlistId}
|
playlistId={playlistId}
|
||||||
artists={playlistArtists}
|
artists={playlistArtists}
|
||||||
excludeTrackIds={excludeTrackIds}
|
excludeTrackIds={excludeTrackIds}
|
||||||
existingTracks={tracks.filter(t => !t.isLocal).map(t => ({ title: t.title, artist: t.artist }))}
|
existingTracks={tracks.filter(trk => !trk.isLocal).map(trk => ({ title: trk.title, artist: trk.artist }))}
|
||||||
onAddTrack={handleAddSuggestedTrack}
|
onAddTrack={handleAddSuggestedTrack}
|
||||||
onGoToAlbum={onTrackGoToAlbum}
|
onGoToAlbum={onTrackGoToAlbum}
|
||||||
onGoToArtist={onTrackGoToArtist}
|
onGoToArtist={onTrackGoToArtist}
|
||||||
|
|||||||
+128
-128
@@ -907,19 +907,19 @@
|
|||||||
if (!album?.tracks?.length) return;
|
if (!album?.tracks?.length) return;
|
||||||
|
|
||||||
const artwork = album.artwork || '';
|
const artwork = album.artwork || '';
|
||||||
const queueTracks: BackendQueueTrack[] = album.tracks.map(t => ({
|
const queueTracks: BackendQueueTrack[] = album.tracks.map(trk => ({
|
||||||
id: t.id,
|
id: trk.id,
|
||||||
title: t.title,
|
title: trk.title,
|
||||||
artist: t.artist || album.artist || 'Unknown Artist',
|
artist: trk.artist || album.artist || 'Unknown Artist',
|
||||||
album: album.title || '',
|
album: album.title || '',
|
||||||
duration_secs: t.durationSeconds,
|
duration_secs: trk.durationSeconds,
|
||||||
artwork_url: artwork || null,
|
artwork_url: artwork || null,
|
||||||
hires: t.hires ?? false,
|
hires: trk.hires ?? false,
|
||||||
bit_depth: t.bitDepth ?? null,
|
bit_depth: trk.bitDepth ?? null,
|
||||||
sample_rate: t.samplingRate ?? null,
|
sample_rate: trk.samplingRate ?? null,
|
||||||
is_local: false,
|
is_local: false,
|
||||||
album_id: album.id,
|
album_id: album.id,
|
||||||
artist_id: t.artistId ?? album.artistId
|
artist_id: trk.artistId ?? album.artistId
|
||||||
}));
|
}));
|
||||||
|
|
||||||
await setQueue(queueTracks, 0, true);
|
await setQueue(queueTracks, 0, true);
|
||||||
@@ -951,20 +951,20 @@
|
|||||||
|
|
||||||
const artwork = album.artwork || '';
|
const artwork = album.artwork || '';
|
||||||
for (let i = album.tracks.length - 1; i >= 0; i--) {
|
for (let i = album.tracks.length - 1; i >= 0; i--) {
|
||||||
const t = album.tracks[i];
|
const trk = album.tracks[i];
|
||||||
queueTrackNext({
|
queueTrackNext({
|
||||||
id: t.id,
|
id: trk.id,
|
||||||
title: t.title,
|
title: trk.title,
|
||||||
artist: t.artist || album.artist || 'Unknown Artist',
|
artist: trk.artist || album.artist || 'Unknown Artist',
|
||||||
album: album.title || '',
|
album: album.title || '',
|
||||||
duration_secs: t.durationSeconds,
|
duration_secs: trk.durationSeconds,
|
||||||
artwork_url: artwork || null,
|
artwork_url: artwork || null,
|
||||||
hires: t.hires ?? false,
|
hires: trk.hires ?? false,
|
||||||
bit_depth: t.bitDepth ?? null,
|
bit_depth: trk.bitDepth ?? null,
|
||||||
sample_rate: t.samplingRate ?? null,
|
sample_rate: trk.samplingRate ?? null,
|
||||||
is_local: false,
|
is_local: false,
|
||||||
album_id: album.id,
|
album_id: album.id,
|
||||||
artist_id: t.artistId ?? album.artistId
|
artist_id: trk.artistId ?? album.artistId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
showToast($t('toast.playingTracksNext', { values: { count: album.tracks.length } }), 'success');
|
showToast($t('toast.playingTracksNext', { values: { count: album.tracks.length } }), 'success');
|
||||||
@@ -975,19 +975,19 @@
|
|||||||
if (!album?.tracks?.length) return;
|
if (!album?.tracks?.length) return;
|
||||||
|
|
||||||
const artwork = album.artwork || '';
|
const artwork = album.artwork || '';
|
||||||
const queueTracks: BackendQueueTrack[] = album.tracks.map(t => ({
|
const queueTracks: BackendQueueTrack[] = album.tracks.map(trk => ({
|
||||||
id: t.id,
|
id: trk.id,
|
||||||
title: t.title,
|
title: trk.title,
|
||||||
artist: t.artist || album.artist || 'Unknown Artist',
|
artist: trk.artist || album.artist || 'Unknown Artist',
|
||||||
album: album.title || '',
|
album: album.title || '',
|
||||||
duration_secs: t.durationSeconds,
|
duration_secs: trk.durationSeconds,
|
||||||
artwork_url: artwork || null,
|
artwork_url: artwork || null,
|
||||||
hires: t.hires ?? false,
|
hires: trk.hires ?? false,
|
||||||
bit_depth: t.bitDepth ?? null,
|
bit_depth: trk.bitDepth ?? null,
|
||||||
sample_rate: t.samplingRate ?? null,
|
sample_rate: trk.samplingRate ?? null,
|
||||||
is_local: false,
|
is_local: false,
|
||||||
album_id: album.id,
|
album_id: album.id,
|
||||||
artist_id: t.artistId ?? album.artistId
|
artist_id: trk.artistId ?? album.artistId
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const success = await addTracksToQueue(queueTracks);
|
const success = await addTracksToQueue(queueTracks);
|
||||||
@@ -1107,19 +1107,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const tracks = playlist.tracks.items;
|
const tracks = playlist.tracks.items;
|
||||||
const queueTracks: BackendQueueTrack[] = tracks.map(t => ({
|
const queueTracks: BackendQueueTrack[] = tracks.map(trk => ({
|
||||||
id: t.id,
|
id: trk.id,
|
||||||
title: t.title,
|
title: trk.title,
|
||||||
artist: t.performer?.name || 'Unknown Artist',
|
artist: trk.performer?.name || 'Unknown Artist',
|
||||||
album: t.album?.title || '',
|
album: trk.album?.title || '',
|
||||||
duration_secs: t.duration,
|
duration_secs: trk.duration,
|
||||||
artwork_url: t.album?.image?.large || t.album?.image?.thumbnail || t.album?.image?.small || null,
|
artwork_url: trk.album?.image?.large || trk.album?.image?.thumbnail || trk.album?.image?.small || null,
|
||||||
hires: t.hires_streamable ?? false,
|
hires: trk.hires_streamable ?? false,
|
||||||
bit_depth: t.maximum_bit_depth ?? null,
|
bit_depth: trk.maximum_bit_depth ?? null,
|
||||||
sample_rate: t.maximum_sampling_rate ?? null,
|
sample_rate: trk.maximum_sampling_rate ?? null,
|
||||||
is_local: false,
|
is_local: false,
|
||||||
album_id: t.album?.id,
|
album_id: trk.album?.id,
|
||||||
artist_id: t.performer?.id
|
artist_id: trk.performer?.id
|
||||||
}));
|
}));
|
||||||
|
|
||||||
await setQueue(queueTracks, 0);
|
await setQueue(queueTracks, 0);
|
||||||
@@ -1157,20 +1157,20 @@
|
|||||||
const tracks = playlist.tracks.items;
|
const tracks = playlist.tracks.items;
|
||||||
// Add in reverse order so they play in correct sequence
|
// Add in reverse order so they play in correct sequence
|
||||||
for (let i = tracks.length - 1; i >= 0; i--) {
|
for (let i = tracks.length - 1; i >= 0; i--) {
|
||||||
const t = tracks[i];
|
const trk = tracks[i];
|
||||||
queueTrackNext({
|
queueTrackNext({
|
||||||
id: t.id,
|
id: trk.id,
|
||||||
title: t.title,
|
title: trk.title,
|
||||||
artist: t.performer?.name || 'Unknown Artist',
|
artist: trk.performer?.name || 'Unknown Artist',
|
||||||
album: t.album?.title || '',
|
album: trk.album?.title || '',
|
||||||
duration_secs: t.duration,
|
duration_secs: trk.duration,
|
||||||
artwork_url: t.album?.image?.large || t.album?.image?.thumbnail || t.album?.image?.small || null,
|
artwork_url: trk.album?.image?.large || trk.album?.image?.thumbnail || trk.album?.image?.small || null,
|
||||||
hires: t.hires_streamable ?? false,
|
hires: trk.hires_streamable ?? false,
|
||||||
bit_depth: t.maximum_bit_depth ?? null,
|
bit_depth: trk.maximum_bit_depth ?? null,
|
||||||
sample_rate: t.maximum_sampling_rate ?? null,
|
sample_rate: trk.maximum_sampling_rate ?? null,
|
||||||
is_local: false,
|
is_local: false,
|
||||||
album_id: t.album?.id,
|
album_id: trk.album?.id,
|
||||||
artist_id: t.performer?.id
|
artist_id: trk.performer?.id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
showToast($t('toast.playingTracksNext', { values: { count: tracks.length } }), 'success');
|
showToast($t('toast.playingTracksNext', { values: { count: tracks.length } }), 'success');
|
||||||
@@ -1184,19 +1184,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const tracks = playlist.tracks.items;
|
const tracks = playlist.tracks.items;
|
||||||
const queueTracks: BackendQueueTrack[] = tracks.map(t => ({
|
const queueTracks: BackendQueueTrack[] = tracks.map(trk => ({
|
||||||
id: t.id,
|
id: trk.id,
|
||||||
title: t.title,
|
title: trk.title,
|
||||||
artist: t.performer?.name || 'Unknown Artist',
|
artist: trk.performer?.name || 'Unknown Artist',
|
||||||
album: t.album?.title || '',
|
album: trk.album?.title || '',
|
||||||
duration_secs: t.duration,
|
duration_secs: trk.duration,
|
||||||
artwork_url: t.album?.image?.large || t.album?.image?.thumbnail || t.album?.image?.small || null,
|
artwork_url: trk.album?.image?.large || trk.album?.image?.thumbnail || trk.album?.image?.small || null,
|
||||||
hires: t.hires_streamable ?? false,
|
hires: trk.hires_streamable ?? false,
|
||||||
bit_depth: t.maximum_bit_depth ?? null,
|
bit_depth: trk.maximum_bit_depth ?? null,
|
||||||
sample_rate: t.maximum_sampling_rate ?? null,
|
sample_rate: trk.maximum_sampling_rate ?? null,
|
||||||
is_local: false,
|
is_local: false,
|
||||||
album_id: t.album?.id,
|
album_id: trk.album?.id,
|
||||||
artist_id: t.performer?.id
|
artist_id: trk.performer?.id
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const success = await addTracksToQueue(queueTracks);
|
const success = await addTracksToQueue(queueTracks);
|
||||||
@@ -1270,8 +1270,8 @@
|
|||||||
// ALWAYS create context when playing from an album
|
// ALWAYS create context when playing from an album
|
||||||
// The setting only affects menu options visibility, not implicit behavior
|
// The setting only affects menu options visibility, not implicit behavior
|
||||||
if (selectedAlbum?.tracks) {
|
if (selectedAlbum?.tracks) {
|
||||||
const trackIndex = selectedAlbum.tracks.findIndex(t => t.id === track.id);
|
const trackIndex = selectedAlbum.tracks.findIndex(trk => trk.id === track.id);
|
||||||
const trackIds = selectedAlbum.tracks.map(t => t.id);
|
const trackIds = selectedAlbum.tracks.map(trk => trk.id);
|
||||||
|
|
||||||
console.log('[Album] Creating context with', trackIds.length, 'tracks, starting at', trackIndex);
|
console.log('[Album] Creating context with', trackIds.length, 'tracks, starting at', trackIndex);
|
||||||
await setPlaybackContext(
|
await setPlaybackContext(
|
||||||
@@ -1299,29 +1299,29 @@
|
|||||||
console.log('[Album Queue] Building queue from', selectedAlbum.tracks.length, 'album tracks');
|
console.log('[Album Queue] Building queue from', selectedAlbum.tracks.length, 'album tracks');
|
||||||
|
|
||||||
// Filter out blacklisted tracks
|
// Filter out blacklisted tracks
|
||||||
const playableTracks = selectedAlbum.tracks.filter(t => {
|
const playableTracks = selectedAlbum.tracks.filter(trk => {
|
||||||
const artistId = t.artistId ?? selectedAlbum.artistId;
|
const artistId = trk.artistId ?? selectedAlbum.artistId;
|
||||||
return !artistId || !isArtistBlacklisted(artistId);
|
return !artistId || !isArtistBlacklisted(artistId);
|
||||||
});
|
});
|
||||||
|
|
||||||
const trackIndex = playableTracks.findIndex(t => t.id === track.id);
|
const trackIndex = playableTracks.findIndex(trk => trk.id === track.id);
|
||||||
const queueTracks: BackendQueueTrack[] = playableTracks.map(t => ({
|
const queueTracks: BackendQueueTrack[] = playableTracks.map(trk => ({
|
||||||
id: t.id,
|
id: trk.id,
|
||||||
title: t.title,
|
title: trk.title,
|
||||||
artist: t.artist || selectedAlbum?.artist || 'Unknown Artist',
|
artist: trk.artist || selectedAlbum?.artist || 'Unknown Artist',
|
||||||
album: selectedAlbum?.title || '',
|
album: selectedAlbum?.title || '',
|
||||||
duration_secs: t.durationSeconds,
|
duration_secs: trk.durationSeconds,
|
||||||
artwork_url: artwork || null,
|
artwork_url: artwork || null,
|
||||||
hires: t.hires ?? false,
|
hires: trk.hires ?? false,
|
||||||
bit_depth: t.bitDepth ?? null,
|
bit_depth: trk.bitDepth ?? null,
|
||||||
sample_rate: t.samplingRate ?? null,
|
sample_rate: trk.samplingRate ?? null,
|
||||||
is_local: false,
|
is_local: false,
|
||||||
album_id: selectedAlbum?.id,
|
album_id: selectedAlbum?.id,
|
||||||
artist_id: t.artistId ?? selectedAlbum?.artistId
|
artist_id: trk.artistId ?? selectedAlbum?.artistId
|
||||||
}));
|
}));
|
||||||
|
|
||||||
console.log('[Album Queue] Mapped to', queueTracks.length, 'queue tracks (filtered), startIndex:', trackIndex);
|
console.log('[Album Queue] Mapped to', queueTracks.length, 'queue tracks (filtered), startIndex:', trackIndex);
|
||||||
console.log('[Album Queue] Track IDs:', queueTracks.map(t => t.id));
|
console.log('[Album Queue] Track IDs:', queueTracks.map(trk => trk.id));
|
||||||
|
|
||||||
// Set the queue starting at the clicked track
|
// Set the queue starting at the clicked track
|
||||||
await setQueue(queueTracks, trackIndex >= 0 ? trackIndex : 0, true);
|
await setQueue(queueTracks, trackIndex >= 0 ? trackIndex : 0, true);
|
||||||
@@ -1544,7 +1544,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const allTracks = [queueState.current_track, ...queueState.upcoming].filter(Boolean) as BackendQueueTrack[];
|
const allTracks = [queueState.current_track, ...queueState.upcoming].filter(Boolean) as BackendQueueTrack[];
|
||||||
const trackIndex = allTracks.findIndex(t => String(t.id) === trackId);
|
const trackIndex = allTracks.findIndex(trk => String(trk.id) === trackId);
|
||||||
|
|
||||||
if (trackIndex >= 0) {
|
if (trackIndex >= 0) {
|
||||||
// If it's the current track (index 0), just ensure it's playing
|
// If it's the current track (index 0), just ensure it's playing
|
||||||
@@ -1640,7 +1640,7 @@
|
|||||||
|
|
||||||
// Find the track in history
|
// Find the track in history
|
||||||
const numericId = parseInt(trackId, 10);
|
const numericId = parseInt(trackId, 10);
|
||||||
const historyTrack = queueState.history.find(t => t.id === numericId);
|
const historyTrack = queueState.history.find(trk => trk.id === numericId);
|
||||||
if (!historyTrack) {
|
if (!historyTrack) {
|
||||||
showToast($t('toast.trackNotInHistory'), 'error');
|
showToast($t('toast.trackNotInHistory'), 'error');
|
||||||
return;
|
return;
|
||||||
@@ -1668,8 +1668,8 @@
|
|||||||
async function handlePlayAllAlbum() {
|
async function handlePlayAllAlbum() {
|
||||||
if (!selectedAlbum?.tracks?.length) return;
|
if (!selectedAlbum?.tracks?.length) return;
|
||||||
// Find first non-blacklisted track
|
// Find first non-blacklisted track
|
||||||
const firstPlayableTrack = selectedAlbum.tracks.find(t => {
|
const firstPlayableTrack = selectedAlbum.tracks.find(trk => {
|
||||||
const artistId = t.artistId ?? selectedAlbum.artistId;
|
const artistId = trk.artistId ?? selectedAlbum.artistId;
|
||||||
return !artistId || !isArtistBlacklisted(artistId);
|
return !artistId || !isArtistBlacklisted(artistId);
|
||||||
});
|
});
|
||||||
if (!firstPlayableTrack) return;
|
if (!firstPlayableTrack) return;
|
||||||
@@ -1681,8 +1681,8 @@
|
|||||||
if (!selectedAlbum?.tracks?.length) return;
|
if (!selectedAlbum?.tracks?.length) return;
|
||||||
|
|
||||||
// Filter out blacklisted tracks
|
// Filter out blacklisted tracks
|
||||||
const playableTracks = selectedAlbum.tracks.filter(t => {
|
const playableTracks = selectedAlbum.tracks.filter(trk => {
|
||||||
const artistId = t.artistId ?? selectedAlbum.artistId;
|
const artistId = trk.artistId ?? selectedAlbum.artistId;
|
||||||
return !artistId || !isArtistBlacklisted(artistId);
|
return !artistId || !isArtistBlacklisted(artistId);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1714,8 +1714,8 @@
|
|||||||
if (!selectedAlbum?.tracks?.length) return;
|
if (!selectedAlbum?.tracks?.length) return;
|
||||||
|
|
||||||
// Filter out blacklisted tracks
|
// Filter out blacklisted tracks
|
||||||
const playableTracks = selectedAlbum.tracks.filter(t => {
|
const playableTracks = selectedAlbum.tracks.filter(trk => {
|
||||||
const artistId = t.artistId ?? selectedAlbum.artistId;
|
const artistId = trk.artistId ?? selectedAlbum.artistId;
|
||||||
return !artistId || !isArtistBlacklisted(artistId);
|
return !artistId || !isArtistBlacklisted(artistId);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1724,20 +1724,20 @@
|
|||||||
const artwork = selectedAlbum.artwork || '';
|
const artwork = selectedAlbum.artwork || '';
|
||||||
// Add in reverse order so first track ends up right after current
|
// Add in reverse order so first track ends up right after current
|
||||||
for (let i = playableTracks.length - 1; i >= 0; i--) {
|
for (let i = playableTracks.length - 1; i >= 0; i--) {
|
||||||
const t = playableTracks[i];
|
const trk = playableTracks[i];
|
||||||
queueTrackNext({
|
queueTrackNext({
|
||||||
id: t.id,
|
id: trk.id,
|
||||||
title: t.title,
|
title: trk.title,
|
||||||
artist: t.artist || selectedAlbum?.artist || 'Unknown Artist',
|
artist: trk.artist || selectedAlbum?.artist || 'Unknown Artist',
|
||||||
album: selectedAlbum?.title || '',
|
album: selectedAlbum?.title || '',
|
||||||
duration_secs: t.durationSeconds,
|
duration_secs: trk.durationSeconds,
|
||||||
artwork_url: artwork || null,
|
artwork_url: artwork || null,
|
||||||
hires: t.hires ?? false,
|
hires: trk.hires ?? false,
|
||||||
bit_depth: t.bitDepth ?? null,
|
bit_depth: trk.bitDepth ?? null,
|
||||||
sample_rate: t.samplingRate ?? null,
|
sample_rate: trk.samplingRate ?? null,
|
||||||
is_local: false,
|
is_local: false,
|
||||||
album_id: selectedAlbum?.id,
|
album_id: selectedAlbum?.id,
|
||||||
artist_id: t.artistId ?? selectedAlbum?.artistId
|
artist_id: trk.artistId ?? selectedAlbum?.artistId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
showToast($t('toast.playingTracksNext', { values: { count: playableTracks.length } }), 'success');
|
showToast($t('toast.playingTracksNext', { values: { count: playableTracks.length } }), 'success');
|
||||||
@@ -1748,27 +1748,27 @@
|
|||||||
if (!selectedAlbum?.tracks?.length) return;
|
if (!selectedAlbum?.tracks?.length) return;
|
||||||
|
|
||||||
// Filter out blacklisted tracks
|
// Filter out blacklisted tracks
|
||||||
const playableTracks = selectedAlbum.tracks.filter(t => {
|
const playableTracks = selectedAlbum.tracks.filter(trk => {
|
||||||
const artistId = t.artistId ?? selectedAlbum.artistId;
|
const artistId = trk.artistId ?? selectedAlbum.artistId;
|
||||||
return !artistId || !isArtistBlacklisted(artistId);
|
return !artistId || !isArtistBlacklisted(artistId);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (playableTracks.length === 0) return;
|
if (playableTracks.length === 0) return;
|
||||||
|
|
||||||
const artwork = selectedAlbum.artwork || '';
|
const artwork = selectedAlbum.artwork || '';
|
||||||
const queueTracks: BackendQueueTrack[] = playableTracks.map(t => ({
|
const queueTracks: BackendQueueTrack[] = playableTracks.map(trk => ({
|
||||||
id: t.id,
|
id: trk.id,
|
||||||
title: t.title,
|
title: trk.title,
|
||||||
artist: t.artist || selectedAlbum?.artist || 'Unknown Artist',
|
artist: trk.artist || selectedAlbum?.artist || 'Unknown Artist',
|
||||||
album: selectedAlbum?.title || '',
|
album: selectedAlbum?.title || '',
|
||||||
duration_secs: t.durationSeconds,
|
duration_secs: trk.durationSeconds,
|
||||||
artwork_url: artwork || null,
|
artwork_url: artwork || null,
|
||||||
hires: t.hires ?? false,
|
hires: trk.hires ?? false,
|
||||||
bit_depth: t.bitDepth ?? null,
|
bit_depth: trk.bitDepth ?? null,
|
||||||
sample_rate: t.samplingRate ?? null,
|
sample_rate: trk.samplingRate ?? null,
|
||||||
is_local: false,
|
is_local: false,
|
||||||
album_id: selectedAlbum?.id,
|
album_id: selectedAlbum?.id,
|
||||||
artist_id: t.artistId ?? selectedAlbum?.artistId
|
artist_id: trk.artistId ?? selectedAlbum?.artistId
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const success = await addTracksToQueue(queueTracks);
|
const success = await addTracksToQueue(queueTracks);
|
||||||
@@ -1786,7 +1786,7 @@
|
|||||||
|
|
||||||
function addAlbumToPlaylist(album: AlbumDetail | null) {
|
function addAlbumToPlaylist(album: AlbumDetail | null) {
|
||||||
if (!album?.tracks?.length) return;
|
if (!album?.tracks?.length) return;
|
||||||
const trackIds = album.tracks.map(t => t.id);
|
const trackIds = album.tracks.map(trk => trk.id);
|
||||||
openAddToPlaylist(trackIds);
|
openAddToPlaylist(trackIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2258,19 +2258,19 @@
|
|||||||
console.log('[Session] Restoring previous session...');
|
console.log('[Session] Restoring previous session...');
|
||||||
|
|
||||||
// Restore queue
|
// Restore queue
|
||||||
const tracks: BackendQueueTrack[] = session.queue_tracks.map(t => ({
|
const tracks: BackendQueueTrack[] = session.queue_tracks.map(trk => ({
|
||||||
id: t.id,
|
id: trk.id,
|
||||||
title: t.title,
|
title: trk.title,
|
||||||
artist: t.artist,
|
artist: trk.artist,
|
||||||
album: t.album,
|
album: trk.album,
|
||||||
duration_secs: t.duration_secs,
|
duration_secs: trk.duration_secs,
|
||||||
artwork_url: t.artwork_url,
|
artwork_url: trk.artwork_url,
|
||||||
hires: t.hires ?? false,
|
hires: trk.hires ?? false,
|
||||||
bit_depth: t.bit_depth ?? null,
|
bit_depth: trk.bit_depth ?? null,
|
||||||
sample_rate: t.sample_rate ?? null,
|
sample_rate: trk.sample_rate ?? null,
|
||||||
is_local: t.is_local ?? false,
|
is_local: trk.is_local ?? false,
|
||||||
album_id: t.album_id ?? null,
|
album_id: trk.album_id ?? null,
|
||||||
artist_id: t.artist_id ?? null
|
artist_id: trk.artist_id ?? null
|
||||||
}));
|
}));
|
||||||
|
|
||||||
await setQueue(tracks, session.current_index ?? 0, true);
|
await setQueue(tracks, session.current_index ?? 0, true);
|
||||||
@@ -2942,13 +2942,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (state.history) {
|
if (state.history) {
|
||||||
historyTracks = state.history.map(t => ({
|
historyTracks = state.history.map(trk => ({
|
||||||
id: String(t.id),
|
id: String(trk.id),
|
||||||
artwork: t.artwork_url || '',
|
artwork: trk.artwork_url || '',
|
||||||
title: t.title,
|
title: trk.title,
|
||||||
artist: t.artist,
|
artist: trk.artist,
|
||||||
duration: formatDuration(t.duration_secs),
|
duration: formatDuration(trk.duration_secs),
|
||||||
trackId: t.id
|
trackId: trk.id
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3626,7 +3626,7 @@
|
|||||||
onTrackPlay={(trackCredits) => {
|
onTrackPlay={(trackCredits) => {
|
||||||
// Find the corresponding track in the selected album and play it
|
// Find the corresponding track in the selected album and play it
|
||||||
if (selectedAlbum?.tracks) {
|
if (selectedAlbum?.tracks) {
|
||||||
const track = selectedAlbum.tracks.find(t => t.id === trackCredits.id);
|
const track = selectedAlbum.tracks.find(trk => trk.id === trackCredits.id);
|
||||||
if (track) {
|
if (track) {
|
||||||
handleAlbumTrackPlay(track);
|
handleAlbumTrackPlay(track);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user