From 6bd5e6ec73ac2950b590dce4f706c1c2d61a7efb Mon Sep 17 00:00:00 2001 From: sigma67 Date: Sat, 5 Sep 2020 13:46:51 +0200 Subject: [PATCH] Preserve order while removing duplicate videoIds --- YouTube.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/YouTube.py b/YouTube.py index 396ac03..b9fde2a 100644 --- a/YouTube.py +++ b/YouTube.py @@ -4,6 +4,7 @@ import re import argparse import difflib +from collections import OrderedDict from SpotifyExport import Spotify import settings @@ -82,7 +83,7 @@ def search_songs(self, tracks): return videoIds def add_playlist_items(self, playlistId, videoIds): - videoIds = set(videoIds) + videoIds = OrderedDict.fromkeys(videoIds) self.api.add_playlist_items(playlistId, videoIds) def get_playlist_id(self, name):