Merge branch 'main' of https://repos.hackathon.bz.it/2025-summer/team-1
This commit is contained in:
commit
07964c469e
2 changed files with 49 additions and 16 deletions
|
@ -30,7 +30,7 @@ class Song:
|
|||
youtube_id: str
|
||||
|
||||
|
||||
def get_song_by_mbid(mbid: str) -> Song:
|
||||
def get_song_by_mbid(mbid: str) -> Song | None:
|
||||
conn = get_connection()
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("SELECT * FROM songs WHERE mbid = ?", (mbid,))
|
||||
|
@ -38,7 +38,7 @@ def get_song_by_mbid(mbid: str) -> Song:
|
|||
conn.close()
|
||||
|
||||
if row is None:
|
||||
raise ValueError(f"Song with MBID {mbid} not found")
|
||||
return None
|
||||
|
||||
song = Song(mbid=row["mbid"], title=row["title"], artist=row["artist"], tags=row["tags"].split(","), image_id=row["lastfm_image_id"], youtube_id=row["youtube_id"])
|
||||
return song
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue