Server playlists: M3U export now downloads the .m3u to the browser too (was only saving server-side) — matches the other Export-as-M3U buttons

This commit is contained in:
BoulderBadgeDad 2026-06-13 08:35:02 -07:00
parent 5a16d8ad53
commit 608efb1d85

View file

@ -1688,6 +1688,18 @@ async function exportServerPlaylistM3U() {
if (!res.ok || data.success === false) {
throw new Error(data.error || 'Export failed');
}
// Download the .m3u to the browser (same as the other Export-as-M3U
// buttons) — force=true also saved it server-side for media servers.
const name = (st.playlistName || 'Playlist').replace(/[/\\?%*:|"<>]/g, '-');
const blob = new Blob([data.m3u_content || ''], { type: 'audio/x-mpegurl;charset=utf-8' });
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = `${name}.m3u`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(url);
// `found` = server tracks resolved to a real library file path; any not in
// SoulSync's library are skipped (can't write a path for them).
const found = data.stats && data.stats.found != null ? data.stats.found : tracks.length;