From 560b7b5f91648e62bee5c1b90c8a38f33a09c32b Mon Sep 17 00:00:00 2001 From: yfang1644 Date: Mon, 23 Oct 2017 13:32:08 +0800 Subject: [PATCH] rewrite some audio plugins --- addons.xml | 16 +- addons.xml.md5 | 2 +- plugin.audio.kugoufm/addon.py | 118 +++++++++++ plugin.audio.kugoufm/addon.xml | 7 +- plugin.audio.kugoufm/changelog.txt | 13 +- plugin.audio.kugoufm/default.py | 105 ---------- plugin.audio.kugoufm/kugou.py | 65 ------ .../plugin.audio.kugoufm-1.0.1.zip | Bin 14067 -> 12928 bytes plugin.audio.kuwo/addon.py | 84 +++++--- plugin.audio.radiocn/addon.py | 191 ++++++++++++++++++ plugin.audio.radiocn/addon.xml | 9 +- plugin.audio.radiocn/changelog.txt | 2 +- plugin.audio.radiocn/default.py | 72 ------- plugin.audio.radiocn/music.py | 86 -------- ...1.0.zip => plugin.audio.radiocn-1.0.0.zip} | Bin 12582 -> 12280 bytes plugin.audio.ximalaya/addon.py | 13 +- 16 files changed, 395 insertions(+), 388 deletions(-) create mode 100644 plugin.audio.kugoufm/addon.py delete mode 100644 plugin.audio.kugoufm/default.py delete mode 100644 plugin.audio.kugoufm/kugou.py create mode 100644 plugin.audio.radiocn/addon.py delete mode 100644 plugin.audio.radiocn/default.py delete mode 100644 plugin.audio.radiocn/music.py rename plugin.audio.radiocn/{plugin.audio.radiocn-1.0.zip => plugin.audio.radiocn-1.0.0.zip} (71%) diff --git a/addons.xml b/addons.xml index 4a7ee0e..e99d066 100644 --- a/addons.xml +++ b/addons.xml @@ -165,9 +165,12 @@ - + version="1.0.0" + provider-name="yfang1644"> + + + + audio @@ -229,8 +232,11 @@ - + provider-name="yfang1644"> + + + + audio diff --git a/addons.xml.md5 b/addons.xml.md5 index fe73a4e..13cb491 100644 --- a/addons.xml.md5 +++ b/addons.xml.md5 @@ -1 +1 @@ -b1e1535347dd8e27867d6c27a40c348e addons.xml +14f423fbec943540d4b2e2adb14c3cce addons.xml diff --git a/plugin.audio.kugoufm/addon.py b/plugin.audio.kugoufm/addon.py new file mode 100644 index 0000000..986e8eb --- /dev/null +++ b/plugin.audio.kugoufm/addon.py @@ -0,0 +1,118 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +from xbmcswift2 import Plugin +import time + +BANNER_PAGE = '[COLOR gold]%s[/COLOR]' + +plugin = Plugin() +url_for = plugin.url_for + +userAgent = 'Opera/9.80 (Android 2.3.4; Linux; Opera Mobi/build-1107180945; U; en-GB) Presto/2.8.149 Version/11.10' +HOST_URL = 'http://m.kugou.com' +headers = {'User-Agent': userAgent, 'Referer': HOST_URL} + +def getHttpData(u, query): + import urllib2 + import json + from urllib import urlencode + + url = '%s/app/i/%s?%s' % (HOST_URL, u, urlencode(query)) + req = urllib2.Request(url, headers=headers) + response = urllib2.urlopen(req) + httpdata = response.read() + response.close() + return json.loads(httpdata) + +def getSingerPic(title, size=200): + import re + # 根据歌手获得相应的信息 + singerList = re.findall('(【.*?】)?(.*?)-', title) + if singerList: + query = {'singerName': singerList[0][1], + 'size': size, + 'd': time.time()*1000} + singerUrl = 'getSingerHead_new.php' + singerJson = getHttpData(singerUrl, query) + return singerJson.get('url', '') + return '' + + +def getSongInfo(hashId): + #根据hash 获得mp3的相应信息 + query = {'hash': hashId, 'cmd': 'playInfo'} + songUrl = 'getSongInfo.php' + songJson = getHttpData(songUrl, query) + return songJson['url'] + + +#http://m.kugou.com/app/i/fmSongs.php?fmid=891&size=30 +def getSongs(fmid, t=None, size=30): + #只选取前80首歌(可以查询的歌曲相当的多!!!) 返回的是相应的json + listUrl = 'fmSongs.php' + offset = {"time": int(t if t else time.time())} + query = {'fmid': str(fmid), 'offset': str(offset),'size': size} + listJson = getHttpData(listUrl, query) + return listJson['data'][0]['songs'] + + +#http://m.kugou.com/app/i/fmList.php?pageindex=1&pagesize=30 +def getFmList(page, pagesize=30): + #获得酷狗Fm列表 json + query = {'pageindex': page, 'pagesize': pagesize} + url = 'fmList.php' + reqJson = getHttpData(url, query) + return reqJson + + +# 获得相应电台的歌曲的列表 +@plugin.route('/getPlayList/') +def getPlayList(fmid): + plugin.set_content('music') + t = int(time.time()) + songs = getSongs(fmid, t) + # 判断songs是否存在 + if not songs: return [] + items = [{ + 'label': song['name'], + 'path': getSongInfo(song['hash']), + 'is_playable': True, + 'info': {'title': song['name'], 'duration': song['time']/1000} + } for song in songs] + + return items + +@plugin.route('/') +def index(page=1): + currpage = int(page) + pagesize = 30 + lists = getFmList(page, pagesize) + totalPages = (lists['recordcount']-1)//pagesize + 1 + items = [] + for i in lists['data']: + items.append({ + 'label': i['fmname'], + 'path': url_for('getPlayList', fmid=i['fmid']), + 'thumbnail': 'http://imge.kugou.com/fmlogo/145/%s' % i['imgurl'], + 'icon': 'http://imge.kugou.com/fmlogo/145/%s' % i['imgurl'], + 'info': {'title': i['fmname']} + }) + + # 设置分页 + if currpage > 1: + linkpage = currpage - 1 + items.append({ + 'label': '上一页 【[COLOR FF00FF00]%s[/COLOR]/[COLOR FFFF0000]%s[/COLOR]】'%(linkpage,totalPages), + 'path': url_for('index',page=linkpage) + }) + if currpage < totalPages: + linkpage = currpage + 1 + items.append({ + 'label': '下一页 【[COLOR FF00FF00]%s[/COLOR]/[COLOR FFFF0000]%s[/COLOR]】'%(linkpage,totalPages), + 'path': url_for('index',page=linkpage) + }) + return items + +if __name__ == '__main__': + plugin.run() diff --git a/plugin.audio.kugoufm/addon.xml b/plugin.audio.kugoufm/addon.xml index 3771cba..555c86f 100644 --- a/plugin.audio.kugoufm/addon.xml +++ b/plugin.audio.kugoufm/addon.xml @@ -2,8 +2,11 @@ - + provider-name="yfang1644"> + + + + audio diff --git a/plugin.audio.kugoufm/changelog.txt b/plugin.audio.kugoufm/changelog.txt index bc69774..9d31ed7 100644 --- a/plugin.audio.kugoufm/changelog.txt +++ b/plugin.audio.kugoufm/changelog.txt @@ -1,11 +1,2 @@ -[B]1.0.1[/B] 2015/1/3 osfans -- 修正无法获取歌手照片导致的脚本错误 - -[B]1.0.0[/B] 2014/12 osfans -- 歌手照片 电台图标 -- 所有电台 -- 动态歌曲列表,加速载入列表 - -[B]0.0.1[/B] 2013/10 keygle -- 插件实现的都是基本功能,连歌手、歌手图片也没提供; -- 音频来源于酷狗的html5版,格式为m4a,感觉比mp3差点,连接速度还行。 +[B]1.0.1[/B] 2017.10.22 +- 基于 osfans 版本,重写函数结构 diff --git a/plugin.audio.kugoufm/default.py b/plugin.audio.kugoufm/default.py deleted file mode 100644 index e044fc5..0000000 --- a/plugin.audio.kugoufm/default.py +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -import xbmc -import xbmcplugin -import xbmcgui -import kugou -import sys -import urlparse -import urllib -import time - - -# 显示 酷狗FM 的相应的专辑 -def index(page): - currpage = int(page) - pagesize = 30 - lists = kugou.getFmList(page, pagesize) - totalPages = (lists['recordcount']-1)//pagesize + 1 - for i in lists['data']: - li = xbmcgui.ListItem(i['fmname']) - li.setInfo(type="Music", infoLabels={"Title": i['fmname']}) - icon = 'http://imge.kugou.com/fmlogo/145/%s' % i['imgurl'] - li.setIconImage(icon) - query = {'act': 'list', 'fmid': i['fmid'], 'icon': icon} - url = "%s?%s" % (plugin_url, urllib.urlencode(query)) - xbmcplugin.addDirectoryItem(handle, url, li, True) - # 设置分页 - if currpage > 1: - linkpage = currpage - 1 - prevLi = xbmcgui.ListItem('上一页 【[COLOR FF00FF00]%s[/COLOR]/[COLOR FFFF0000]%s[/COLOR]】'%(linkpage,totalPages)) - u = "%s?act=index&page=%s" % (plugin_url, linkpage) - xbmcplugin.addDirectoryItem(handle, u, prevLi, True) - if currpage < totalPages: - linkpage = currpage + 1 - nextLi = xbmcgui.ListItem('下一页 【[COLOR FF00FF00]%s[/COLOR]/[COLOR FFFF0000]%s[/COLOR]】'%(linkpage,totalPages)) - u = "%s?act=index&page=%s" % (plugin_url, linkpage) - xbmcplugin.addDirectoryItem(handle, u, nextLi, True) - 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.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) - - -#播放当前Fm列表里的歌曲 -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 play(hashId, title): - playlist = xbmc.PlayList(0) - playlist.clear() # 中止播放列表 - xbmc.Player().stop() - mp3path = kugou.getSongInfo(hashId) - icon = kugou.getSingerPic(title, 100) - thumbnail = kugou.getSingerPic(title, 200) - listitem=xbmcgui.ListItem(title, iconImage=icon, thumbnailImage=thumbnail) - listitem.setInfo(type="Music", infoLabels={"Title": title}) - xbmc.Player().play(mp3path, listitem) - -plugin_url = sys.argv[0] -handle = int(sys.argv[1]) -params = sys.argv[2][1:] -params = dict(urlparse.parse_qsl(params)) - -act = params.get('act', 'index') -fmid = params.get("fmid", '') - -if act == 'index': - page = params.get("page", 1) - index(page) -elif act == 'list': - icon = params.get('icon', '') - getPlayList(fmid, icon) -elif act == 'playList': - t = params.get('time', 0) - playList(fmid, t) -elif act == 'play': - hashId = urllib.unquote_plus(params['hash']) - title = params.get('title', '') - play(hashId, title) diff --git a/plugin.audio.kugoufm/kugou.py b/plugin.audio.kugoufm/kugou.py deleted file mode 100644 index 130c379..0000000 --- a/plugin.audio.kugoufm/kugou.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import urllib2 -import urllib -import re -import json -import time - -userAgent = 'Opera/9.80 (Android 2.3.4; Linux; Opera Mobi/build-1107180945; U; en-GB) Presto/2.8.149 Version/11.10' -homepage = 'http://m.kugou.com' -headers = {'User-Agent': userAgent, 'Referer': homepage} - - -def getHttpData(u, query): - url = '%s/app/i/%s?%s' % (homepage, u, urllib.urlencode(query)) - req = urllib2.Request(url, headers=headers) - response = urllib2.urlopen(req) - httpdata = response.read() - response.close() - return httpdata - - -def getSingerPic(title, size=200): - # 根据歌手获得相应的信息 - singerList = re.findall('(【.*?】)?(.*?)-', title) - if singerList: - query = {'singerName': singerList[0][1], - 'size': size, - 'd': time.time()*1000} - singerUrl = 'getSingerHead_new.php' - singerInfo = getHttpData(singerUrl, query) - return json.loads(singerInfo).get('url', '') - return '' - - -def getSongInfo(hashId): - #根据hash 获得mp3的相应信息 - query = {'hash': hashId, 'cmd': 'playInfo'} - songUrl = 'getSongInfo.php' - songStr = getHttpData(songUrl, query) - songJson = json.loads(songStr) - return songJson['url'] - - -def getSongs(fmid, t=None, size=30): - #只选取前80首歌(可以查询的歌曲相当的多!!!) 返回的是相应的json - listUrl = 'fmSongs.php' - offset = {"time": int(t if t else time.time())} - query = {'fmid': str(fmid), 'offset': str(offset),'size': size} - listStr = getHttpData(listUrl, query) - listJson = json.loads(listStr) - return listJson['data'][0]['songs'] - - -def getFmList(page, pagesize=30): - #获得酷狗Fm列表 json - query = {'pageindex': page, 'pagesize': pagesize} - url = 'fmList.php' - reqStr = getHttpData(url, query) - reqJson = json.loads(reqStr) - return reqJson - -if __name__ == '__main__': - getSingerPic(" ") diff --git a/plugin.audio.kugoufm/plugin.audio.kugoufm-1.0.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AqD}l!I#ga~q-Mq>qC6fmI8rz zL7ab77YXJ>mXGm2vWnu5torSOS&-!;y+@9bk>kKzgh~ngt=2l%T73VGa2}^FN?G!c z;XNn=*?9@}+h5?n@cTE15b1LVaq{0J#-u') def musiclist(url): plugin.set_content('music') @@ -26,28 +29,54 @@ def musiclist(url): tree = BeautifulSoup(html, 'html.parser') soup = tree.find_all('li', {'class': 'clearfix'}) + musicList = [] + mvList = [] for music in soup: mid = music.input['mid'] - title = music.find('p', {'class': 'm_name'}) - title = title.text.strip() - albumname = music.find('p', {'class': 'a_name'}) - albumname = albumname.text.strip() + song = music.find_all('p', {'class': ['m_name','a_name','video']}) + title = song[0].a.text + albumname = song[1].a.text html = get_html(musicAPI + mid) - iconimage = match1(html, '(.*)') - artist = match1(html, '(.*)') + iconimage = r1('(.*)', html) + artist = r1('(.*)', html) for t in supported_stream_types: url = get_html(sourceAPI + '&format={}&rid=MUSIC_{}'.format(t, mid)) if url: + musicList.append({ + 'label': title +'-'+ albumname, + 'path': url, + 'thumbnail': iconimage, + 'is_playable': True, + 'info': {'title': title, 'artist': artist} + }) break - yield { - 'label': title +'-'+ albumname, - 'thumbnail': iconimage, - 'path': url, - 'is_playable': True, - 'info': {'title': title, 'artist': artist} - } + + if song[2].a is not None: + html = get_html(mv.a['href']) + mp4 = r1('var mp4url.+(http:.+?mp4)', html) + mvList.append({ + 'label': title +'-'+ albumname, + 'path': mp4, + 'is_playable': True, + 'thumbnail': iconimage, + 'info': {'title': title, 'artist': artist} + }) + + if len(musicList) > 0: + musicList.insert(0, { + 'label': BANNER_FMT % u'音乐', + 'path': plugin.url_for('stay') + }) + + if len(mvList) > 0: + mvList.insert(0, { + 'label': BANNER_FMT % u'MV', + 'path': plugin.url_for('stay') + }) + + return musicList + mvList @plugin.route('/albumlist/') def albumlist(url): @@ -75,13 +104,12 @@ def singeralbum(url, id, page): yield { 'label': BANNER_FMT % u'专辑', - 'path': plugin.url_for('singeralbum', url=url,id=id,page=page) + 'path': plugin.url_for('stay') } html = get_html(SINGER + url.replace(' ', '%20')) # some singer name has ' ' tree = BeautifulSoup(html, "html.parser") - print 'XXXXXXXXXXXXXXXXX', SINGER+url # ALBUM ####################################### soup = tree.find_all('div', {'id': 'album'}) li = soup[0].find_all('li') @@ -100,12 +128,12 @@ def singeralbum(url, id, page): li = soup[0].find_all('li') yield { 'label': BANNER_FMT % u'MV', - 'path': plugin.url_for('singeralbum', url=url, id=id, page=page) + 'path': plugin.url_for('stay') } for mv in li: name = mv.find('span', {'class': 'name'}) html = get_html(name.a['href']) - mp4 = match1(html, 'var mp4url.+(http:.+?mp4)') + mp4 = r1('var mp4url.+(http:.+?mp4)', html) image = mv.find('div', {'class': 'cover'}) image = image.img['src'] yield { @@ -117,13 +145,13 @@ def singeralbum(url, id, page): } # SONGS ############################################### - aurl = 'http://www.kuwo.cn/artist/contentMusicsAjax' - aurl += '?artistId=%s&pn=%d&rn=15' % (id, page) - html = get_html(aurl) yield { 'label': BANNER_FMT % u'单曲', - 'path': plugin.url_for('singeralbum', url=url, id=id, page=page) + 'path': plugin.url_for('stay') } + aurl = 'http://www.kuwo.cn/artist/contentMusicsAjax' + aurl += '?artistId=%s&pn=%d&rn=15' % (id, page) + html = get_html(aurl) l = re.compile('"id":"MUSIC_(\d+)').findall(html) maxpage = re.compile('data-page="(\d+)"').findall(html) maxpage = int(maxpage[0]) @@ -141,8 +169,8 @@ def singeralbum(url, id, page): mid = re.compile('\d+').findall(song.a['href']) mid = mid[0] html = get_html(musicAPI + mid) - iconimage = match1(html, '(.*)') - artist = match1(html, '(.*)') + iconimage = r1('(.*)', html) + artist = r1('(.*)', html) for t in ['aac', 'wma', 'mp3']: url = get_html(sourceAPI + '&format={}&rid=MUSIC_{}'.format(t, mid)) @@ -212,7 +240,7 @@ def singerlist(): for singer in soup: yield { 'label': BANNER_FMT % singer.span.text, - 'path': plugin.url_for('singerlist') + 'path': plugin.url_for('stay') } li = singer.find_all('dd') for item in li: @@ -257,7 +285,7 @@ def sortlist(): for sdlist in soup: yield { 'label': BANNER_FMT % sdlist.h1.text, - 'path': plugin.url_for('sortlist') + 'path': plugin.url_for('stay') } li = sdlist.find_all('li') @@ -276,7 +304,7 @@ def category(): for hotlist in soup: yield { 'label': BANNER_FMT % hotlist.h1.text, - 'path': plugin.url_for('category') + 'path': plugin.url_for('stay') } x = hotlist.find_all('ul', {'class': 'clearfix'}) li = x[0].find_all('li') diff --git a/plugin.audio.radiocn/addon.py b/plugin.audio.radiocn/addon.py new file mode 100644 index 0000000..2d3ea4b --- /dev/null +++ b/plugin.audio.radiocn/addon.py @@ -0,0 +1,191 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +from xbmcswift2 import Plugin +from urllib import urlencode +import urllib2 +from json import loads + +BaseHtml = 'http://www.radio.cn/pc-portal/erji' +BaseAPI = 'http://tacc.radio.cn/pcpages' +BANNER_FMT = '[B][COLOR gold][%s][/COLOR][/B]' + +UserAgent = "Mozilla/5.0 (X11; Linux i686; rv:35.0) Gecko/20100101 Firefox/35.0" +headers = {"Host": "www.radio.cn", + "User-Agent": UserAgent, + "Referer": "http://www.radio.cn/index.php?option=default,radio"} + +plugin = Plugin() +url_for = plugin.url_for + +def request(url, js=True): + print('request', url) + req = urllib2.Request(url) + response = urllib2.urlopen(req) + cont = response.read() + response.close() + if js: + cont = loads(cont.strip("()")) + return cont + +@plugin.route('/stay') +def stay(): + pass + +@plugin.route('/station//') +def station(place_id, type_id): + #name, mode, icon, area, type + plugin.set_content('video') + req = { + 'place_id': '' if place_id == '0' else place_id, + 'type_id': '' if type_id == '0' else type_id + } + c = request(BaseAPI+'/radiopages?' + urlencode(req)) + items = [] + + items.append({ + 'label': BANNER_FMT % '地区', + 'path': plugin.url_for('stay') + }) + for place in c['data']['place']: + items.append({ + 'label': place['name'], + 'path': url_for('station', place_id=place['id'],type_id=type_id) + }) + items.append({ + 'label': BANNER_FMT % '类型', + 'path': url_for('stay') + }) + for type in c['data']['type']: + items.append({ + 'label': type['name'], + 'path': url_for('station', place_id=place_id,type_id=type['id']) + }) + + for top in c['data']['top']: + items.append({ + 'label': top['name'], + 'path': top['streams'][0]['url'], + 'thumbnail': top['icon'][0]['url'], + 'is_playable': True, + 'info': {'title': top['name']} + }) + return items + +@plugin.route('/sections/') +def sections(id): + plugin.set_content('music') + req = { + 'od_id': id, + # 'start': 1, + 'rows': 2000 + } + c = request(BaseAPI + '/odchannelpages?' + urlencode(req)) + items = [] + for item in c['data']['program']: + items.append({ + 'label': item['name'], + 'path': item['streams'][0]['url'], + 'thumbnail': item['imageUrl'][0]['url'], + 'is_playable': True, + 'info': {'title': item['name'], + 'plot': item['description'], + 'duration': int(item['duration']) + } + }) + return items + +@plugin.route('/classification//') +def classification(cate_id, page): + req = { + 'per_page': 16, + 'page': page, + 'cate_id': '' if cate_id == '0' else cate_id + } + c = request(BaseAPI + '/categorypages?'+urlencode(req)) + items = [] + for cat in c['data']['category']: + items.append({ + 'label': cat['name'], + 'path': url_for('classification', cate_id=cat['id'], page='1') + }) + + for chn in c['data']['odchannel']: + items.append({ + 'label': chn['name'], + 'path': url_for('sections', id=chn['id']), + 'thumbnail': chn['imageUrl'][0]['url'], + 'info': {'title': chn['name'], + 'plot': chn['description'], + 'artist': chn.get('source', '')} + }) + + items += [{'label': BANNER_FMT % u'分页', 'path': url_for('stay')}] + for i_page in range(int(c['data']['total_page'])): + if i_page == int(page)-1: continue + items.append({ + 'label': str(i_page+1), + 'path': url_for('classification', cate_id=cate_id, page=i_page+1) + }) + return items + +@plugin.route('/oneanchor/') +def oneanchor(id): + c = request(BaseAPI + '/oneanchor?' + 'anchorId=' + id) + items = [{ + 'label': item['name'], + 'path': url_for('sections', id=item['id']), + 'thumbnail': item['img'], + } for item in c['ondemands']] + + return items + +@plugin.route('/podcast/') +def podcast(domain): + c = request(BaseAPI + '/anchorpages?') + items = [{ + 'label': item['name'], + 'path': url_for('podcast', domain=item['id']) + } for item in c['AnchorsLabeldomain']] + items.insert(0, {'label': BANNER_FMT % u'主播分类', + 'path': url_for('stay')}) + + if domain == '0': + domain = c['allAnchors']['id'] + req = { + 'limit': 2000, + 'offset': 1, + 'labeldomainId': domain + } + c = request(BaseAPI + '/anchorsByDomain?' + urlencode(req)) + + for item in c['allAnchors']['anchors']: + items.append({ + 'label': item['name'], + 'path': url_for('oneanchor', id=item['id']), + 'thumbnail': item['img'], + 'info': {'plot': item['description']}, + }) + + return items + +@plugin.route('/') +def root(): + items = [ + { + 'label': '电台', + 'path': url_for('station', place_id='0', type_id='0') + }, + { + 'label': '分类', + 'path': url_for('classification', cate_id='0', page=1) + }, + { + 'label': '主播', + 'path': url_for('podcast', domain = '0') + } + ] + return items + +if __name__ == '__main__': + plugin.run() diff --git a/plugin.audio.radiocn/addon.xml b/plugin.audio.radiocn/addon.xml index 5e85c81..81b04bd 100644 --- a/plugin.audio.radiocn/addon.xml +++ b/plugin.audio.radiocn/addon.xml @@ -1,9 +1,12 @@ - + version="1.0.0" + provider-name="yfang1644"> + + + + audio diff --git a/plugin.audio.radiocn/changelog.txt b/plugin.audio.radiocn/changelog.txt index ffecb85..e64992f 100644 --- a/plugin.audio.radiocn/changelog.txt +++ b/plugin.audio.radiocn/changelog.txt @@ -1,2 +1,2 @@ -[B]1.0[/B] (2015/01/20 osfans) +[B]1.0.0[/B] (2017/10/20) - 初始版本 diff --git a/plugin.audio.radiocn/default.py b/plugin.audio.radiocn/default.py deleted file mode 100644 index 7655e50..0000000 --- a/plugin.audio.radiocn/default.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -import music -import xbmc -import xbmcgui -import xbmcplugin -import urllib -import urllib2 -import sys - - -def addList(lists): - #name, mode, icon, area, type, channelId - n = len(lists) - plugin = sys.argv[0] - handle = int(sys.argv[1]) - for item in lists: - name = item['name'] - mode = item['mode'] - isFolder = music.isFolder(mode) - li = xbmcgui.ListItem(name) - icon = item.get('icon', '') - if icon: - li.setIconImage(icon) - u = "%s?%s" % (plugin, urllib.urlencode(item)) - xbmcplugin.addDirectoryItem(handle, u, li, isFolder, n) - xbmcplugin.endOfDirectory(handle) - - -def play(params): - name = params.get("name", "") - icon = params.get("icon", "") - channelId = params.get("channelId", "") - if channelId: - li = xbmcgui.ListItem(name) - info = {'title': name} - li.setInfo(type='Video', infoLabels = info) - if icon: - li.setThumbnailImage(icon) - url = music.getStreamUrl(channelId) - xbmc.Player().play(url, li) - - -def get_params(): # get part of the url, help to judge the param of the url, direcdory - param = {} - params = sys.argv[2] - if len(params) >= 2: - cleanedparams = params.rsplit('?',1) - if len(cleanedparams) == 2: - cleanedparams = cleanedparams[1] - else: - cleanedparams = params.replace('?','') - param = dict(urllib2.urlparse.parse_qsl(cleanedparams)) - print(param) - return param - - -params = get_params() -mode = params.get("mode", music.MODE_MENU) - -l = [] -if mode == music.MODE_MENU: - l = music.getMenu() -elif mode == music.MODE_CHANNELS: - area = params.get("area", "0") - type = params.get("type", "0") - l = music.getChannels(area, type) -elif mode == music.MODE_PLAY: - play(params) -if l: - addList(l) diff --git a/plugin.audio.radiocn/music.py b/plugin.audio.radiocn/music.py deleted file mode 100644 index 4d1d037..0000000 --- a/plugin.audio.radiocn/music.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import urllib2 -import urllib -import re -import json - -baseHtml = "http://bk2.radio.cn/mms4/videoPlay" -typeHtml = baseHtml + "/getAreaAndType.jspa" -channelHtml = baseHtml + "/pcGetChannels.jspa" -playinfoHtml = baseHtml + "/getChannelPlayInfoJson.jspa" - -UserAgent = "Mozilla/5.0 (X11; Linux i686; rv:35.0) Gecko/20100101 Firefox/35.0" -headers = {"Host": "bk2.radio.cn", - "User-Agent": UserAgent, - "Referer": "http://www.radio.cn/index.php?option=default,radio"} - -MODE_NONE = "none" -MODE_MENU = "menu" -MODE_CHANNELS = "channels" -MODE_PLAY = "play" - - -def request(url, js=True): - print('request', url) - req = urllib2.Request(url, headers=headers) - response = urllib2.urlopen(req) - cont = response.read() - response.close() - if js: - cont = json.loads(cont.strip("()")) - return cont - - -def isFolder(mode): - return mode in (MODE_MENU, MODE_CHANNELS) - - -def getMenu(): - #name, mode, icon, area, type - c = request(typeHtml) - d = {"area": "地区", "type": "类型"} - l = [] - for i in sorted(d.keys()): - h = '[COLOR FFDEB887]【%s】[/COLOR]' % (d[i]) - item = {'name': h, 'mode': MODE_NONE} - l.append(item) - for j in c[i]: - item = {'name': j['value'].encode('utf-8'), - 'mode': MODE_CHANNELS, - 'icon': j['url'].encode('utf-8')} - item[i] = j['key'].encode('utf-8') - l.append(item) - return l - - -def getChannels(area=0, type=0): - url = channelHtml - query = {"area": area, "type": type, "callback": ""} - url = "%s?%s" % (url, urllib.urlencode(query)) - c = request(url) - l = [] - # name, mode, icon, param - for j in c: - item = {'name': j['channelName'].encode('utf-8'), - 'mode': MODE_PLAY, - 'icon': j['icon'].encode('utf-8'), - 'channelId': j['channelId']} - l.append(item) - return l - - -def getStreamUrl(channelId): - url = playinfoHtml - query = {"channelId": channelId, - "location": "http://www.radio.cn/index.php?option=default,radio", - "terminalType": "PC", - "callback": ""} - url = "%s?%s" % (url, urllib.urlencode(query)) - c = request(url) - return c['streams'][0]['url'] - - -if __name__ == '__main__': - print(getStreamUrl(183)) diff --git a/plugin.audio.radiocn/plugin.audio.radiocn-1.0.zip b/plugin.audio.radiocn/plugin.audio.radiocn-1.0.0.zip similarity index 71% rename from plugin.audio.radiocn/plugin.audio.radiocn-1.0.zip rename to plugin.audio.radiocn/plugin.audio.radiocn-1.0.0.zip index 5f3a71500cc686432959d6a23f92b7bb4b862489..fe4f087ef976f37f80ec2df018ff736b810d9ca8 100644 GIT binary patch delta 2891 zcmZXWc{CK<|Hp?h(PYcmVj4@fvCM+8WT}w#K^Qy9PQ;9mwXtR^kq||ekZpvKC0Ub@ zeJ4xGzKx26;X9t+Ilu4n+;cwnpL;*|p3fie^LiCJ?AtNj&;!ze0jEpF)-0Jxf<79u zVd)RqNWOvv%C9X{rZo#fIBd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{u%c_}t@b9dnBl_sI3TAHdpy#Qc#9%9PW7JVeq zr_;LYZR6(K+dDLHG-zvD_S{D!Cs;eSuXUT6fo^q*?X)iD4znn?>O9qNVlp|{8)QAP zvFq{XHVdY$wE3QHR#7z-RVZc!iY#`Q@#MpAY58fwEKgTN9BbLm<*7GG98*>JmMFT- zQ$Hn0WfE-PdoMqE!6XbsFBz=H#-20^JBjW(ybKGQn4i!Su8){ONmjNEe^OT+3wDm1 zloo8rNqpa~=u#kiZX$!6dH($hw+|UDNAqEp8C4~9su0f}`s9JR z)%{<0TE?4=?`V|i{xI2yTxpuMaT~uO0I0DIuys zYsu=tMcT3MbIsz8hv+fp!C>y&9DVON>wGjsxm`RzSC@)3)CT2Y#4Ai-5iRYn7?Q%c zl0%=3xDyauOQF|!-}I*E(kBg*k3xz&8nTePdKjDBFLG*mjaP)>;V$*LWZ^P9Z|Jga znNYl+Uv+2?q5n`>{(BxEPO{^oWGMvxDuh2zf0DeMCfb1oR{-S~_$$wUZVr{YY*zg< e+{D8!;r_p1Z)!wNaruW7#C4mfhR#b9f&K|F1cq7w diff --git a/plugin.audio.ximalaya/addon.py b/plugin.audio.ximalaya/addon.py index 7e3e609..0d8f0e8 100644 --- a/plugin.audio.ximalaya/addon.py +++ b/plugin.audio.ximalaya/addon.py @@ -2,7 +2,6 @@ # -*- coding: utf-8 -*- from xbmcswift2 import Plugin, xbmcaddon -from urllib import urlencode import re from json import loads from bs4 import BeautifulSoup @@ -97,7 +96,7 @@ def httphead(url): @plugin.route('/') def root(): - + plugin.set_content('music') html = get_html(HOST_URL + '/dq/all/') html = re.sub('\t|\r|\n', '', html) tree = BeautifulSoup(html, 'html.parser') @@ -119,6 +118,7 @@ def root(): @plugin.route('/sublist/') def sublist(cid): + plugin.set_content('music') html = get_html(HOST_URL + '/dq/all/') tree = BeautifulSoup(html, 'html.parser') @@ -133,6 +133,7 @@ def sublist(cid): @plugin.route('/albumlist/') def albumlist(url): + plugin.set_content('music') html = get_html(url) tree = BeautifulSoup(html, 'html.parser') soup = tree.find_all('div', {'class': 'discoverAlbum_wrapper'}) @@ -160,17 +161,11 @@ def albumlist(url): 'path': plugin.url_for('albumlist', url=httphead(url.encode('utf-8'))) } -@plugin.route('/play/') -def play(url): - plugin.set_content('music') - plugin.resolved_url(url) @plugin.route('/playList///') def playList(url, page, order): plugin.set_content('music') - pdata = {'page': page, 'order': order} - data = urlencode(pdata) - html = get_html(url + '?' + data) + html = get_html(url + '?page={}&order={}'.format(page, order)) tree = BeautifulSoup(html, 'html.parser') info = tree.find_all('div', {'class': 'rich_intro'})