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


Python NetEase.personal_fm方法代码示例

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


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

示例1: __init__

# 需要导入模块: from api import NetEase [as 别名]
# 或者: from api.NetEase import personal_fm [as 别名]

#.........这里部分代码省略.........
            self.datatype = self.storage.database['player_info']['player_list_type']
            self.title = self.storage.database['player_info']['player_list_title']
            self.datalist = []
            for i in self.storage.database['player_info']['player_list']:
                self.datalist.append(self.storage.database['songs'][i])
            self.index = self.storage.database['player_info']['idx']
            self.offset = self.storage.database['player_info']['idx'] / self.step * self.step

    def get_new_fm(self):
        if self.userid is None:
            if self.storage.database['user']['user_id'] == "":
                # 使用本地存储了账户登录
                if self.storage.database['user']['username'] != "":
                    user_info = self.netease.login(self.storage.database['user']['username'],
                                              self.storage.database['user']['password'])
                # 本地没有存储账户,或本地账户失效,则引导录入
                if self.storage.database['user']['username'] == "" or user_info['code'] != 200:
                    data = self.ui.build_login()
                    # 取消登录
                    if data == -1:
                        return
                    user_info = data[0]
                    self.storage.database['user']['username'] = data[1][0]
                    self.storage.database['user']['password'] = data[1][1]
                    self.storage.database['user']['user_id'] = user_info['account']['id']
                    self.storage.database['user']['nickname'] = user_info['profile']['nickname']

                self.username = user_info['profile']['nickname']
                self.userid = user_info['account']['id']
            else:
                self.userid = self.storage.database['user']['user_id']
        myplaylist = []
        for count in range(0, 1):
            myplaylist += self.netease.personal_fm()
            time.sleep(0.2)
        return self.netease.dig_info(myplaylist, "fmsongs")

    def choice_channel(self, idx):
        # 排行榜
        netease = self.netease
        if idx == 0:
            self.datalist = netease.return_toplists()
            self.title += ' > 排行榜'
            self.datatype = 'toplists'

        # 艺术家
        elif idx == 1:
            artists = netease.top_artists()
            self.datalist = netease.dig_info(artists, 'artists')
            self.title += ' > 艺术家'
            self.datatype = 'artists'

        # 新碟上架
        elif idx == 2:
            albums = netease.new_albums()
            self.datalist = netease.dig_info(albums, 'albums')
            self.title += ' > 新碟上架'
            self.datatype = 'albums'

        # 精选歌单
        elif idx == 3:
            self.datalist = [
                {
                    'title': '全站置顶',
                    'datatype': 'top_playlists',
                    'callback': netease.top_playlists
开发者ID:Ghayn,项目名称:musicbox,代码行数:70,代码来源:menu.py


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