本文整理汇总了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)
示例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
示例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)
示例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:
#.........这里部分代码省略.........