Skip to content

Commit

Permalink
Studio pap module/library scan: return early if library scan count is…
Browse files Browse the repository at this point in the history
… None before entering monitor loop. Re #155.

Before entering library scan monitor loop, make sure library scan count is not None. This is now done earlier so that nitial library scan reporter can exit early if lib scan count is indeed None and also to ensure that subsequent reference to lib scan count is seen as an integer.
  • Loading branch information
josephsl committed Jan 27, 2021
1 parent 0b221fd commit 83c7885
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions addon/appModules/splstudio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1696,15 +1696,19 @@ def monitorLibraryScan(self) -> None:
self.libraryScanning = False
return
time.sleep(0.1)
# Is library scan count still an integer?
libScanCount = splbase.studioAPI(1, 32)
if (
api.getForegroundObject().windowClassName == "TTrackInsertForm"
and self.productVersion in noLibScanMonitor
libScanCount is None
or (
api.getForegroundObject().windowClassName == "TTrackInsertForm"
and self.productVersion in noLibScanMonitor
)
):
self.libraryScanning = False
return
# 17.04: Library scan may have finished while this thread was sleeping.
libScanCount = splbase.studioAPI(1, 32)
if libScanCount is not None and libScanCount < 0:
if libScanCount < 0:
self.libraryScanning = False
# Translators: Presented when library scanning is finished.
ui.message(_("{itemCount} items in the library").format(itemCount=splbase.studioAPI(0, 32)))
Expand Down

0 comments on commit 83c7885

Please sign in to comment.