songs.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:optimalvibes 作者: littlemika 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号