Basic playlist deduplication

Before adding songs to the playlist, check if the playlist already
contains the song id.
This commit is contained in:
Bryan Schumaker 2010-10-28 08:30:46 -04:00
parent a43bad029c
commit b000bbf808
1 changed files with 5 additions and 0 deletions

View File

@ -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