diff --git a/addon.py b/addon.py index 435416d..a4020f3 100644 --- a/addon.py +++ b/addon.py @@ -142,17 +142,23 @@ def logout(): quality = xbmcplugin.getSetting(int(sys.argv[1]), 'quality') if quality == '0': - bitrate = 128000 + level = 'standard' elif quality == '1': - bitrate = 192000 + level = 'higher' elif quality == '2': - bitrate = 320000 + level = 'exhigh' elif quality == '3': - bitrate = 350000 + level = 'lossless' elif quality == '4': - bitrate = 999000 + level = 'hires' +elif quality == '5': + level = 'jyeffect' +elif quality == '6': + level = 'sky' +elif quality == '7': + level = 'jymaster' else: - bitrate = 128000 + level = 'standard' resolution = xbmcplugin.getSetting(int(sys.argv[1]), 'resolution') if resolution == '0': @@ -429,6 +435,12 @@ def get_songs_items(datas, privileges=[], picUrl=None, offset=0, getmv=True, sou label += tag(' Hi-Res') elif play['privilege']['playMaxBrLevel'] == 'lossless': label += tag(' SQ') + elif play['privilege']['playMaxBrLevel'] == 'jyeffect': + label += tag(' 环绕声') + elif play['privilege']['playMaxBrLevel'] == 'sky': + label += tag(' 沉浸声') + elif play['privilege']['playMaxBrLevel'] == 'jymaster': + label += tag(' 超清母带') elif play['privilege']['maxbr'] >= 999000: label += tag(' SQ') # payed: 0 未付费 | 3 付费单曲 | 5 付费专辑 @@ -593,7 +605,7 @@ def song_contextmenu(action, meida_type, song_id, mv_id, sourceId, dt): dialog.notification( '收藏', msg, xbmcgui.NOTIFICATION_INFO, 800, False) elif action == 'play_song': - songs = music.songs_url([song_id], bitrate=bitrate).get("data", []) + songs = music.songs_url_v1([song_id], level=level).get("data", []) urls = [song['url'] for song in songs] url = urls[0] if url is None: @@ -623,14 +635,14 @@ def play(meida_type, song_id, mv_id, sourceId, dt): dialog.notification('MV播放失败', '自动播放歌曲', xbmcgui.NOTIFICATION_INFO, 800, False) - songs = music.songs_url([song_id], bitrate=bitrate).get("data", []) + songs = music.songs_url_v1([song_id], level=level).get("data", []) urls = [song['url'] for song in songs] if len(urls) == 0: url = None else: url = urls[0] elif meida_type == 'song': - songs = music.songs_url([song_id], bitrate=bitrate).get("data", []) + songs = music.songs_url_v1([song_id], level=level).get("data", []) urls = [song['url'] for song in songs] # 一般是网络错误 if len(urls) == 0: @@ -656,7 +668,7 @@ def play(meida_type, song_id, mv_id, sourceId, dt): elif meida_type == 'dj': result = music.dj_detail(song_id) song_id = result['program']['mainSong']['id'] - songs = music.songs_url([song_id], bitrate=bitrate).get("data", []) + songs = music.songs_url_v1([song_id], level=level).get("data", []) urls = [song['url'] for song in songs] if len(urls) == 0: url = None @@ -1553,7 +1565,7 @@ def get_artists_items(artists): def get_users_items(users): - vip_level = ['壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '拾'] + vip_level = ['', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '拾'] items = [] for user in users: plot_info = tag(user['nickname'], 'pink') @@ -1577,7 +1589,10 @@ def get_users_items(users): plot_info += level_str + '\n' elif user['vipType'] == 11: level = user['vipRights']['redVipLevel'] - level_str = tag('vip·' + vip_level[level], 'red') + if 'redplus' in user['vipRights'] and user['vipRights']['redplus'] is not None: + level_str = tag('Svip·' + vip_level[level], 'gold') + else: + level_str = tag('vip·' + vip_level[level], 'red') if user['userType'] == 4: plot_info += level_str + tag(' 音乐人', 'red') + '\n' else: diff --git a/addon.xml b/addon.xml index a1c7f7c..96f2ec6 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/api.py b/api.py index 56f313f..b37cbc3 100644 --- a/api.py +++ b/api.py @@ -46,7 +46,7 @@ def __init__(self): self.session.cookies = cookie_jar if 'appver' not in self.session.cookies: - cookie = self.make_cookie('appver', '8.7.01') + cookie = self.make_cookie('appver', '8.10.10') self.session.cookies.set_cookie(cookie) for cookie in cookie_jar: @@ -106,7 +106,7 @@ def make_cookie(self, name, value): rest={}, ) - def request(self, method, path, params={}, default={"code": -1}, custom_cookies={'os': 'ios'}, return_json=True): + def request(self, method, path, params={}, default={"code": -1}, custom_cookies={'os': 'android'}, return_json=True): endpoint = "{}{}".format(BASE_URL, path) csrf_token = "" for cookie in self.session.cookies: @@ -266,6 +266,11 @@ def songs_url(self, ids, bitrate): params = dict(ids=ids, br=bitrate) return self.request("POST", path, params) + def songs_url_v1(self, ids, level): + path = "/weapi/song/enhance/player/url/v1" + params = dict(ids=ids, level=level, encodeType='flac') + return self.request("POST", path, params) + # lyric http://music.163.com/api/song/lyric?os=osx&id= &lv=-1&kv=-1&tv=-1 def song_lyric(self, music_id): path = "/weapi/song/lyric" diff --git a/resources/language/resource.language.zh_cn/strings.po b/resources/language/resource.language.zh_cn/strings.po index 3dd61a4..739e326 100644 --- a/resources/language/resource.language.zh_cn/strings.po +++ b/resources/language/resource.language.zh_cn/strings.po @@ -95,6 +95,18 @@ msgctxt "#32015" msgid "Hi-Res" msgstr "Hi-Res" +msgctxt "#32016" +msgid "Spatial Audio" +msgstr "高清环绕声" + +msgctxt "#32017" +msgid "Surround Audio" +msgstr "沉浸环绕声" + +msgctxt "#32018" +msgid "Master" +msgstr "超清母带" + # 标清 msgctxt "#32021" msgid "240" diff --git a/resources/settings.xml b/resources/settings.xml index 10b0fb9..4dc2635 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -19,7 +19,7 @@ - +