Basic playlist deduplication
Before adding songs to the playlist, check if the playlist already contains the song id.
This commit is contained in:
parent
a43bad029c
commit
b000bbf808
|
@ -101,6 +101,9 @@ class Collection:
|
|||
return None
|
||||
return res[0]
|
||||
|
||||
def has_id(self, id):
|
||||
return id in self.index
|
||||
|
||||
def get_attr(self, id, attr):
|
||||
rec = self.records[id]
|
||||
if attr == "filepath":
|
||||
|
@ -124,6 +127,8 @@ class Collection:
|
|||
return tags[2]
|
||||
|
||||
def insert_tags(self, artist, album, title, id):
|
||||
if self.has_id(id) == True:
|
||||
return
|
||||
tags = self.tag_tree.insert([artist, album, title, id])
|
||||
self.index.insert([artist, album, title], id)
|
||||
self.size += 1
|
||||
|
|
Loading…
Reference in New Issue