Diverse rettelser

This commit is contained in:
2026-04-25 21:28:31 +02:00
parent 8d4c4a81c1
commit 324c94fde2
6 changed files with 132 additions and 44 deletions

View File

@@ -6,9 +6,10 @@ from PyQt6.QtCore import QThread, pyqtSignal
class ScanWorker(QThread):
progress = pyqtSignal(int, int, str) # done, total, filename
finished = pyqtSignal(int, str) # antal, library_path
error = pyqtSignal(str)
progress = pyqtSignal(int, int, str) # done, total, filename
finished = pyqtSignal(int, str) # antal, library_path
error = pyqtSignal(str)
batch_ready = pyqtSignal(int) # antal sange scannet så langt
def __init__(self, library_id: int, library_path: str,
db_path: str, overwrite_bpm: bool = False):
@@ -26,11 +27,15 @@ class ScanWorker(QThread):
def run(self):
try:
from local.scanner import scan_library
self._batch_count = 0
def on_progress(done, total, filename):
if self.isInterruptionRequested():
raise InterruptedError()
self.progress.emit(done, total, filename)
self._batch_count += 1
if self._batch_count % 50 == 0:
self.batch_ready.emit(self._batch_count)
count = scan_library(
self._library_id,
@@ -44,4 +49,4 @@ class ScanWorker(QThread):
except InterruptedError:
pass
except Exception as e:
self.error.emit(str(e))
self.error.emit(str(e))