From e0e3f6ac3e605070a60bc512ad6971402f8c5b5f Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 22 Jul 2022 10:47:10 +0200 Subject: [PATCH] up2k-hook-ytid: add override --- contrib/plugins/up2k-hook-ytid.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/contrib/plugins/up2k-hook-ytid.js b/contrib/plugins/up2k-hook-ytid.js index 86255534..23b60d1b 100644 --- a/contrib/plugins/up2k-hook-ytid.js +++ b/contrib/plugins/up2k-hook-ytid.js @@ -55,13 +55,25 @@ function up2k_namefilter(good_files, nil_files, bad_files, hooks) { nothing_to_do = false; } - if (nothing_to_do) - return modal.alert('Good news -- turns out we already have all those videos.\n\nBut thank you for checking in!'); - else if (n_skip) - toast.inf(0, `skipped ${n_skip} files which already exist on the server`); + function upload_filtered() { + if (nothing_to_do) + return modal.alert('Good news -- turns out we already have all those.\n\nBut thank you for checking in!'); + + [good_files, nil_files, bad_files] = new_lists; + hooks[0](good_files, nil_files, bad_files, hooks.slice(1)); + } + + function upload_all() { + hooks[0](good_files, nil_files, bad_files, hooks.slice(1)); + } + + var msg = `you added ${good_files.length} files; ${n_skip} of them were skipped --\neither because we already have them,\nor because there is no youtube-ID in your filename.\n\nOK / Enter = continue uploading the ${new_lists[0].length} files we definitely need\n\nCancel / ESC = override the filter; upload ALL the files you added`; + + if (!n_skip) + upload_filtered(); + else + modal.confirm(msg, upload_filtered, upload_all); - [good_files, nil_files, bad_files] = new_lists; - hooks[0](good_files, nil_files, bad_files, hooks.slice(1)); }; xhr.send(Array.from(yt_ids).join('\n')); }