move each playlist export into new thread
This commit is contained in:
parent
caecf63f6a
commit
98bce6458f
7
main.py
7
main.py
@ -255,8 +255,13 @@ class ApplicationWindow(QMainWindow, Ui_MainWindow):
|
||||
"SELECT id FROM playlist WHERE auto_export = true;", ()
|
||||
)
|
||||
ids = [id[0] for id in result]
|
||||
threadpool = QThreadPool()
|
||||
for id in ids:
|
||||
export_playlist_by_id(id)
|
||||
worker = Worker(export_playlist_by_id, id)
|
||||
# worker.signals.signal_finished.connect(None)
|
||||
# worker.signals.signal_progress.connect()
|
||||
threadpool.start(worker)
|
||||
# export_playlist_by_id(id)
|
||||
except Exception:
|
||||
pass
|
||||
if a0 is not None:
|
||||
|
||||
@ -60,11 +60,12 @@ def export_playlist_by_id(playlist_db_id: int) -> bool:
|
||||
artist, album = parse_artist_album(song)
|
||||
write_path = Path(path_prefix) / artist / album / song.name
|
||||
write_paths.append(str(write_path) + "\n")
|
||||
write_to_playlist_file(write_paths, auto_export_path)
|
||||
|
||||
worker = Worker(write_to_playlist_file, write_paths, auto_export_path)
|
||||
# worker = Worker(write_to_playlist_file, write_paths, auto_export_path)
|
||||
# worker.signals.signal_finished.connect(None)
|
||||
# worker.signals.signal_progress.connect()
|
||||
threadpool.start(worker)
|
||||
# threadpool.start(worker)
|
||||
return True
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user