Skip to content

Commit

Permalink
Studio monitor: make sure library scan count and track count are not …
Browse files Browse the repository at this point in the history
…None. Re #155.

Mypy: because Studio API may return None if Studio dies, make sure this is not the case for library scan count and track count as defined in studio monitor.
  • Loading branch information
josephsl committed Jan 27, 2021
1 parent df6a348 commit 4e28d51
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions addon/appModules/splstudio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,9 @@ def studioAPIMonitor(self) -> None:
# Thankfully, current lib scan reporter function will not proceed
# when library scan is happening via Insert Tracks dialog.
# #92 (19.01.1/18.09.7-LTS): if Studio dies, zero will be returned, so check for window handle once more.
if splbase.studioAPI(1, 32) >= 0:
# #155 (21.03): library scan count must be an integer.
libScanCount: Optional[int] = splbase.studioAPI(1, 32)
if libScanCount and libScanCount >= 0:
if not user32.FindWindowW("SPLStudio", None):
return
if not self.libraryScanning:
Expand All @@ -827,7 +829,11 @@ def studioAPIMonitor(self) -> None:
if self._analysisMarker is not None:
self._analysisMarker = None
# #145 (20.09: playlist analysis marker value must be below track count.
if self._analysisMarker is not None and not 0 <= self._analysisMarker < trackCount:
# #155 (21.03): and track count must be an integer.
if (
self._analysisMarker is not None and trackCount is not None
and not 0 <= self._analysisMarker < trackCount
):
self._analysisMarker = None

# Let the global plugin know if SPLController passthrough is allowed.
Expand Down

0 comments on commit 4e28d51

Please sign in to comment.