mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 12:33:03 +00:00
break settings.py into classes
This commit is contained in:
@@ -6,7 +6,7 @@ import sqlite3
|
||||
from pathlib import Path
|
||||
from sqlite3 import Connection as SqlConn
|
||||
|
||||
from app.settings import APP_DB_PATH
|
||||
from app.settings import Db
|
||||
|
||||
|
||||
def create_connection(db_file: str) -> SqlConn:
|
||||
@@ -22,7 +22,7 @@ def get_sqlite_conn():
|
||||
It opens a connection to the database
|
||||
:return: A connection to the database.
|
||||
"""
|
||||
return create_connection(APP_DB_PATH)
|
||||
return create_connection(Db.APP_DB_PATH)
|
||||
|
||||
|
||||
def create_tables(conn: SqlConn, sql_query: str):
|
||||
|
||||
@@ -7,7 +7,7 @@ from sqlite3 import Connection, Cursor
|
||||
import time
|
||||
|
||||
from app.models import Album, Playlist, Track
|
||||
from app.settings import APP_DB_PATH, USERDATA_DB_PATH
|
||||
from app.settings import Db
|
||||
|
||||
|
||||
def tuple_to_track(track: tuple):
|
||||
@@ -78,10 +78,10 @@ class SQLiteManager:
|
||||
if self.conn is not None:
|
||||
return self.conn.cursor()
|
||||
|
||||
db_path = APP_DB_PATH
|
||||
db_path = Db.APP_DB_PATH
|
||||
|
||||
if self.userdata_db:
|
||||
db_path = USERDATA_DB_PATH
|
||||
db_path = Db.USERDATA_DB_PATH
|
||||
|
||||
self.conn = sqlite3.connect(
|
||||
db_path,
|
||||
|
||||
Reference in New Issue
Block a user