def playList(fmid, t): playlist = xbmc.PlayList(0) playlist.clear() for song in kugou.getSongs(fmid,t): listitem=xbmcgui.ListItem(song['name']) listitem.setInfo(type="Music",infoLabels={ "Title": song['name']}) playlist.add(kugou.getSongInfo(song['hash']), listitem) xbmc.Player().play(playlist)
def playList(fmid, t): playlist = xbmc.PlayList(0) playlist.clear() for song in kugou.getSongs(fmid, t): listitem = xbmcgui.ListItem(song['name']) listitem.setInfo(type="Music", infoLabels={"Title": song['name']}) playlist.add(kugou.getSongInfo(song['hash']), listitem) xbmc.Player().play(playlist)
def getPlayList(fmid, icon): title = '播放当前专辑所有歌曲' listitemAll = xbmcgui.ListItem(title, iconImage = icon) listitemAll.setInfo(type="Music",infoLabels={ "Title":title}) t = int(time.time()) query = {'act':'playList', 'fmid': fmid, 'time': t} listUrl = '%s?%s'%(plugin_url,urllib.urlencode(query)) xbmcplugin.addDirectoryItem(handle, listUrl, listitemAll, False) songs = kugou.getSongs(fmid, t) #判断songs是否存在 if songs: for song in songs: listitem=xbmcgui.ListItem(song['name']) listitem.setInfo(type="Music",infoLabels={ "Title": song['name'],}) url = plugin_url+"?act=play&title="+song['name'].encode('utf-8')+"&hash="+urllib.quote_plus(song['hash'].encode('utf-8')) xbmcplugin.addDirectoryItem(handle, url, listitem, False) xbmcplugin.endOfDirectory(handle)
def getPlayList(fmid, icon): title = '播放当前专辑所有歌曲' listitemAll = xbmcgui.ListItem(title, iconImage=icon) listitemAll.setInfo(type="Music", infoLabels={"Title": title}) t = int(time.time()) query = {'act': 'playList', 'fmid': fmid, 'time': t} listUrl = '%s?%s' % (plugin_url, urllib.parse.urlencode(query)) xbmcplugin.addDirectoryItem(handle, listUrl, listitemAll, False) songs = kugou.getSongs(fmid, t) #判断songs是否存在 if songs: for song in songs: listitem = xbmcgui.ListItem(song['name']) listitem.setInfo(type="Music", infoLabels={ "Title": song['name'], }) url = plugin_url + "?act=play&title=" + song['name'].encode( 'utf-8') + "&hash=" + urllib.parse.quote_plus( song['hash'].encode('utf-8')) xbmcplugin.addDirectoryItem(handle, url, listitem, False) xbmcplugin.endOfDirectory(handle)