diff --git a/public/music.js b/public/music.js
index a3dc6cc..1701055 100644
--- a/public/music.js
+++ b/public/music.js
@@ -173,7 +173,7 @@ async function musicRoute([kind = 'featured', key, key2], st) {
v.innerHTML = `
${info.summary ? `
About
${esc(info.summary).replace(/\n/g, '
')}
` : ''}
-
${album ? '' : ''}${album && allowed('chat') ? `` : ''}${album && allowed('chat') ? `` : ''}${mine ? '' : ''}
+
${album ? '' : ''}${album && allowed('chat') ? `` : ''}${album && allowed('chat') ? `` : ''}${mine ? '' : ''}
${tracks.map((t, i) => `
`).join('') || '
No playable tracks
'}
`;
@@ -182,6 +182,15 @@ async function musicRoute([kind = 'featured', key, key2], st) {
v.querySelectorAll('button[data-m]').forEach(b => b.onclick = () => { const t = tracks[+b.dataset.m]; trackSheet(t, mine && t.pid ? [{ label: 'Remove from this playlist', icon: 'trash', danger: true, run: async () => { try { await plx.remove(key, t.pid); toast('Removed'); route(); } catch (e) { toast(e.message); } } }] : []); });
if (mine) {
$('#prn').onclick = () => textSheet('Rename playlist', 'Playlist name', 'Rename', async n => { try { await plx.rename(key, n); route(); } catch (e) { toast(e.message); } }, title);
+ $('#pmv').onclick = () => tracks.length ? textSheet('Move to NE Hub', 'Name of the Family playlist', 'Move', async n => {
+ try {
+ const meta = tracks.map(mmMeta).filter(t => mmPlex(t.key)); if (!meta.length) return toast('No songs here can be moved');
+ const r = await mmApi('/family', mmOpt('POST', { name: n, tracks: meta.slice(0, 500) }));
+ for (let i = 500; i < meta.length; i += 500) await mmApi(`/family/${r.id}/add`, mmOpt('POST', { tracks: meta.slice(i, i + 500) }));
+ toast('Moved ' + meta.length + ' songs to NE Hub');
+ confirmSheet('Remove it from Plex too?', '“' + title + '” is now a Family playlist. Cancel keeps the Plex one.', 'Remove from Plex', async () => { try { await plx.del(key); } catch (e) { toast(e.message); } location.hash = '#/music/family/' + r.id; });
+ } catch (e) { toast(e.message); }
+ }, title) : toast('This playlist has no songs');
$('#pdel').onclick = () => confirmSheet('Delete playlist?', title, 'Delete', async () => { try { await plx.del(key); toast('Playlist deleted'); location.hash = '#/music/playlists'; } catch (e) { toast(e.message); } });
}
if ($('#psh')) $('#psh').onclick = () => shareMedia({ kind: 'album', title, sub, art: px.art(thumb, 200), link: '#/music/album/' + key });