'--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',
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 ')
notice = light_yellow('You are running latest version (')
notice += light_green(current)
notice += light_yellow(')')
- printNicely(notice)
+ notice += '\n'
except:
pass
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.'))
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
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:
c['lock'] = True
# Save cmd to global variable and call process
g['stuff'] = ' '.join(line.split()[1:])
- # Process the command
- process(cmd)()
- # Not re-display
- if cmd in ['switch', 't', 'rt', 'rep']:
- g['prefix'] = False
- else:
- g['prefix'] = True
+ # Check tweet length
+ if check_tweet_length():
+ # Process the command
+ process(cmd)()
+ # Not re-display
+ if cmd in ['switch', 't', 'rt', 'rep']:
+ g['prefix'] = False
+ else:
+ g['prefix'] = True
# Release the semaphore lock
c['lock'] = False
except EOFError:
printNicely(red('OMG something is wrong with Twitter right now.'))
+ def check_tweet_length():
+ """
+ Check tweet length (should be <= 140 chars)
+ """
+ length = len(g['stuff'])
+ if length <= 140:
+ return True
+
+ printNicely(red("Message is too long: %s chars" % length))
+ return False
+
+
def reconn_notice():
"""
Notice when Hangup or Timeout