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


Python NetEase.playlist_detail方法代码示例

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


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

示例1: getPlayListDetail

# 需要导入模块: from api import NetEase [as 别名]
# 或者: from api.NetEase import playlist_detail [as 别名]
def getPlayListDetail(request):
    sendJsonAll = []
    global getSongIDs
    getSongIDs = []
    getSongTimes = []
    getSongNames = []
    getSongMp3Url = []
    getId = simplejson.loads(request.body)
    print(getId)
    id = getId["id"]
    ease = NetEase()
    s = ease.playlist_detail(id)
    jsonData = simplejson.dumps(s)
    parjson = simplejson.loads(jsonData)

    print(parjson)

    for getKeys in parjson:
        global getSongIDs
        getSongIDs.append(getKeys["id"])

        getSongNames.append(getKeys["name"])
        getSongTimes.append(getKeys["duration"])
        getSongMp3Url.append(getKeys["mp3Url"])

    sendJsonAll.append(getSongIDs)
    sendJsonAll.append(getSongNames)
    sendJsonAll.append(getSongTimes)
    sendJsonAll.append(getSongMp3Url)
    global getSongIDs
    sendJsonData = simplejson.dumps(sendJsonAll)
    print(sendJsonData)
    return HttpResponse(sendJsonData)
开发者ID:Peterpig,项目名称:MusicServer,代码行数:35,代码来源:views.py

示例2: User

# 需要导入模块: from api import NetEase [as 别名]
# 或者: from api.NetEase import playlist_detail [as 别名]
class User(object):
    def __init__(self):
        self.netease = NetEase()
        self.is_login = False
        self.uid = str()    # ''

    def login(self, username, password):
        data = self.netease.login(username, password)
        code = data['code']
        if code is 200:
            self.uid = data['profile']['userId']
            self.is_login = True
            return True
        else:   # 501
            return False

    def get_favorite_playlist_id(self):
        """
        login required
        success: return playlist id
        fail: return empty string ''
        """
        if self.is_login:
            playlist = self.netease.user_playlist(self.uid)
            for each in playlist:
                if each['specialType'] is 5:    # favorite playlist
                    return each['id']   # the favorite playlist id
            return ''
        return ''

    def get_music_title_and_url(self, pid):
        """
        :param pid: playlist id
        :return re: return list re
        """
        playlist = self.netease.playlist_detail(pid)
        re = list()
        if playlist is not []:
            for music in playlist:
                tmp = dict()
                tmp['title'] = music['name']
                tmp['url'] = music['mp3Url']
                re.append(tmp)
        return re
开发者ID:wangqin4377,项目名称:NetEaseMusic,代码行数:46,代码来源:higherapi.py

示例3: test4

# 需要导入模块: from api import NetEase [as 别名]
# 或者: from api.NetEase import playlist_detail [as 别名]
def test4(request):
    ease = NetEase()
    s = ease.playlist_detail("104596111")
    jsonData = simplejson.dumps(s)
    return HttpResponse(jsonData)
开发者ID:Peterpig,项目名称:MusicServer,代码行数:7,代码来源:views.py

示例4: MainWidget

# 需要导入模块: from api import NetEase [as 别名]
# 或者: from api.NetEase import playlist_detail [as 别名]
class MainWidget(QWidget):
    def __init__(self, parent=None):
        super(MainWidget, self).__init__(parent)
        # set app name before mediaObject was created to avoid phonon problem
        QCoreApplication.setApplicationName("NetEaseMusic-ThirdParty")
        self.ui = UiMainWidget()
        self.ui.setup_ui(self)

        self.signal_mapper = QSignalMapper(self)
        self.player = Phonon.createPlayer(Phonon.MusicCategory)
        self.net_manager = QNetworkAccessManager()
        self.searchShortcut = QShortcut(QKeySequence("Ctrl+F"), self)
        self.sources = []
        self.net_ease = NetEase()
        self.model = DataModel()

        self.set_self_prop()
        self.set_signal_binding()
        self.init_table_widget()

    def init_table_widget(self):
        self.ui.info_widget.music_table_widget.close()
        self.ui.info_widget.music_search_widget.close()
        self.ui.info_widget.current_playing_widget.close()

    def set_self_prop(self):
        self.setWindowTitle('NetEaseMusic For Linux')
        self.setObjectName('main_widget')
        self.resize(960, 580)
        self.setWindowIcon(QIcon('icons/format.ico'))

    def paintEvent(self, QPaintEvent):
        """
        self is derived from QWidget, Stylesheets don't work unless \
        paintEvent is reimplemented.
        at the same time, if self is derived from QFrame, this isn't needed.
        """
        option = QStyleOption()
        option.init(self)
        painter = QPainter(self)
        style = self.style()
        style.drawPrimitive(QStyle.PE_Widget, option, painter, self)

    def set_signal_binding(self):
        self.searchShortcut.activated.connect(self.set_search_focus)
        self.ui.info_widget.music_table_widget.itemDoubleClicked.connect(
            self.play_userplaylist_music)
        self.ui.info_widget.music_search_widget.itemDoubleClicked.connect(
            self.play_search_music)
        self.ui.info_widget.current_playing_widget.itemDoubleClicked.connect(
            self.play_currentplayinglist_music)
        self.ui.user_widget.list_widget.itemDoubleClicked.connect(
            self.play_userlist)
        self.ui.user_widget.list_widget.itemClicked.connect(
            self.set_tablewidget_userplaylist)
        self.player.setTickInterval(1000)
        self.player.tick.connect(self.tick)
        self.player.stateChanged.connect(self.state_changed)
        self.player.currentSourceChanged.connect(self.source_changed)
        self.player.aboutToFinish.connect(self.about_to_finish)
        self.ui.play_widget.play_pause_btn.clicked.connect(self.play_pause)
        self.ui.play_widget.last_music_btn.clicked.connect(
            self.last_music)
        self.ui.play_widget.next_music_btn.clicked.connect(
            self.next_music)
        self.ui.play_widget.seek_slider.setMediaObject(self.player)
        self.ui.play_widget.login_btn.clicked.connect(self.show_login_widget)
        self.ui.play_widget.search_btn.clicked.connect(self.search)
        self.ui.play_widget.search_edit.returnPressed.connect(self.search)
        self.ui.play_widget.show_current_list.clicked.connect(self.set_tablewidget_currentplayinglist)
        self.ui.play_widget.help_btn.clicked.connect(self.show_help_info)
        self.net_manager.finished.connect(self.albumimg_load_finish)

    def show_help_info(self):
        print 'show help info'
        with open('data/help.html') as f:
            text = f.read()
            text = text.decode('utf8')
            message = QMessageBox(self)
            message.setText(text)
            message.setTextFormat(Qt.RichText)
            message.show()
        pass

    def play_userlist(self, item):
        userplaylist_widget = self.ui.user_widget.list_widget
        data = item.data(Qt.UserRole)
        playlist = data.toPyObject()[0]
        pid = playlist['id']
        res = self.net_ease.playlist_detail(pid)
        # table_widget.clear()
        if res is not []:
            current_playing = self.ui.info_widget.current_playing_widget

            # 清空当前播放列表
            self.sources = []
            current_playing.setRowCount(0)

            # 把歌曲全部加入列表
            for music in res:
#.........这里部分代码省略.........
开发者ID:alexmao86,项目名称:NetEaseMusic,代码行数:103,代码来源:controllers.py


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