Skip to content

Commit

Permalink
feat: 增加 杜比全景声
Browse files Browse the repository at this point in the history
  • Loading branch information
chen310 committed Dec 5, 2023
1 parent 779e66b commit 4d48347
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
4 changes: 4 additions & 0 deletions addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ def logout():
level = 'sky'
elif quality == '7':
level = 'jymaster'
elif quality == '8':
level = 'dolby'
else:
level = 'standard'

Expand Down Expand Up @@ -446,6 +448,8 @@ def get_songs_items(datas, privileges=[], picUrl=None, offset=0, getmv=True, sou
label += tag(' 沉浸声')
elif play['privilege']['playMaxBrLevel'] == 'jymaster':
label += tag(' 超清母带')
elif play['privilege']['playMaxBrLevel'] == 'dolby':
label += tag(' 杜比全景声')
elif play['privilege']['maxbr'] >= 999000:
label += tag(' SQ')
# payed: 0 未付费 | 3 付费单曲 | 5 付费专辑
Expand Down
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.audio.music163" name="music163" version="1.6.0" provider-name="chen310">
<addon id="plugin.audio.music163" name="music163" version="1.7.0" provider-name="chen310">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.xbmcswift2" version="2.4.0"/>
Expand Down
14 changes: 7 additions & 7 deletions api.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ def __init__(self):
self.session = requests.Session()
self.session.cookies = cookie_jar

if 'appver' not in self.session.cookies:
cookie = self.make_cookie('appver', '8.10.10')
self.session.cookies.set_cookie(cookie)

for cookie in cookie_jar:
if cookie.is_expired():
cookie_jar.clear()
Expand Down Expand Up @@ -106,7 +102,7 @@ def make_cookie(self, name, value):
rest={},
)

def request(self, method, path, params={}, default={"code": -1}, custom_cookies={'os': 'android'}, return_json=True):
def request(self, method, path, params={}, default={"code": -1}, custom_cookies={'os': 'android', 'appver': '8.20.20'}):
endpoint = "{}{}".format(BASE_URL, path)
csrf_token = ""
for cookie in self.session.cookies:
Expand Down Expand Up @@ -268,8 +264,12 @@ def songs_url(self, ids, bitrate):

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)
if level == 'dolby':
params = dict(ids=ids, level='hires', effects='["dolby"]', encodeType='mp4')
return self.request("POST", path, params, custom_cookies={'os': 'pc', 'appver': '2.10.11.201538'})
else:
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):
Expand Down
4 changes: 4 additions & 0 deletions resources/language/resource.language.zh_cn/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ msgctxt "#30023"
msgid "Master"
msgstr "超清母带"

msgctxt "#30100"
msgid "Dolby"
msgstr "杜比全景声"

msgctxt "#30024"
msgid "Video resolution"
msgstr "默认画质"
Expand Down
2 changes: 1 addition & 1 deletion resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<setting id="number_of_songs_per_page" type="number" label="30012" default="1000"/>
<setting id="show_index" type="bool" label="30013" default="false"/>
<setting id="mvfirst" type="bool" label="30014" default="true"/>
<setting id="quality" type="select" label="30015" lvalues="30016|30017|30018|30019|30020|30021|30022|30023" />
<setting id="quality" type="select" label="30015" lvalues="30016|30017|30018|30019|30020|30021|30022|30023|30100" />
<setting id="resolution" type="select" label="30024" lvalues="30025|30026|30027|30028" />
<setting id="song_naming_format" type="select" label="30029" lvalues="30030|30031|30032" />
<setting id="reverse_radio" type="bool" label="30033" default="false" />
Expand Down

0 comments on commit 4d48347

Please sign in to comment.