bumped version
[rainbowstream.git] / rainbowstream / rainbow.py
index 742930e0a53f14297120a62fcf589be05d1e7b22..163a278ec66948dd3db635fc6a5e392bd531c5d7 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',
@@ -176,7 +181,8 @@ def upgrade_center():
         url = 'https://raw.githubusercontent.com/DTVD/rainbowstream/master/setup.py'
         readme = requests.get(url).text
         latest = readme.split('version = \'')[1].split('\'')[0]
-        if current != latest:
+        g['using_latest'] = current == latest
+        if not g['using_latest']:
             notice = light_magenta('RainbowStream latest version is ')
             notice += light_green(latest)
             notice += light_magenta(' while your current version is ')
@@ -188,7 +194,7 @@ def upgrade_center():
             notice = light_yellow('You are running latest version (')
             notice += light_green(current)
             notice += light_yellow(')')
-            printNicely(notice)
+            notice += '\n'
     except:
         pass
 
@@ -234,6 +240,8 @@ def init(args):
     # 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
     # 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.'))
@@ -1291,7 +1299,7 @@ def switch():
             return
         # Kill old thread
         g['stream_stop'] = True
-        try: 
+        try:
             stuff = g['stuff'].split()[1]
         except:
             stuff = None
@@ -1726,6 +1734,16 @@ def quit():
     sys.exit()
 
 
+def changelog_notify():
+    # For v1.2.8. Hardcoded here but will improve later
+    notice = light_yellow('Hey! RS just ')
+    notice += light_green('doubled ')
+    notice += light_yellow('pixels for higher image resolution. Upgrade and try')
+    notice += light_green(' -iot ')
+    notice += light_yellow('and you will like it for sure :)')
+    printNicely(notice)
+
+
 def reset():
     """
     Reset prefix of line
@@ -1735,6 +1753,8 @@ def reset():
             printNicely(red('Your ~/.rainbow_config.json is messed up:'))
             printNicely(red('>>> ' + c['USER_JSON_ERROR']))
             printNicely('')
+        if not g['using_latest']:
+            changelog_notify()
         printNicely(magenta('Need tips ? Type "h" and hit Enter key!'))
     g['reset'] = False
     try:
@@ -2079,7 +2099,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()