mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-10 07:58:39 -05:00
Fix: Add UserId parameter for Jellyfin playlist operations + UI improvements
- CRITICAL FIX: Add UserId parameter to all Jellyfin playlist item fetches (fixes 400 BadRequest errors) - Fix GetPlaylists to correctly count local/missing tracks - Fix GetSpotifyPlaylistTracksOrderedAsync to find local tracks (was serving external tracks for everything) - Fix SpotifyTrackMatchingService to skip tracks already in Jellyfin - Add detailed debug logging for track matching (LOCAL by ISRC/Spotify ID, EXTERNAL match, NO MATCH) - Add 'Match Tracks' button for individual playlists (not all playlists) - Add 'Match All Tracks' button for matching all playlists at once - Add JELLYFIN_USER_ID to web UI configuration tab for easy setup - Add /api/admin/playlists/match-all endpoint This fixes the issue where local tracks weren't being used - the system was downloading from SquidWTF even when files existed locally in Jellyfin.
This commit is contained in:
@@ -646,6 +646,7 @@
|
||||
<h2>
|
||||
Active Spotify Playlists
|
||||
<div class="actions">
|
||||
<button onclick="matchAllPlaylists()">Match All Tracks</button>
|
||||
<button onclick="refreshPlaylists()">Refresh All</button>
|
||||
</div>
|
||||
</h2>
|
||||
@@ -665,7 +666,7 @@
|
||||
</thead>
|
||||
<tbody id="playlist-table-body">
|
||||
<tr>
|
||||
<td colspan="7" class="loading">
|
||||
<td colspan="6" class="loading">
|
||||
<span class="spinner"></span> Loading playlists...
|
||||
</td>
|
||||
</tr>
|
||||
@@ -762,6 +763,11 @@
|
||||
<span class="value" id="config-jellyfin-api-key">-</span>
|
||||
<button onclick="openEditSetting('JELLYFIN_API_KEY', 'Jellyfin API Key', 'password')">Update</button>
|
||||
</div>
|
||||
<div class="config-item">
|
||||
<span class="label">User ID</span>
|
||||
<span class="value" id="config-jellyfin-user-id">-</span>
|
||||
<button onclick="openEditSetting('JELLYFIN_USER_ID', 'Jellyfin User ID', 'text', 'Required for playlist operations. Get from Jellyfin user profile URL: userId=...')">Edit</button>
|
||||
</div>
|
||||
<div class="config-item">
|
||||
<span class="label">Library ID</span>
|
||||
<span class="value" id="config-jellyfin-library-id">-</span>
|
||||
@@ -1126,6 +1132,7 @@
|
||||
// Jellyfin settings
|
||||
document.getElementById('config-jellyfin-url').textContent = data.jellyfin.url || '-';
|
||||
document.getElementById('config-jellyfin-api-key').textContent = data.jellyfin.apiKey;
|
||||
document.getElementById('config-jellyfin-user-id').textContent = data.jellyfin.userId || '(not set)';
|
||||
document.getElementById('config-jellyfin-library-id').textContent = data.jellyfin.libraryId || '-';
|
||||
|
||||
// Sync settings
|
||||
@@ -1347,6 +1354,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function matchAllPlaylists() {
|
||||
try {
|
||||
showToast('Matching tracks for all playlists...', 'success');
|
||||
const res = await fetch('/api/admin/playlists/match-all', { method: 'POST' });
|
||||
const data = await res.json();
|
||||
|
||||
if (res.ok) {
|
||||
showToast(data.message, 'success');
|
||||
} else {
|
||||
showToast(data.error || 'Failed to match tracks', 'error');
|
||||
}
|
||||
} catch (error) {
|
||||
showToast('Failed to match tracks', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
async function clearCache() {
|
||||
if (!confirm('Clear all cached playlist data?')) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user