Merge pull request #184 from koobs/patch-2
[rainbowstream.git] / rainbowstream / rainbow.py
index 692a4ac47294c7dc5d0cf68ed7371c98bc9b7ff4..465299f0e41b96b28694e4645f58f32cffb0357e 100644 (file)
@@ -189,12 +189,12 @@ def upgrade_center():
             notice += light_yellow(current) + '\n'
             notice += light_magenta('You should upgrade with ')
             notice += light_green('pip install -U rainbowstream')
-            printNicely(notice)
         else:
             notice = light_yellow('You are running latest version (')
             notice += light_green(current)
             notice += light_yellow(')')
             notice += '\n'
+        printNicely(notice)
     except:
         pass
 
@@ -239,11 +239,8 @@ def init(args):
     c['message_dict'] = []
     # Image on term
     c['IMAGE_ON_TERM'] = args.image_on_term
-    set_config('IMAGE_ON_TERM', str(c['IMAGE_ON_TERM']))
     # Use 24 bit color
     c['24BIT'] = args.color_24bit
-    # Resize images based on the current terminal size
-    set_config('IMAGE_RESIZE_TO_FIT', str(c.get('IMAGE_RESIZE_TO_FIT', False)))
     # Check type of ONLY_LIST and IGNORE_LIST
     if not isinstance(c['ONLY_LIST'], list):
         printNicely(red('ONLY_LIST is not a valid list value.'))
@@ -885,7 +882,7 @@ def mute():
             rel = t.mutes.users.create(screen_name=screen_name[1:])
             if isinstance(rel, dict):
                 printNicely(green(screen_name + ' is muted.'))
-                c['IGNORE_LIST'] += [unc(screen_name)]
+                c['IGNORE_LIST'] += [screen_name]
                 c['IGNORE_LIST'] = list(set(c['IGNORE_LIST']))
             else:
                 printNicely(red(rel))
@@ -1455,6 +1452,8 @@ def help_discover():
         light_green('trend JP Tokyo') + '.\n'
     usage += s * 2 + light_green('home') + ' will show your timeline. ' + \
         light_green('home 7') + ' will show 7 tweets.\n'
+    usage += s * 2 + light_green('me') + ' will show your latest tweets. ' + \
+        light_green('me 2') + ' will show your last 2 tweets.\n'
     usage += s * 2 + \
         light_green('notification') + ' will show your recent notification.\n'
     usage += s * 2 + light_green('mentions') + ' will show mentions timeline. ' + \
@@ -1506,8 +1505,6 @@ def help_tweets():
     usage += s * 2 + \
         light_green('share 12 ') + ' will get the direct link of the tweet with ' + \
         light_yellow('[id=12]') + '.\n'
-    usage += s * 2 + \
-        light_green('mytw 2 ') + ' will show your last two tweets.\n'
     usage += s * 2 + \
         light_green('del 12 ') + ' will delete tweet with ' + \
         light_yellow('[id=12]') + '.\n'
@@ -1781,7 +1778,7 @@ cmdset = [
     't',
     'rt',
     'quote',
-    'mytw',
+    'me',
     'allrt',
     'conversation',
     'fav',
@@ -1979,8 +1976,6 @@ def listen():
                 g['prefix'] = False
             else:
                 g['prefix'] = True
-            # Release the semaphore lock
-            c['lock'] = False
         except EOFError:
             printNicely('')
         except TwitterHTTPError as e:
@@ -1988,6 +1983,9 @@ def listen():
         except Exception:
             debug_option()
             printNicely(red('OMG something is wrong with Twitter API right now.'))
+        finally:
+            # Release the semaphore lock
+            c['lock'] = False
 
 
 def reconn_notice():