Skip to content

Commit

Permalink
apply dedupe options on playlists
Browse files Browse the repository at this point in the history
  • Loading branch information
vixalien committed Sep 16, 2023
1 parent 34a93f9 commit ad511fb
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions mixins/playlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,14 @@ export async function edit_playlist(

const actions: ({ action: string } & Record<string, any>)[] = [];

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",
Expand Down Expand Up @@ -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,
});
});
}
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit ad511fb

Please sign in to comment.