Time is reset only when a sound is played #355

This commit is contained in:
Bob Mottram 2013-08-01 09:58:30 +01:00
parent dda530ca07
commit b06ee336ad
1 changed files with 3 additions and 1 deletions

View File

@ -1006,7 +1006,6 @@ class MyForm(QtGui.QMainWindow):
category is not self.SOUND_DISCONNECTED and
category is not self.SOUND_CONNECTION_GREEN):
dt = datetime.datetime.now() - self.lastSoundTime
self.lastSoundTime = datetime.datetime.now()
if dt.total_seconds() < self.maxSoundFrequencySec:
play = False
@ -1023,6 +1022,9 @@ class MyForm(QtGui.QMainWindow):
soundFilename = shared.appdata + 'sounds/green'
if soundFilename is not None and play is True:
# record the last time that a sound was played
self.lastSoundTime = datetime.datetime.now()
# if not wav then try mp3 format
if not os.path.isfile(soundFilename + '.wav'):
soundFilename = soundFilename + '.mp3'