"""
Colorful user's timeline stream
"""
-
from __future__ import print_function
from multiprocessing import Process
+from dateutil import parser
-import os, os.path, sys,signal
-import argparse, time, datetime
+import os
+import os.path
+import sys
+import signal
+import argparse
+import time
+import datetime
from twitter.stream import TwitterStream, Timeout, HeartbeatTimeout, Hangup
from twitter.api import *
from twitter.oauth import OAuth, read_token_file
from twitter.oauth_dance import oauth_dance
from twitter.util import printNicely
-from dateutil import parser
from .colors import *
from .config import *
'q'
]
+
def draw(t, keyword=None):
"""
Draw the rainbow
t.statuses.update(status=g['stuff'])
g['prefix'] = False
+
def retweet():
"""
ReTweet
try:
id = int(g['stuff'].split()[0])
tid = db.rainbow_query(id)[0].tweet_id
- t.statuses.retweet(id=tid,include_entities=False,trim_user=True)
+ t.statuses.retweet(id=tid, include_entities=False, trim_user=True)
except:
print(red('Sorry I can\'t retweet for you.'))
g['prefix'] = False
print(red('A keyword should be a hashtag (like \'#AKB48\')'))
except:
print(red('Sorry I can\'t understand.'))
-
+
def friend():
"""
"""
usage = '''
Hi boss! I'm ready to serve you right now!
- ----------------------------------------------------
+ -------------------------------------------------------------
"home" will show your timeline. "home 7" will show 7 tweet.
"view @bob" will show your friend @bob's home.
"t oops" will tweet "oops" immediately.
"h" will show this help again.
"c" will clear the terminal.
"q" will exit.
- ----------------------------------------------------
+ -------------------------------------------------------------
Have fun and hang tight!
'''
printNicely(usage)
"""
Exit all
"""
- db.truncate()
+ os.system('rm -rf rainbow.db')
os.kill(g['stream_pid'], signal.SIGKILL)
sys.exit()
"""
return dict(zip(
cmdset,
- [home,view,tweet,retweet,reply,delete,search,friend,follower,help,clear,quit]
+ [
+ home,
+ view,
+ tweet,
+ retweet,
+ reply,
+ delete,
+ search,
+ friend,
+ follower,
+ help,
+ clear,
+ quit
+ ]
)).get(cmd, reset)
def listen():
init_interactive_shell(cmdset)
- first = True
- while True:
+ first = True
+ while True:
if g['prefix'] and not first:
line = raw_input(g['decorated_name'])
else:
# The Logo
ascii_art()
- g['stuff'] = '1'
- home()
# These arguments are optional:
stream_args = dict(
timeout=args.timeout,