fix: web interface add url issue #91
This commit is contained in:
parent
3e39450db0
commit
9e6072526c
@ -189,7 +189,7 @@ def post():
|
|||||||
|
|
||||||
|
|
||||||
elif 'add_url' in request.form:
|
elif 'add_url' in request.form:
|
||||||
music_wrapper = get_item_wrapper(var.bot, type='url', url=request.form['url'])
|
music_wrapper = get_item_wrapper(var.bot, type='url', url=request.form['url'], user=user)
|
||||||
var.playlist.append(music_wrapper)
|
var.playlist.append(music_wrapper)
|
||||||
|
|
||||||
log.info("web: add to playlist: " + music_wrapper.format_debug_string())
|
log.info("web: add to playlist: " + music_wrapper.format_debug_string())
|
||||||
@ -199,7 +199,7 @@ def post():
|
|||||||
|
|
||||||
elif 'add_radio' in request.form:
|
elif 'add_radio' in request.form:
|
||||||
url = request.form['add_radio']
|
url = request.form['add_radio']
|
||||||
music_wrapper = get_item_wrapper(var.bot, type='radio', url=url)
|
music_wrapper = get_item_wrapper(var.bot, type='radio', url=url, user=user)
|
||||||
var.playlist.append(music_wrapper)
|
var.playlist.append(music_wrapper)
|
||||||
|
|
||||||
log.info("cmd: add to playlist: " + music_wrapper.format_debug_string())
|
log.info("cmd: add to playlist: " + music_wrapper.format_debug_string())
|
||||||
|
@ -91,6 +91,8 @@ class PlaylistItemWrapper:
|
|||||||
|
|
||||||
def get_item_wrapper(bot, **kwargs):
|
def get_item_wrapper(bot, **kwargs):
|
||||||
item = var.library.get_item(bot, **kwargs)
|
item = var.library.get_item(bot, **kwargs)
|
||||||
|
if 'user' not in kwargs:
|
||||||
|
raise KeyError("Which user added this song?")
|
||||||
return PlaylistItemWrapper(var.library, item.id, kwargs['type'], kwargs['user'])
|
return PlaylistItemWrapper(var.library, item.id, kwargs['type'], kwargs['user'])
|
||||||
|
|
||||||
def get_item_wrapper_by_id(bot, id, user):
|
def get_item_wrapper_by_id(bot, id, user):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user