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


Python NetEase.song_detail方法代码示例

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


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

示例1: test3

# 需要导入模块: from api import NetEase [as 别名]
# 或者: from api.NetEase import song_detail [as 别名]
def test3(request):
    ease = NetEase()
    s = ease.song_detail('22754251')
    p = simplejson.dumps(s)
    global getLists
    return HttpResponse(p)
开发者ID:Peterpig,项目名称:MusicServer,代码行数:8,代码来源:views.py

示例2: MainWidget

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

#.........这里部分代码省略.........
        1. 向sources列表中加入相应的 media source
        2. 更新当前播放列表(current_play_widget)
        :param music_model: music 的标准数据model
        """
        current_playing = self.ui.info_widget.current_playing_widget
        rowCount = current_playing.rowCount()
        current_playing.setRowCount(rowCount + 1)

        # 更新 current play widget
        musicItem = QTableWidgetItem(music_model['name'])
        albumItem = QTableWidgetItem(music_model['album']['name'])
        if len(music_model['artists']) > 0:
            artistName = music_model['artists'][0]['name']
        artistItem = QTableWidgetItem(artistName)
        # to get pure dict from qvariant, so pay attension !
        # stackoverflow: how to get the original python data from qvariant
        music = QVariant((music_model, ))
        musicItem.setData(Qt.UserRole, music)

        musicItem.setTextAlignment(Qt.AlignCenter)
        artistItem.setTextAlignment(Qt.AlignCenter)
        albumItem.setTextAlignment(Qt.AlignCenter)

        current_playing.setItem(rowCount, 0, musicItem)
        current_playing.setItem(rowCount, 1, artistItem)
        current_playing.setItem(rowCount, 2, albumItem)

    def play_search_music(self, item):
        music_search = self.ui.info_widget.music_search_widget
        current_row = music_search.row(item)
        item = music_search.item(current_row, 0)    # only item 0 contain url
        data = item.data(Qt.UserRole)
        song = data.toPyObject()[0]
        musics = self.net_ease.song_detail(song['id'])
        datamodel = self.model.music()
        music_model = self.model.set_datamodel_from_data(musics[0], datamodel)

        source = Phonon.MediaSource(music_model['mp3Url'])

        self.add_music_to_sources(source)
        self.add_music_to_currentplayinglist(music_model)
        self.play_specific_music(source)

    def play_userplaylist_music(self, item):
        music_table = self.ui.info_widget.music_table_widget
        current_row = music_table.row(item)
        data = item.data(Qt.UserRole)
        music_model = data.toPyObject()[0]

        source = Phonon.MediaSource(music_model['mp3Url'])
        self.add_music_to_sources(source)

        self.add_music_to_currentplayinglist(music_model)
        self.play_specific_music(source)

    def tick(self, time):
        time_lcd = self.ui.play_widget.time_lcd
        displayTime = QTime(0, (time / 60000) % 60, (time / 1000) % 60)
        time_lcd.setText(displayTime.toString('mm:ss'))

    def state_changed(self, new_state, old_state):
        time_lcd = self.ui.play_widget.time_lcd
        play_pause_btn = self.ui.play_widget.play_pause_btn
        if new_state == Phonon.ErrorState:
            if self.player.errorType() == Phonon.FatalError:
                QMessageBox.warning(self, "Fatal Error",
开发者ID:alexmao86,项目名称:NetEaseMusic,代码行数:70,代码来源:controllers.py


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