def addSong(self, fid, filename, pid=None,artist=None, name=None):
if pid == '':
pid = 'None'
# query = 'INSERT INTO `tracks` (`id`,`filename`,`playlistID`) VALUES ("{}","{}","{}");'.format(fid, filename, pid)
#
self.CURSOR.execute("""INSERT INTO tracks (id,filename,playlistID,artist,name) VALUES(%s,%s,%s,%s,%s)""", (fid,filename,pid,artist,name))
self.db_conn.commit()
result = self.CURSOR.fetchone()
print("Adding new track to tracks table...")
#print(query)
print(result)
#self.CURSOR.close()
return 1
# db = MySQLDatabase('jonhydb', user='john',passwd='megajonhy')
# class Book(peewee.Model):
# author = peewee.CharField()
# title = peewee.TextField()
# class Meta:
# database = db
# Book.create_table()
# book = Book(author="me", title='Peewee is cool')
# book.save()
# for book in Book.filter(author="me"):
# print book.title
评论列表
文章目录