X-Git-Url: https://vcs.fsf.org/?p=rainbowstream.git;a=blobdiff_plain;f=rainbowstream%2Frainbow.py;h=236c1b831e1c8b46688d81e3d9f3955c12ce1394;hp=2d1be923b83181ae88199ab3a53dd46f0dadfc40;hb=211e8be1e97c2583894b4bb3f9ea4d8e1f225025;hpb=ee82b293885a90d84f4c79ffb67a804ada423208 diff --git a/rainbowstream/rainbow.py b/rainbowstream/rainbow.py index 2d1be92..236c1b8 100644 --- a/rainbowstream/rainbow.py +++ b/rainbowstream/rainbow.py @@ -27,7 +27,7 @@ from .interactive import * from .c_image import * from .py3patch import * from .emoji import * -from .util import printTwitterErrors +from .util import * # Global values g = {} @@ -204,8 +204,7 @@ def init(args): name = credential['name'] if not get_config('PREFIX'): set_config('PREFIX', screen_name) - c['PREFIX'] = emojize(c['PREFIX']) - g['PREFIX'] = u2str(c['PREFIX']) + g['PREFIX'] = u2str(emojize(c['PREFIX'])) c['original_name'] = g['original_name'] = screen_name[1:] g['full_name'] = name g['decorated_name'] = lambda x: color_func( @@ -1964,7 +1963,7 @@ def reconn_notice(): light_green("h stream") + \ light_magenta(" for more details.") printNicely(guide) - sys.stdout.write(g['decorated_name'](c['PREFIX'])) + sys.stdout.write(g['decorated_name'](g['PREFIX'])) sys.stdout.flush() @@ -2053,10 +2052,10 @@ def stream(domain, args, name='Rainbow Stream'): # the 1st character of that word if current_buffer and g['cmd'] != current_buffer: sys.stdout.write( - g['decorated_name'](c['PREFIX']) + str2u(current_buffer)) + g['decorated_name'](g['PREFIX']) + current_buffer) sys.stdout.flush() elif not c['HIDE_PROMPT']: - sys.stdout.write(g['decorated_name'](c['PREFIX'])) + sys.stdout.write(g['decorated_name'](g['PREFIX'])) sys.stdout.flush() elif tweet.get('direct_message'): # Check the semaphore pause and lock (stream process only) @@ -2071,8 +2070,10 @@ def stream(domain, args, name='Rainbow Stream'): except TwitterHTTPError as e: printNicely('') printNicely( - magenta("We have maximum connection problem with twitter'stream API right now :(")) - printTwitterErrors(e) + magenta("We have connection problem with twitter'stream API right now :(")) + detail_twitter_error(e) + sys.stdout.write(g['decorated_name'](g['PREFIX'])) + sys.stdout.flush() def fly(): @@ -2088,9 +2089,8 @@ def fly(): except TwitterHTTPError as e: printNicely('') printNicely( - magenta("We have connection problem with twitter'stream API right now :(")) - printTwitterErrors(e) - printNicely(magenta("Let's try again later.")) + magenta("We have connection problem with twitter'REST API right now :(")) + detail_twitter_error(e) save_history() sys.exit() # Proxy connection problem