This commit is contained in:
billypom on debian 2024-09-07 12:50:44 -04:00
parent c4d181f1c1
commit 50919cddb8
2 changed files with 3 additions and 2 deletions

View File

@ -162,12 +162,15 @@ class MusicTable(QTableView):
pass
selected_filepaths = self.get_selected_songs_filepaths()
selected_indices = self.get_selected_rows()
# FIXME: this should be batch delete with a worker thread
# probably pass selected_filepaths to a worker thread
for file in selected_filepaths:
with DBA.DBAccess() as db:
song_id = db.query(
"SELECT id FROM song WHERE filepath = ?", (file,)
)[0][0]
delete_song_id_from_database(song_id)
# This part cannot be thread...i think? bcus its Q stuff happening
for index in selected_indices:
try:
self.model.removeRow(index)

View File

@ -68,7 +68,6 @@ def add_files_to_library(files, progress_callback=None):
bitrate,
)
)
logging.info("insert data appended")
# Check if batch size is reached
if len(insert_data) >= 1000:
logging.info(f"inserting a LOT of songs: {len(insert_data)}")
@ -79,7 +78,6 @@ def add_files_to_library(files, progress_callback=None):
)
insert_data = [] # Reset the insert_data list
else:
logging.info("continuing...")
# continue adding files if we havent reached big length
continue
# Insert any remaining data