当前位置: 首页>>代码示例>>Python>>正文


Python Song.dbid方法代码示例

本文整理汇总了Python中song.Song.dbid方法的典型用法代码示例。如果您正苦于以下问题:Python Song.dbid方法的具体用法?Python Song.dbid怎么用?Python Song.dbid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在song.Song的用法示例。


在下文中一共展示了Song.dbid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_songs

# 需要导入模块: from song import Song [as 别名]
# 或者: from song.Song import dbid [as 别名]
    def get_songs(self):
        cursor = self.db.cursor()
        sql = '''\
select id, uid, title, artist, url, img_url, played_count, created_at, description, duration FROM SONGS
'''
        cursor.execute(sql)
        ret = []

        while True:
            data = cursor.fetchone()
            if data:
                song = Song()

                song.dbid = data[0]
                song.uid = data[1]
                song.title = data[2]
                song.artist = data[3]
                song.url = data[4]
                song.img_url = data[5]
                song.played_count = data[6]
                song.created_at = data[7]
                song.description = data[8]
                song.duration = data[9]
                
                yield song
            else:
                break
开发者ID:mycat83,项目名称:book_python_example,代码行数:29,代码来源:store.py

示例2: find_songs_by_title

# 需要导入模块: from song import Song [as 别名]
# 或者: from song.Song import dbid [as 别名]
    def find_songs_by_title(self, title):
        "노래 제목으로 곡을 찾는다."

        cursor = self.db.cursor()
        sql = '''\
select id, uid, title, artist, url, img_url, played_count, created_at, description, duration FROM SONGS where title like ?
'''
        cursor.execute(sql, (title, ))
        ret = []

        for data in cursor.fetchmany(5):
            if data:
                song = Song()

                song.dbid = data[0]
                song.uid = data[1]
                song.title = data[2]
                song.artist = data[3]
                song.url = data[4]
                song.img_url = data[5]
                song.played_count = data[6]
                song.created_at = data[7]
                song.description = data[8]
                song.duration = data[9]

                ret.append(song)
        
        return ret
开发者ID:mycat83,项目名称:book_python_example,代码行数:30,代码来源:store.py

示例3: find_by_id

# 需要导入模块: from song import Song [as 别名]
# 或者: from song.Song import dbid [as 别名]
    def find_by_id(self, dbid):
        "UID로 노래를 찾는다."
        cursor = self.db.cursor()
        sql = '''\
select id, uid, title, artist, url, img_url, played_count, created_at, description, duration FROM SONGS where id = ?
'''
        cursor.execute(sql, (dbid, ))
        data = cursor.fetchone()
        if data:
            song = Song()

            song.dbid = data[0]
            song.uid = data[1]
            song.title = data[2]
            song.artist = data[3]
            song.url = data[4]
            song.img_url = data[5]
            song.played_count = data[6]
            song.created_at = data[7]
            song.description = data[8]
            song.duration = data[9]
            
        return song
开发者ID:mycat83,项目名称:book_python_example,代码行数:25,代码来源:store.py


注:本文中的song.Song.dbid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。