Playlist files: export with metadata and YouTube links (all or one playlist), import v1/v2 with duplicate handling, and ask the server to download the imported videos
This commit is contained in:
@@ -143,6 +143,8 @@ function setListPaneHidden(hidden) {
|
||||
|
||||
const LIST_ICONS = {
|
||||
rename: '<path d="M4 20h4L19 9l-4-4L4 16v4zM14 6l4 4"/>',
|
||||
exportFile: '<path d="M14 3H6v18h12V7z"/><path d="M14 3v4h4M12 11v6m-3-3 3 3 3-3"/>',
|
||||
server: '<rect x="4" y="4" width="16" height="6" rx="1.5"/><rect x="4" y="14" width="16" height="6" rx="1.5"/><path d="M8 7h.01M8 17h.01"/>',
|
||||
share: '<path d="M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1"/><path d="M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1"/>',
|
||||
offline: '<use href="#media-download"/>',
|
||||
offlineDone: '<use href="#media-offline"/>',
|
||||
@@ -312,6 +314,8 @@ function renderList() {
|
||||
els.listTitle.onkeydown = (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); renamePlaylist(pl); } };
|
||||
const titleIcons = [listIconBtn('rename', 'Rename playlist', () => renamePlaylist(pl))];
|
||||
if (pl.videos && pl.videos.length >= 1) titleIcons.push(listIconBtn('share', 'Share playlist', () => sharePlaylist(pl)));
|
||||
if (pl.videos && pl.videos.length >= 1) titleIcons.push(listIconBtn('exportFile', 'Export playlist file (titles and YouTube links)', () => exportPlaylists(pl.id)));
|
||||
if (WEB && pl.videos && pl.videos.some((v) => /^[A-Za-z0-9_-]{11}$/.test(v.id))) titleIcons.push(listIconBtn('server', 'Download this playlist on the server', () => offerServerDownload(pl.videos.map((v) => v.id).filter((id) => /^[A-Za-z0-9_-]{11}$/.test(id)))));
|
||||
$('listTitleActions').append(...titleIcons);
|
||||
|
||||
// Filter row icons: offline + pin show their state by colour alone.
|
||||
@@ -1437,7 +1441,7 @@ async function renderSettings() {
|
||||
|
||||
// ---- Export / Import playlists ----
|
||||
$('importYtBtn')?.addEventListener('click', openImportYouTubeModal);
|
||||
$('exportBtn').addEventListener('click', exportPlaylists);
|
||||
$('exportBtn').addEventListener('click', () => exportPlaylists());
|
||||
$('importBtn').addEventListener('click', () => $('fileInput').click());
|
||||
$('fileInput').addEventListener('change', importPlaylists);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user