def set_tag(self, tag, value): Tags.setValue(self.path, tag, value) query = 'UPDATE tracks SET ' + tag + ' = ? WHERE track_ID = ?' t = (value, self.ID) bdd.execute(query, t) self.tags[tag] = value messager.diffuser('track_data_changed', self, self)
def fromPath(path): try: track = bdd.getTracks({'path':path})[0] # This file exists in our database except IndexError: tags = Tags.fromPath(path) track = Track([0, path, tags['title'], tags['album'], tags['artist'], tags['length'], 0, 0]) return track
def get_track_data(fichier, extension): tags = Tags.fromPath(fichier) fichier = unicode(fichier) t = ( fichier, tags["title"], tags["album"], tags["artist"], tags["genre"], tags["length"], 0, 0, tags["year"], tags["performer"], ) # conn.execute('INSERT INTO tracks (path, title, album, artist, genre, length, note, compteur, year) VALUES (?,?,?,?,?, ?, ?, ?, ?)', t) return t
def get_tags(self): return Tags.fromPath(self.path)