notes
This commit is contained in:
parent
c4d181f1c1
commit
50919cddb8
@ -162,12 +162,15 @@ class MusicTable(QTableView):
|
|||||||
pass
|
pass
|
||||||
selected_filepaths = self.get_selected_songs_filepaths()
|
selected_filepaths = self.get_selected_songs_filepaths()
|
||||||
selected_indices = self.get_selected_rows()
|
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:
|
for file in selected_filepaths:
|
||||||
with DBA.DBAccess() as db:
|
with DBA.DBAccess() as db:
|
||||||
song_id = db.query(
|
song_id = db.query(
|
||||||
"SELECT id FROM song WHERE filepath = ?", (file,)
|
"SELECT id FROM song WHERE filepath = ?", (file,)
|
||||||
)[0][0]
|
)[0][0]
|
||||||
delete_song_id_from_database(song_id)
|
delete_song_id_from_database(song_id)
|
||||||
|
# This part cannot be thread...i think? bcus its Q stuff happening
|
||||||
for index in selected_indices:
|
for index in selected_indices:
|
||||||
try:
|
try:
|
||||||
self.model.removeRow(index)
|
self.model.removeRow(index)
|
||||||
|
|||||||
@ -68,7 +68,6 @@ def add_files_to_library(files, progress_callback=None):
|
|||||||
bitrate,
|
bitrate,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
logging.info("insert data appended")
|
|
||||||
# Check if batch size is reached
|
# Check if batch size is reached
|
||||||
if len(insert_data) >= 1000:
|
if len(insert_data) >= 1000:
|
||||||
logging.info(f"inserting a LOT of songs: {len(insert_data)}")
|
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
|
insert_data = [] # Reset the insert_data list
|
||||||
else:
|
else:
|
||||||
logging.info("continuing...")
|
|
||||||
# continue adding files if we havent reached big length
|
# continue adding files if we havent reached big length
|
||||||
continue
|
continue
|
||||||
# Insert any remaining data
|
# Insert any remaining data
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user