server: 😜 fix remove dups

This commit is contained in:
geoffrey45
2021-12-29 22:49:58 +03:00
parent 6dbf8efb90
commit c8d1f5f012
3 changed files with 18 additions and 4 deletions
+11 -2
View File
@@ -94,13 +94,13 @@ def getTags(full_path):
try:
audio = FLAC(full_path)
except:
return
return
elif full_path.endswith('.mp3'):
try:
audio = MP3(full_path)
except:
return
try:
artists = audio['artist'][0]
except KeyError:
@@ -202,6 +202,15 @@ def get_folders():
def remove_duplicates(array):
song_num = 0
while song_num < len(array):
for index, song in enumerate(array):
if array[song_num]["title"] == song["title"] and array[song_num]["album"] == song["album"] and array[song_num]["artists"] == song["artists"] and index != song_num:
array.remove(song)
song_num += 1
return array