Added a flag to enable 24bit color output in images.
[rainbowstream.git] / rainbowstream / rainbow.py
index 9aa5d448529d2ae1c82a1811d63fe6c21c76bbda..cf25883ed5d14a5bf9de67f795b84479e753d541 100644 (file)
@@ -67,6 +67,11 @@ def parse_arguments():
         '--image-on-term',
         action='store_true',
         help='Display all image on terminal.')
+    parser.add_argument(
+        '-24',
+        '--color-24bit',
+        action='store_true',
+        help='Display images using 24bit color codes.')
     parser.add_argument(
         '-ph',
         '--proxy-host',
@@ -233,6 +238,7 @@ def init(args):
     c['message_dict'] = []
     # Image on term
     c['IMAGE_ON_TERM'] = args.image_on_term
+    c['24BIT'] = args.color_24bit
     set_config('IMAGE_ON_TERM', str(c['IMAGE_ON_TERM']))
     # Check type of ONLY_LIST and IGNORE_LIST
     if not isinstance(c['ONLY_LIST'], list):
@@ -531,7 +537,7 @@ def reply_all():
     original_tweet = t.statuses.show(id=tid)
     text = original_tweet['text']
     nick_ary = [original_tweet['user']['screen_name']]
-    for user in tweet['entities']['user_mentions']:
+    for user in list(original_tweet['entities']['user_mentions']):
         if user['screen_name'] not in nick_ary \
                 and user['screen_name'] != g['original_name']:
             nick_ary.append(user['screen_name'])
@@ -1291,7 +1297,7 @@ def switch():
             return
         # Kill old thread
         g['stream_stop'] = True
-        try: 
+        try:
             stuff = g['stuff'].split()[1]
         except:
             stuff = None
@@ -2079,7 +2085,7 @@ def stream(domain, args, name='Rainbow Stream'):
         detail_twitter_error(e)
         sys.stdout.write(g['decorated_name'](g['PREFIX']))
         sys.stdout.flush()
-    except (URLError, ConnectionResetError):
+    except (URLError):
         printNicely(
             magenta('There seems to be a connection problem.'))
         save_history()