Merge branch 'main' of https://repos.hackathon.bz.it/2025-summer/team-1
This commit is contained in:
commit
b1a59b5b62
2 changed files with 24 additions and 0 deletions
6
backend/src/connect.py
Normal file
6
backend/src/connect.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
|
|
||||||
|
def get_connection():
|
||||||
|
conn = sqlite3.connect("jukebox.db")
|
||||||
|
return conn
|
|
@ -1,4 +1,22 @@
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from connect import get_connection
|
||||||
|
|
||||||
|
|
||||||
|
def init_db():
|
||||||
|
conn = get_connection()
|
||||||
|
cursor = conn.cursor()
|
||||||
|
cursor.execute("""
|
||||||
|
CREATE TABLE IF NOT EXISTS songs (
|
||||||
|
mbid TEXT PRIMARY KEY,
|
||||||
|
title TEXT NOT NULL,
|
||||||
|
artist TEXT NOT NULL,
|
||||||
|
tags TEXT NOT NULL,
|
||||||
|
lastfm_image_id TEXT NOT NULL,
|
||||||
|
youtube_id TEXT NOT NULL
|
||||||
|
);
|
||||||
|
""")
|
||||||
|
conn.commit()
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue