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


Python NetEase.recommend_playlist方法代码示例

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


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

示例1: __init__

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

#.........这里部分代码省略.........
                    'datatype': 'top_playlists',
                    'callback': netease.top_playlists
                },
                {
                    'title': '分类精选',
                    'datatype': 'playlist_classes',
                    'callback': netease.playlist_classes
                }
            ]
            self.title += ' > 精选歌单'
            self.datatype = 'playlists'

        # 我的歌单
        elif idx == 4:
            # 未登录
            if self.userid is None:
                if self.storage.database['user']['user_id'] == "":
                    # 使用本地存储了账户登录
                    if self.storage.database['user']['username'] != "":
                        user_info = 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']
            # 读取登录之后的用户歌单
            self.username = self.storage.database['user']['nickname']
            myplaylist = netease.user_playlist(self.userid)
            self.datatype = 'top_playlists'
            self.datalist = netease.dig_info(myplaylist, self.datatype)
            self.title += ' > ' + self.username + ' 的歌单'

        # DJ节目
        elif idx == 5:
            self.datatype = 'djchannels'
            self.title += ' > DJ节目'
            self.datalist = netease.djchannels()

        # 每日推荐
        elif idx == 6:
            self.datatype = 'songs'
            self.title += ' > 每日推荐'
            if self.userid is None:
                if self.storage.database['user']['user_id'] == "":
                    # 使用本地存储了账户登录
                    if self.storage.database['user']['username'] != "":
                        user_info = 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 = self.netease.recommend_playlist()
            self.datalist = self.netease.dig_info(myplaylist, self.datatype)

        # 私人FM
        elif idx == 7:
            self.datatype = 'fmsongs'
            self.title += ' > 私人FM'
            self.datalist = self.get_new_fm()

        # 搜索
        elif idx == 8:
            self.datatype = 'search'
            self.title += ' > 搜索'
            self.datalist = ['歌曲', '艺术家', '专辑', '网易精选集']

        # 帮助
        elif idx == 9:
            self.datatype = 'help'
            self.title += ' > 帮助'
            self.datalist = shortcut

        self.offset = 0
        self.index = 0
开发者ID:Ghayn,项目名称:musicbox,代码行数:104,代码来源:menu.py


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