add reconn notice for Hangup
authorOrakaro <nhatminh_179@hotmail.com>
Sun, 21 Sep 2014 09:20:08 +0000 (18:20 +0900)
committerOrakaro <nhatminh_179@hotmail.com>
Sun, 21 Sep 2014 09:20:08 +0000 (18:20 +0900)
docs/conf.py
rainbowstream/rainbow.py
setup.py

index 12243a63472e790d1df52026debe5030f1e0623e..eafb44f450356da565a3ea78f0e6a01d926b1ff1 100644 (file)
@@ -48,9 +48,9 @@ copyright = u'2014, Vu Nhat Minh'
 # built documents.
 #
 # The short X.Y version.
-version = '1.0.6'
+version = '1.0.7'
 # The full version, including alpha/beta/rc tags.
-release = '1.0.6'
+release = '1.0.7'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
index d67be609a9378dd515025c7e06e3c5163768ee94..500c2dba3244f86b9dbdbcebf7113b19233d49a7 100644 (file)
@@ -1862,6 +1862,21 @@ def listen():
             printNicely(red('OMG something is wrong with Twitter right now.'))
 
 
+def reconn_notice():
+    """
+    Notice when Hangup or Timeout
+    """
+    guide = light_magenta("You can use ") + \
+        light_green("switch") + \
+        light_magenta(" command to return to your stream.\n")
+    guide += light_magenta("Type ") + \
+        light_green("h stream") + \
+        light_magenta(" for more details.")
+    printNicely(guide)
+    sys.stdout.write(g['decorated_name'](c['PREFIX']))
+    sys.stdout.flush()
+
+
 def stream(domain, args, name='Rainbow Stream'):
     """
     Track the stream
@@ -1905,24 +1920,21 @@ def stream(domain, args, name='Rainbow Stream'):
             if tweet is None:
                 printNicely("-- None --")
             elif tweet is Timeout:
+                # Because the stream check for each 0.3s
+                # so we shouldn't output anything here
                 if(g['stream_stop']):
                     StreamLock.release()
                     break
             elif tweet is HeartbeatTimeout:
                 printNicely("-- Heartbeat Timeout --")
-                guide = light_magenta("You can use ") + \
-                    light_green("switch") + \
-                    light_magenta(" command to return to your stream.\n")
-                guide += light_magenta("Type ") + \
-                    light_green("h stream") + \
-                    light_magenta(" for more details.")
-                printNicely(guide)
-                sys.stdout.write(g['decorated_name'](c['PREFIX']))
-                sys.stdout.flush()
+                reconn_notice()
                 StreamLock.release()
                 break
             elif tweet is Hangup:
                 printNicely("-- Hangup --")
+                reconn_notice()
+                StreamLock.release()
+                break
             elif tweet.get('text'):
                 # Check the semaphore pause and lock (stream process only)
                 if g['pause']:
index 07e5aa5a2ddfb5996047f917ec3392a107f0a7b1..dec267a4ad187e774fe7d61412a4f7e82f0125d2 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@ import os
 import os.path
 
 # Bumped version
-version = '1.0.6'
+version = '1.0.7'
 
 # Require
 install_requires = [