From ad511fb9bf81568c7e95519057c10fbb36ee12d5 Mon Sep 17 00:00:00 2001 From: Angelo Verlain Date: Sat, 16 Sep 2023 23:25:35 +0200 Subject: [PATCH] apply dedupe options on playlists --- mixins/playlist.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/mixins/playlist.ts b/mixins/playlist.ts index 1215092..6d29a9c 100644 --- a/mixins/playlist.ts +++ b/mixins/playlist.ts @@ -362,6 +362,14 @@ export async function edit_playlist( const actions: ({ action: string } & Record)[] = []; + const dedupeOption = dedupe === "check" + ? "DEDUPE_OPTION_CHECK" + : dedupe === "drop_duplicate" + ? "DEDUPE_OPTION_DROP_DUPLICATE" + : dedupe === "skip" + ? "DEDUPE_OPTION_SKIP" + : null; + if (title) { actions.push({ action: "ACTION_SET_PLAYLIST_NAME", @@ -398,13 +406,7 @@ export async function edit_playlist( actions.push({ action: "ACTION_ADD_VIDEO", addedVideoId: video_id, - dedupeOption: dedupe === "check" - ? "DEDUPE_OPTION_CHECK" - : dedupe === "drop_duplicate" - ? "DEDUPE_OPTION_DROP_DUPLICATE" - : dedupe === "skip" - ? "DEDUPE_OPTION_SKIP" - : null, + dedupeOption, }); }); } @@ -432,12 +434,15 @@ export async function edit_playlist( actions.push({ action: "ACTION_ADD_PLAYLIST", addedFullListId: playlist_id, + dedupeOption, }); }); } data.actions = actions; + console.log("data", data); + const json = await request_json("browse/edit_playlist", { data, signal }); const result: EditPlaylistResult = {