From cb45dc23a95232e0a832f5576b2fc6ac4710e6ff Mon Sep 17 00:00:00 2001 From: vunhat_minh Date: Tue, 12 Aug 2014 12:48:54 +0900 Subject: [PATCH] config heartbeat-timeout to 120 --- docs/conf.py | 4 ++-- docs/index.rst | 8 +++++++- rainbowstream/colorset/config | 6 ++++-- rainbowstream/rainbow.py | 23 +++++++++++------------ setup.py | 2 +- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index e483b83..6bd0014 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,9 +48,9 @@ copyright = u'2014, Vu Nhat Minh' # built documents. # # The short X.Y version. -version = '0.7.3' +version = '0.7.4' # The full version, including alpha/beta/rc tags. -release = '0.7.3' +release = '0.7.4' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/index.rst b/docs/index.rst index 377d21f..1f4674e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -290,11 +290,17 @@ Config explanation Rainbow Stream has a config file located at ``~/.rainbow_config.json``. You can view or set a new value of every config key by ``config`` command (See **Interactive mode** section above). +- ``HEARTBEAT_TIMEOUT``: after this timeout (count by minutes), the stream will automatically hangup. + +- ``IMAGE_ON_TERM``: display tweet's image directly on terminal. + - ``THEME``: current theme. - ``ASCII_ART``: diplay your twitter name by ascii art at stream begin or not. -- ``HIDE_PROMPT``: Hide prompt after receiving a tweet or not. +- ``HIDE_PROMPT``: hide prompt after receiving a tweet or not. + +- ``PREFIX``: display string of prompt. - ``SEARCH_MAX_RECORD``: max tweets can display on 'search' command. diff --git a/rainbowstream/colorset/config b/rainbowstream/colorset/config index 086ec40..da15583 100644 --- a/rainbowstream/colorset/config +++ b/rainbowstream/colorset/config @@ -1,4 +1,6 @@ { + // After 120 minutes, the stream will automatically hangup + "HEARTBEAT_TIMEOUT" : 120, // Image on term "IMAGE_ON_TERM" : false, // Themes @@ -27,8 +29,8 @@ // Autocomplete history file name "HISTORY_FILENAME" : "completer.hist", // Image config - "IMAGE_SHIFT" : 10, - "IMAGE_MAX_HEIGHT" : 40, + "IMAGE_SHIFT" : 2, + "IMAGE_MAX_HEIGHT" : 90, // Stream config "USER_DOMAIN" : "userstream.twitter.com", "PUBLIC_DOMAIN" : "stream.twitter.com", diff --git a/rainbowstream/rainbow.py b/rainbowstream/rainbow.py index 133a31e..f1504ac 100644 --- a/rainbowstream/rainbow.py +++ b/rainbowstream/rainbow.py @@ -41,16 +41,6 @@ def parse_arguments(): '-to', '--timeout', help='Timeout for the stream (seconds).') - parser.add_argument( - '-ht', - '--heartbeat-timeout', - help='Set heartbeat timeout.', - default=90) - parser.add_argument( - '-nb', - '--no-block', - action='store_true', - help='Set stream to non-blocking.') parser.add_argument( '-tt', '--track-keywords', @@ -1692,8 +1682,8 @@ def stream(domain, args, name='Rainbow Stream'): # These arguments are optional: stream_args = dict( timeout=0.5, # To check g['stream_stop'] after each 0.5 s - block=not args.no_block, - heartbeat_timeout=args.heartbeat_timeout) + block=True, + heartbeat_timeout=c['HEARTBEAT_TIMEOUT'] * 60) # Track keyword query_args = dict() if args.track_keywords: @@ -1725,6 +1715,15 @@ def stream(domain, args, name='Rainbow Stream'): 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() elif tweet is Hangup: printNicely("-- Hangup --") elif tweet.get('text'): diff --git a/setup.py b/setup.py index 2acfb82..b81a321 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import os import os.path # Bumped version -version = '0.7.3' +version = '0.7.4' # Require install_requires = [ -- 2.25.1