Skip to content

Commit c9dff98

Browse files
mrandybupython273
authored andcommitted
Fix VkAudio compatibility with python2 (#118)
1 parent 803df33 commit c9dff98

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

vk_api/audio_url_decoder.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,26 @@ def decode_audio_url(string, user_id):
2626
ops_list = vk_o(vals[1]).split('\x09')[::-1]
2727

2828
for op_data in ops_list:
29-
cmd, *arg = op_data.split('\x0b')
29+
30+
split_op_data = op_data.split('\x0b')
31+
cmd = split_op_data[0]
32+
if len(split_op_data) > 1:
33+
arg = split_op_data[1]
34+
else:
35+
arg = None
3036

3137
if cmd == 'v':
3238
tstr = tstr[::-1]
3339

3440
elif cmd == 'r':
35-
tstr = vk_r(tstr, arg[0])
41+
tstr = vk_r(tstr, arg)
3642

3743
elif cmd == 'x':
38-
tstr = vk_xor(tstr, arg[0])
44+
tstr = vk_xor(tstr, arg)
3945
elif cmd == 's':
40-
tstr = vk_s(tstr, arg[0])
46+
tstr = vk_s(tstr, arg)
4147
elif cmd == 'i':
42-
tstr = vk_i(tstr, arg[0], user_id)
48+
tstr = vk_i(tstr, arg, user_id)
4349
else:
4450
raise VkAudioUrlDecodeError(
4551
'Unknown decode cmd: "{}"; Please send bugreport'.format(cmd)

0 commit comments

Comments
 (0)