summaryrefslogtreecommitdiff
path: root/9kwpyqt.py
diff options
context:
space:
mode:
Diffstat (limited to '9kwpyqt.py')
-rwxr-xr-x9kwpyqt.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/9kwpyqt.py b/9kwpyqt.py
index 7e25142..618a211 100755
--- a/9kwpyqt.py
+++ b/9kwpyqt.py
@@ -44,6 +44,7 @@ class CaptchaGUI(QWidget):
config = None # Configuration (9kwpyqt.ini)
sound = False # QSound()
timer = False # QTimer() for 30sec timing
+ soundUrgent = False # QSound() for urgent message (low time)
running = False
startCredits = None
@@ -55,6 +56,7 @@ class CaptchaGUI(QWidget):
currentWorker = 0
offlinemessage = "Click \"Start\" to fetch next captcha."
timeleft = None
+ urgentSoundPlayed = False
waitingoncaptcha = 0
@@ -348,6 +350,7 @@ class CaptchaGUI(QWidget):
# Use config settings
self.apiurl = self.config['DEFAULT']['API_URL']+"?source=pythonapi&apikey="+self.config['DEFAULT']['API_KEY']+"&"
self.sound = QSound(os.path.join(THIS_DIR, self.config['DEFAULT']['Soundfile']))
+ self.soundUrgent = QSound(os.path.join(THIS_DIR, self.config['DEFAULT']['SoundfileUrgent']))
self.soundCheckbox.setChecked( self.config.getboolean('DEFAULT', 'Sound') )
if self.config.getboolean('DEFAULT', 'Autostart'):
self.toggleRunning(force_start=True)
@@ -373,10 +376,14 @@ class CaptchaGUI(QWidget):
def onTimerTick(self):
if not self.timeleft:
self.captchaTimer.setText("...")
+ self.urgentSoundPlayed = False
self.timer.stop()
else:
timing = self.timeleft - time.time()
self.captchaTimer.setText(str(round(timing, 1))+"s")
+ if self.soundCheckbox.isChecked() and not self.urgentSoundPlayed and timing <= 10:
+ self.urgentSoundPlayed = True
+ self.soundUrgent.play()
if timing <= 0:
self.toggleRunning(force_stop=True)
self.offlinemessage = "30 seconds passed without input."