mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 04:23:01 +00:00
add method and route to search across tracks, albums and artists.
+ break models into separate files + same for the utils and setup
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
from sqlite3 import Cursor
|
||||
|
||||
from app.db import AlbumMethods
|
||||
|
||||
from .utils import SQLiteManager, tuple_to_album, tuples_to_albums
|
||||
|
||||
|
||||
class SQLiteAlbumMethods(AlbumMethods):
|
||||
class SQLiteAlbumMethods:
|
||||
@classmethod
|
||||
def insert_one_album(cls, cur: Cursor, albumhash: str, colors: str):
|
||||
"""
|
||||
|
||||
@@ -4,7 +4,8 @@ from collections import OrderedDict
|
||||
from app.db.sqlite.tracks import SQLiteTrackMethods
|
||||
from app.db.sqlite.utils import SQLiteManager, tuple_to_playlist, tuples_to_playlists
|
||||
from app.models import Artist
|
||||
from app.utils import background, create_new_date
|
||||
from app.utils.generators import create_new_date
|
||||
from app.utils.threading import background
|
||||
|
||||
|
||||
class SQLitePlaylistMethods:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from app.db.sqlite.utils import SQLiteManager
|
||||
from app.utils import win_replace_slash
|
||||
from app.utils.wintools import win_replace_slash
|
||||
|
||||
|
||||
class SettingsSQLMethods:
|
||||
@@ -19,7 +19,7 @@ class SettingsSQLMethods:
|
||||
cur.execute(sql)
|
||||
dirs = cur.fetchall()
|
||||
|
||||
dirs = [dir[0] for dir in dirs]
|
||||
dirs = [_dir[0] for _dir in dirs]
|
||||
return [win_replace_slash(d) for d in dirs]
|
||||
|
||||
@staticmethod
|
||||
@@ -31,7 +31,7 @@ class SettingsSQLMethods:
|
||||
sql = "INSERT INTO settings (root_dirs) VALUES (?)"
|
||||
existing_dirs = SettingsSQLMethods.get_root_dirs()
|
||||
|
||||
dirs = [dir for dir in dirs if dir not in existing_dirs]
|
||||
dirs = [_dir for _dir in dirs if _dir not in existing_dirs]
|
||||
|
||||
if len(dirs) == 0:
|
||||
return
|
||||
@@ -85,4 +85,4 @@ class SettingsSQLMethods:
|
||||
with SQLiteManager(userdata_db=True) as cur:
|
||||
cur.execute(sql)
|
||||
dirs = cur.fetchall()
|
||||
return [dir[0] for dir in dirs]
|
||||
return [_dir[0] for _dir in dirs]
|
||||
|
||||
@@ -3,7 +3,6 @@ Contains the SQLiteTrackMethods class which contains methods for
|
||||
interacting with the tracks table.
|
||||
"""
|
||||
|
||||
|
||||
from collections import OrderedDict
|
||||
from sqlite3 import Cursor
|
||||
|
||||
@@ -38,7 +37,8 @@ class SQLiteTrackMethods:
|
||||
title,
|
||||
track,
|
||||
trackhash
|
||||
) VALUES(:album, :albumartist, :albumhash, :artist, :bitrate, :copyright, :date, :disc, :duration, :filepath, :folder, :genre, :title, :track, :trackhash)
|
||||
) VALUES(:album, :albumartist, :albumhash, :artist, :bitrate, :copyright,
|
||||
:date, :disc, :duration, :filepath, :folder, :genre, :title, :track, :trackhash)
|
||||
"""
|
||||
|
||||
track = OrderedDict(sorted(track.items()))
|
||||
|
||||
Reference in New Issue
Block a user