Update README.md
[rainbowstream.git] / rainbowstream / rainbow.py
index 664716e247be6586a068a6d7134452ca67550025..dc714e6f016db4f6c80008af60cdfd1e7a8d06cc 100644 (file)
@@ -1,6 +1,10 @@
 """
 Colorful user's timeline stream
 """
+from __future__ import print_function
+from multiprocessing import Process
+from dateutil import parser
+
 import os
 import os.path
 import sys
@@ -9,10 +13,6 @@ import argparse
 import time
 import datetime
 
-from __future__ import print_function
-from multiprocessing import Process
-from dateutil import parser
-
 from twitter.stream import TwitterStream, Timeout, HeartbeatTimeout, Hangup
 from twitter.api import *
 from twitter.oauth import OAuth, read_token_file
@@ -153,7 +153,7 @@ def get_decorated_name():
     Beginning of every line
     """
     t = Twitter(auth=authen())
-    name = '@' + t.statuses.user_timeline()[-1]['user']['screen_name']
+    name = '@' + t.account.verify_credentials()['screen_name']
     g['decorated_name'] = grey('[') + grey(name) + grey(']: ')
 
 
@@ -251,7 +251,7 @@ def search():
         if g['stuff'][0] == '#':
             rel = t.search.tweets(q=g['stuff'])['statuses']
             print('Newest', SEARCH_MAX_RECORD, 'tweet:')
-            for i in xrange(5):
+            for i in xrange(SEARCH_MAX_RECORD):
                 draw(t=rel[i], keyword=g['stuff'].strip()[1:])
             printNicely('')
         else:
@@ -322,7 +322,7 @@ def quit():
     """
     Exit all
     """
-    db.truncate()
+    os.system('rm -rf rainbow.db')
     os.kill(g['stream_pid'], signal.SIGKILL)
     sys.exit()
 
@@ -383,8 +383,6 @@ def stream():
 
     # The Logo
     ascii_art()
-    g['stuff'] = '1'
-    home()
     # These arguments are optional:
     stream_args = dict(
         timeout=args.timeout,