refactor: avoid use youtube-dl if music is existed locally. #78

This commit is contained in:
Terry Geng
2020-02-26 17:46:14 +08:00
parent 9ce98196a1
commit 7c8c1f9d9a
4 changed files with 66 additions and 41 deletions

View File

@ -201,10 +201,13 @@ def post():
'url': request.form['add_url'],
'user': 'Web',
'ready': 'validation'}
media.url.get_url_info(music)
music = var.playlist.append(music)
logging.info("web: add to playlist: " + util.format_debug_song_string(music))
var.playlist.playlist[-1]['ready'] = "no"
music = var.botamusique.validate_music(music)
if music:
var.playlist.append(music)
logging.info("web: add to playlist: " + util.format_debug_song_string(music))
if var.playlist.length() == 2:
# If I am the second item on the playlist. (I am the next one!)
var.botamusique.async_download_next()
elif 'add_radio' in request.form:
music = var.playlist.append({'type': 'radio',