Fix after merge
This commit is contained in:
parent
d56dbb3d9f
commit
96e71d891c
3 changed files with 5 additions and 7 deletions
|
@ -1,10 +1,10 @@
|
||||||
import dotenv
|
import dotenv
|
||||||
from connect import get_connection
|
|
||||||
from flask import Flask, Response, jsonify, request
|
from flask import Flask, Response, jsonify, request
|
||||||
from flask_cors import CORS
|
from flask_cors import CORS
|
||||||
from flask_socketio import SocketIO, emit
|
from flask_socketio import SocketIO, emit
|
||||||
from state import State
|
|
||||||
|
|
||||||
|
from .state import State
|
||||||
|
from .connect import get_connection
|
||||||
from .room import Room
|
from .room import Room
|
||||||
from .song import Song, init_db, get_song_by_title_artist, add_song_in_db
|
from .song import Song, init_db, get_song_by_title_artist, add_song_in_db
|
||||||
from .song_fetch import lastfm_query_search, download_song_mp3
|
from .song_fetch import lastfm_query_search, download_song_mp3
|
||||||
|
@ -147,7 +147,5 @@ def add_song():
|
||||||
return {"artist": info.artist, "title": info.title, "tags": info.tags, "image_id": info.img_id}
|
return {"artist": info.artist, "title": info.title, "tags": info.tags, "image_id": info.img_id}
|
||||||
|
|
||||||
|
|
||||||
init_db()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
socketio.run(app, debug=True)
|
socketio.run(app, debug=True)
|
||||||
|
|
|
@ -65,7 +65,7 @@ def add_song_in_db(title: str, artist: str, tags: list[str], image_id: str, yt_i
|
||||||
INSERT OR REPLACE INTO songs (mbid, title, artist, tags, lastfm_image_id, youtube_id)
|
INSERT OR REPLACE INTO songs (mbid, title, artist, tags, lastfm_image_id, youtube_id)
|
||||||
VALUES (?, ?, ?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, ?, ?)
|
||||||
""",
|
""",
|
||||||
(uuid.uuid4(), title, artist, ",".join(tags), image_id, yt_id),
|
(str(uuid.uuid4()), title, artist, ",".join(tags), image_id, yt_id),
|
||||||
) # Updates song info if it already exists
|
) # Updates song info if it already exists
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass, field
|
||||||
from sqlite3 import Cursor
|
from sqlite3 import Cursor
|
||||||
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
@ -10,4 +10,4 @@ from .room import Room
|
||||||
class State:
|
class State:
|
||||||
app: Flask
|
app: Flask
|
||||||
db: Cursor
|
db: Cursor
|
||||||
rooms: dict[int, Room] = {} # { room_id: room, ... }
|
rooms: dict[int, Room] = field(default_factory=dict) # { room_id: room, ... }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue