mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 04:23:01 +00:00
prevent running migrations if is_fresh_install
+ fix: sqlite3.ProgrammingError: Cannot operate on a closed cursor on ProcessAlbumColors() + move processing artist images from periodic_scans to Populate + bump hash string limit from 7 to 10 + add last_mod property to database + fix: TypeError: '<' not supported between instances of 'int' and 'str' on album page
This commit is contained in:
@@ -18,7 +18,6 @@ class SQLiteAlbumMethods:
|
||||
|
||||
cur.execute(sql, (albumhash, colors))
|
||||
lastrowid = cur.lastrowid
|
||||
cur.close()
|
||||
|
||||
return lastrowid
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ class SQLiteArtistMethods:
|
||||
"""
|
||||
colors = json.dumps(colors)
|
||||
cur.execute(sql, (artisthash, colors))
|
||||
cur.close()
|
||||
|
||||
@staticmethod
|
||||
def get_all_artists():
|
||||
|
||||
@@ -37,12 +37,13 @@ CREATE TABLE IF NOT EXISTS tracks (
|
||||
artist text NOT NULL,
|
||||
bitrate integer NOT NULL,
|
||||
copyright text,
|
||||
date text NOT NULL,
|
||||
date integer NOT NULL,
|
||||
disc integer NOT NULL,
|
||||
duration integer NOT NULL,
|
||||
filepath text NOT NULL,
|
||||
folder text NOT NULL,
|
||||
genre text,
|
||||
last_mod float NOT NULL,
|
||||
title text NOT NULL,
|
||||
track integer NOT NULL,
|
||||
trackhash text NOT NULL,
|
||||
|
||||
@@ -34,11 +34,12 @@ class SQLiteTrackMethods:
|
||||
filepath,
|
||||
folder,
|
||||
genre,
|
||||
last_mod,
|
||||
title,
|
||||
track,
|
||||
trackhash
|
||||
) VALUES(:album, :albumartist, :albumhash, :artist, :bitrate, :copyright,
|
||||
:date, :disc, :duration, :filepath, :folder, :genre, :title, :track, :trackhash)
|
||||
:date, :disc, :duration, :filepath, :folder, :genre, :last_mod, :title, :track, :trackhash)
|
||||
"""
|
||||
|
||||
track = OrderedDict(sorted(track.items()))
|
||||
@@ -83,12 +84,16 @@ class SQLiteTrackMethods:
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def remove_track_by_filepath(filepath: str):
|
||||
def remove_tracks_by_filepaths(filepaths: str | list[str]):
|
||||
"""
|
||||
Removes a track from the database using its filepath.
|
||||
Removes a track or tracks from the database using their filepaths.
|
||||
"""
|
||||
if isinstance(filepaths, str):
|
||||
filepaths = [filepaths]
|
||||
|
||||
with SQLiteManager() as cur:
|
||||
cur.execute("DELETE FROM tracks WHERE filepath=?", (filepath,))
|
||||
for filepath in filepaths:
|
||||
cur.execute("DELETE FROM tracks WHERE filepath=?", (filepath,))
|
||||
|
||||
@staticmethod
|
||||
def remove_tracks_by_folders(folders: set[str]):
|
||||
|
||||
Reference in New Issue
Block a user