fix: update playlist item based on id #90.

This commit is contained in:
Terry Geng
2020-03-03 23:15:46 +08:00
parent 499186c738
commit 0760f3e624
4 changed files with 51 additions and 23 deletions

12
util.py
View File

@ -74,8 +74,18 @@ def get_music_path(music):
return uri
def attach_item_id(item):
if item['type'] == 'url':
item['id'] = hashlib.md5(item['url'].encode()).hexdigest()
elif item['type'] == 'file':
item['id'] = hashlib.md5(item['path'].encode()).hexdigest()
elif item['type'] == 'radio':
item['id'] = hashlib.md5(item['url'].encode()).hexdigest()
return item
def attach_music_tag_info(music):
music = attach_item_id(music)
def get_music_tag_info(music):
if "path" in music:
uri = get_music_path(music)