From: Orakaro Date: Fri, 31 Jul 2015 02:10:59 +0000 (+0900) Subject: Merge branch 'master' of github.com:DTVD/rainbowstream X-Git-Url: https://vcs.fsf.org/?p=rainbowstream.git;a=commitdiff_plain;h=36f84afdc308e4c21cd4c2d99bf3d6c3aa792074;hp=7cd92bc3eae7ff84fec3a60cb796ba3d46e1d4c9 Merge branch 'master' of github.com:DTVD/rainbowstream --- diff --git a/docs/conf.py b/docs/conf.py index aad7d31..ead3ddf 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 = '1.2.7' +version = '1.2.8' # The full version, including alpha/beta/rc tags. -release = '1.2.7' +release = '1.2.8' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/rainbowstream/c_image.py b/rainbowstream/c_image.py index 0959150..f26cfcf 100644 --- a/rainbowstream/c_image.py +++ b/rainbowstream/c_image.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from PIL import Image from os.path import join, dirname, getmtime, exists, expanduser from .config import * @@ -70,27 +71,25 @@ def image_to_display(path, start=None, length=None): i.load() width = min(w, length) height = int(float(h) * (float(width) / float(w))) - if c['HIGHER_RESOLUTION'] is False: - height //= 2 i = i.resize((width, height), Image.ANTIALIAS) height = min(height, c['IMAGE_MAX_HEIGHT']) - if c['HIGHER_RESOLUTION'] is True: - for real_y in xrange(height // 2): - sys.stdout.write(' ' * start) - for x in xrange(width): - y = real_y * 2 - p0 = i.getpixel((x, y)) - p1 = i.getpixel((x, y+1)) - block_print(p1, p0) - sys.stdout.write('\n') - else: - for y in xrange(height): - sys.stdout.write(' ' * start) - for x in xrange(width): - p = i.getpixel((x, y)) - pixel_print(p) - sys.stdout.write('\n') + for real_y in xrange(height // 2): + sys.stdout.write(' ' * start) + for x in xrange(width): + y = real_y * 2 + p0 = i.getpixel((x, y)) + p1 = i.getpixel((x, y+1)) + block_print(p1, p0) + sys.stdout.write('\n') + + # Old code for display one pixel on one terminal block + # for y in xrange(height): + # sys.stdout.write(' ' * start) + # for x in xrange(width): + # p = i.getpixel((x, y)) + # pixel_print(p) + # sys.stdout.write('\n') """ diff --git a/rainbowstream/rainbow.py b/rainbowstream/rainbow.py index bed82fb..ba91268 100644 --- a/rainbowstream/rainbow.py +++ b/rainbowstream/rainbow.py @@ -72,11 +72,6 @@ def parse_arguments(): '--color-24bit', action='store_true', help='Display images using 24bit color codes.') - parser.add_argument( - '-hr', - '--higher-resolution', - action='store_true', - help='Display images in high(er) resolution.') parser.add_argument( '-ph', '--proxy-host', @@ -186,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 ') @@ -198,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 @@ -246,9 +242,6 @@ def init(args): set_config('IMAGE_ON_TERM', str(c['IMAGE_ON_TERM'])) # Use 24 bit color c['24BIT'] = args.color_24bit - # Print images using half height blocks - c['HIGHER_RESOLUTION'] = args.higher_resolution - set_config('HIGHER_RESOLUTION', str(c['HIGHER_RESOLUTION'])) # 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.')) @@ -1741,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 @@ -1750,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: diff --git a/setup.py b/setup.py index 8e4d00f..cab2f3a 100644 --- a/setup.py +++ b/setup.py @@ -3,13 +3,13 @@ import os import os.path # Bumped version -version = '1.2.7' +version = '1.2.8' # Require install_requires = [ "python-dateutil", "arrow", - "requests", + "requests==2.5.3", "pyfiglet", "twitter", "Pillow",