From 83c78850da101a4a689f66fee3d8e1cf628035f1 Mon Sep 17 00:00:00 2001 From: Joseph Lee Date: Tue, 26 Jan 2021 23:22:20 -0800 Subject: [PATCH] Studio pap module/library scan: return early if library scan count is 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. --- addon/appModules/splstudio/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/addon/appModules/splstudio/__init__.py b/addon/appModules/splstudio/__init__.py index 7d390ba67..0a549ea8d 100644 --- a/addon/appModules/splstudio/__init__.py +++ b/addon/appModules/splstudio/__init__.py @@ -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)))