Skip to content

Commit

Permalink
Studio/time announcer: return ealry if time is None. Re #155.
Browse files Browse the repository at this point in the history
Mypy: because time announcer is typically called from time commands after obtaining Studio API results for track duration, make sure to catch the case where time integer can be None, and if yes, return early. This change resolves type mismatch for time commands.
  • Loading branch information
josephsl committed Jan 27, 2021
1 parent 9134500 commit 48a0d4d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions addon/appModules/splstudio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,9 +1223,12 @@ def terminate(self):
# 6.0: Split this into two functions: the announcer (below) and formatter.
# 7.0: The ms (millisecond) argument will be used when announcing playlist remainder.
# 16.12: Include hours by default unless told not to do so.
# #155 (21.03): time can be None, in which case it will do nothing.
def announceTime(
self, t: int, offset: Optional[int] = None, ms: bool = True, includeHours: Optional[bool] = None
) -> None:
if t is None:
return
if t <= 0:
ui.message("00:00")
else:
Expand Down

0 comments on commit 48a0d4d

Please sign in to comment.