Add song_fetch error checking
This commit is contained in:
parent
0066166765
commit
f70d2e707c
2 changed files with 20 additions and 3 deletions
|
@ -9,7 +9,7 @@ from .state import State
|
|||
from .connect import get_connection
|
||||
from .room import Room
|
||||
from .song import Song, init_db, get_song_by_title_artist, add_song_in_db, get_song_by_uuid
|
||||
from .song_fetch import lastfm_query_search, yt_get_audio_url, yt_search_song
|
||||
from .song_fetch import query_search, yt_get_audio_url, yt_search_song
|
||||
from .qrcode_gen import generate_qr
|
||||
|
||||
|
||||
|
@ -182,7 +182,8 @@ def add_song():
|
|||
if (query := request.args.get("query")) is None:
|
||||
return error("Missing query")
|
||||
|
||||
info = lastfm_query_search(query)
|
||||
if (info := query_search(query)) is None:
|
||||
return error("Search failed")
|
||||
|
||||
if (song := get_song_by_title_artist(info.title, info.artist)) is None:
|
||||
## song not found, downolad from YT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue