diff options
Diffstat (limited to 'abcontroller.py')
-rw-r--r-- | abcontroller.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/abcontroller.py b/abcontroller.py index 3604a85..5c9bda7 100644 --- a/abcontroller.py +++ b/abcontroller.py @@ -5,7 +5,7 @@ _AB = namedtuple("_AB", ["a", "b"]) class ABController: def __init__(self, enabled=True, callback=None): self._setPositionCallback = callback - self._limits = dict() # dictionary of all songs + self._limits = {} # dictionary of all songs self._songLimits = None # list of limits for selected song self._currentLimits = _AB(0.0, 0.0) # a/b positions of active limit self._loadedIndex = None @@ -13,7 +13,7 @@ class ABController: def _ensureSongExists(self, path): if path not in self._limits: - self._limits[path] = list() + self._limits[path] = [] def setCurrentSong(self, path): self._ensureSongExists(path) @@ -35,7 +35,7 @@ class ABController: def loadLimits(self, index): if not self._songLimits: return - + if index >= 0 and index < len(self._songLimits): self._currentLimits = self._songLimits[index] self._loadedIndex = index @@ -76,4 +76,3 @@ class ABController: def clear(self): self.__init__(enabled=self._enabled, callback=self._setPositionCallback) - |