2 Colorful user's timeline stream
4 from multiprocessing
import Process
5 from dateutil
import parser
16 from twitter
.stream
import TwitterStream
, Timeout
, HeartbeatTimeout
, Hangup
17 from twitter
.api
import *
18 from twitter
.oauth
import OAuth
, read_token_file
19 from twitter
.oauth_dance
import oauth_dance
20 from twitter
.util
import printNicely
21 from StringIO
import StringIO
25 from .consumer
import *
26 from .interactive
import *
28 from .c_image
import *
63 def draw(t
, iot
=False, keyword
=None, fil
=[], ig
=[]):
71 screen_name
= t
['user']['screen_name']
72 name
= t
['user']['name']
73 created_at
= t
['created_at']
74 favorited
= t
['favorited']
75 date
= parser
.parse(created_at
)
76 date
= date
- datetime
.timedelta(seconds
=time
.timezone
)
77 clock
= date
.strftime('%Y/%m/%d %H:%M:%S')
83 urls
= t
['entities']['urls']
85 expanded_url
.append(u
['expanded_url'])
94 media
= t
['entities']['media']
96 media_url
.append(m
['media_url'])
101 screen_name
= '@' + screen_name
102 if fil
and screen_name
not in fil
:
104 if ig
and screen_name
in ig
:
108 res
= db
.tweet_to_rainbow_query(tid
)
111 res
= db
.tweet_to_rainbow_query(tid
)
112 rid
= res
[0].rainbow_id
115 user
= cycle_color(name
) + grey(' ' + screen_name
+ ' ')
116 meta
= grey('[' + clock
+ '] [id=' + str(rid
) + '] ')
118 meta
= meta
+ green(u
'\u2605')
122 for index
in range(len(expanded_url
)):
124 lambda x
: expanded_url
[index
] if x
== url
[index
] else x
,
127 tweet
= map(lambda x
: grey(x
) if x
== 'RT' else x
, tweet
)
128 # Highlight screen_name
129 tweet
= map(lambda x
: cycle_color(x
) if x
[0] == '@' else x
, tweet
)
131 tweet
= map(lambda x
: cyan(x
) if x
[0:4] == 'http' else x
, tweet
)
132 # Highlight search keyword
135 lambda x
: on_yellow(x
) if
136 ''.join(c
for c
in x
if c
.isalnum()).lower() == keyword
.lower()
141 tweet
= ' '.join(tweet
)
144 line1
= u
"{u:>{uw}}:".format(
148 line2
= u
"{c:>{cw}}".format(
160 if iot
and media_url
:
162 response
= requests
.get(mu
)
163 image_to_display(StringIO(response
.content
))
166 def print_message(m
):
170 sender_screen_name
= '@' + m
['sender_screen_name']
171 sender_name
= m
['sender']['name']
173 recipient_screen_name
= '@' + m
['recipient_screen_name']
174 recipient_name
= m
['recipient']['name']
176 date
= parser
.parse(m
['created_at'])
177 date
= date
- datetime
.timedelta(seconds
=time
.timezone
)
178 clock
= date
.strftime('%Y/%m/%d %H:%M:%S')
181 res
= db
.message_to_rainbow_query(mid
)
183 db
.message_store(mid
)
184 res
= db
.message_to_rainbow_query(mid
)
185 rid
= res
[0].rainbow_id
187 sender
= cycle_color(sender_name
) + grey(' ' + sender_screen_name
+ ' ')
188 recipient
= cycle_color(
189 recipient_name
) + grey(' ' + recipient_screen_name
+ ' ')
190 user
= sender
+ magenta(' >>> ') + recipient
191 meta
= grey('[' + clock
+ '] [message_id=' + str(rid
) + '] ')
192 text
= ''.join(map(lambda x
: x
+ ' ' if x
== '\n' else x
, text
))
194 line1
= u
"{u:>{uw}}:".format(
198 line2
= u
"{c:>{cw}}".format(
217 screen_name
= u
['screen_name']
218 description
= u
['description']
219 profile_image_url
= u
['profile_image_url']
220 location
= u
['location']
222 created_at
= u
['created_at']
223 statuses_count
= u
['statuses_count']
224 friends_count
= u
['friends_count']
225 followers_count
= u
['followers_count']
227 statuses_count
= green(str(statuses_count
) + ' tweets')
228 friends_count
= green(str(friends_count
) + ' following')
229 followers_count
= green(str(followers_count
) + ' followers')
230 count
= statuses_count
+ ' ' + friends_count
+ ' ' + followers_count
231 user
= cycle_color(name
) + grey(' ' + screen_name
+ ' : ') + count
232 profile_image_raw_url
= 'Profile photo: ' + cyan(profile_image_url
)
233 description
= ''.join(
234 map(lambda x
: x
+ ' ' * 4 if x
== '\n' else x
, description
))
235 description
= yellow(description
)
236 location
= 'Location : ' + magenta(location
)
237 url
= 'URL : ' + (cyan(url
) if url
else '')
238 date
= parser
.parse(created_at
)
239 date
= date
- datetime
.timedelta(seconds
=time
.timezone
)
240 clock
= date
.strftime('%Y/%m/%d %H:%M:%S')
241 clock
= 'Join at ' + white(clock
)
243 line1
= u
"{u:>{uw}}".format(
247 line2
= u
"{p:>{pw}}".format(
248 p
=profile_image_raw_url
,
249 pw
=len(profile_image_raw_url
) + 4,
251 line3
= u
"{d:>{dw}}".format(
253 dw
=len(description
) + 4,
255 line4
= u
"{l:>{lw}}".format(
257 lw
=len(location
) + 4,
259 line5
= u
"{u:>{uw}}".format(
263 line6
= u
"{c:>{cw}}".format(
271 response
= requests
.get(profile_image_url
)
272 image_to_display(StringIO(response
.content
), 2, 20)
275 for line
in [line3
, line4
, line5
, line6
]:
280 def print_trends(trends
):
284 for topic
in trends
[:TREND_MAX
]:
287 line
= cycle_color(name
) + ': ' + cyan(url
)
292 def parse_arguments():
296 parser
= argparse
.ArgumentParser(description
=__doc__
or "")
300 help='Timeout for the stream (seconds).')
303 '--heartbeat-timeout',
304 help='Set heartbeat timeout.',
310 help='Set stream to non-blocking.')
314 help='Search the stream for specific text.')
318 help='Filter specific screen_name.')
322 help='Ignore specific screen_name.')
327 help='Display all image on terminal.')
328 return parser
.parse_args()
333 Authenticate with Twitter OAuth
335 # When using rainbow stream you must authorize.
336 twitter_credential
= os
.environ
.get(
340 '')) + os
.sep
+ '.rainbow_oauth'
341 if not os
.path
.exists(twitter_credential
):
342 oauth_dance("Rainbow Stream",
346 oauth_token
, oauth_token_secret
= read_token_file(twitter_credential
)
354 def get_decorated_name():
356 Beginning of every line
358 t
= Twitter(auth
=authen())
359 name
= '@' + t
.account
.verify_credentials()['screen_name']
360 g
['original_name'] = name
[1:]
361 g
['decorated_name'] = grey('[') + grey(name
) + grey(']: ')
369 target
= g
['stuff'].split()[0]
372 args
= parse_arguments()
374 if g
['stuff'].split()[-1] == '-f':
375 only
= raw_input('Only nicks: ')
376 ignore
= raw_input('Ignore nicks: ')
377 args
.filter = filter(None, only
.split(','))
378 args
.ignore
= filter(None, ignore
.split(','))
379 elif g
['stuff'].split()[-1] == '-d':
380 args
.filter = ONLY_LIST
381 args
.ignore
= IGNORE_LIST
383 printNicely(red('Sorry, wrong format.'))
387 if target
== 'public':
388 keyword
= g
['stuff'].split()[1]
389 if keyword
[0] == '#':
390 keyword
= keyword
[1:]
392 os
.kill(g
['stream_pid'], signal
.SIGKILL
)
393 args
.track_keywords
= keyword
401 g
['stream_pid'] = p
.pid
404 elif target
== 'mine':
406 os
.kill(g
['stream_pid'], signal
.SIGKILL
)
415 g
['stream_pid'] = p
.pid
417 printNicely(green('Stream switched.'))
419 printNicely(cyan('Only: ' + str(args
.filter)))
421 printNicely(red('Ignore: ' + str(args
.ignore
)))
424 printNicely(red('Sorry I can\'t understand.'))
431 t
= Twitter(auth
=authen())
432 # Get country and town
434 country
= g
['stuff'].split()[0]
438 town
= g
['stuff'].split()[1]
442 avail
= t
.trends
.available()
445 trends
= t
.trends
.place(_id
=1)[0]['trends']
448 for location
in avail
:
449 # Search for country and Town
451 if location
['countryCode'] == country \
452 and location
['placeType']['name'] == 'Town' \
453 and location
['name'] == town
:
454 trends
= t
.trends
.place(_id
=location
['woeid'])[0]['trends']
456 # Search for country only
458 if location
['countryCode'] == country \
459 and location
['placeType']['name'] == 'Country':
460 trends
= t
.trends
.place(_id
=location
['woeid'])[0]['trends']
468 t
= Twitter(auth
=authen())
470 if g
['stuff'].isdigit():
471 num
= int(g
['stuff'])
472 for tweet
in reversed(t
.statuses
.home_timeline(count
=num
)):
473 draw(t
=tweet
, iot
=g
['iot'])
481 t
= Twitter(auth
=authen())
482 user
= g
['stuff'].split()[0]
485 num
= int(g
['stuff'].split()[1])
488 for tweet
in reversed(t
.statuses
.user_timeline(count
=num
, screen_name
=user
[1:])):
489 draw(t
=tweet
, iot
=g
['iot'])
492 printNicely(red('A name should begin with a \'@\''))
499 t
= Twitter(auth
=authen())
501 if g
['stuff'].isdigit():
502 num
= int(g
['stuff'])
503 for tweet
in reversed(t
.statuses
.mentions_timeline(count
=num
)):
504 draw(t
=tweet
, iot
=g
['iot'])
512 t
= Twitter(auth
=authen())
513 t
.statuses
.update(status
=g
['stuff'])
520 t
= Twitter(auth
=authen())
522 id = int(g
['stuff'].split()[0])
523 tid
= db
.rainbow_to_tweet_query(id)[0].tweet_id
524 t
.statuses
.retweet(id=tid
, include_entities
=False, trim_user
=True)
526 printNicely(red('Sorry I can\'t retweet for you.'))
533 t
= Twitter(auth
=authen())
535 id = int(g
['stuff'].split()[0])
536 tid
= db
.rainbow_to_tweet_query(id)[0].tweet_id
537 t
.favorites
.create(_id
=tid
, include_entities
=False)
538 printNicely(green('Favorited.'))
539 draw(t
.statuses
.show(id=tid
), iot
=g
['iot'])
542 printNicely(red('Omg some syntax is wrong.'))
549 t
= Twitter(auth
=authen())
551 id = int(g
['stuff'].split()[0])
552 tid
= db
.rainbow_to_tweet_query(id)[0].tweet_id
553 user
= t
.statuses
.show(id=tid
)['user']['screen_name']
554 status
= ' '.join(g
['stuff'].split()[1:])
555 status
= '@' + user
+ ' ' + status
.decode('utf-8')
556 t
.statuses
.update(status
=status
, in_reply_to_status_id
=tid
)
558 printNicely(red('Sorry I can\'t understand.'))
565 t
= Twitter(auth
=authen())
567 rid
= int(g
['stuff'].split()[0])
568 tid
= db
.rainbow_to_tweet_query(rid
)[0].tweet_id
569 t
.statuses
.destroy(id=tid
)
570 printNicely(green('Okay it\'s gone.'))
572 printNicely(red('Sorry I can\'t understand.'))
579 t
= Twitter(auth
=authen())
581 id = int(g
['stuff'].split()[0])
582 tid
= db
.rainbow_to_tweet_query(id)[0].tweet_id
583 t
.favorites
.destroy(_id
=tid
)
584 printNicely(green('Okay it\'s unfavorited.'))
585 draw(t
.statuses
.show(id=tid
), iot
=g
['iot'])
588 printNicely(red('Sorry I can\'t unfavorite this tweet for you.'))
595 t
= Twitter(auth
=authen())
597 if g
['stuff'][0] == '#':
598 rel
= t
.search
.tweets(q
=g
['stuff'])['statuses']
600 printNicely('Newest tweets:')
601 for i
in reversed(xrange(SEARCH_MAX_RECORD
)):
604 keyword
=g
['stuff'].strip()[1:])
607 printNicely(magenta('I\'m afraid there is no result'))
609 printNicely(red('A keyword should be a hashtag (like \'#AKB48\')'))
611 printNicely(red('Sorry I can\'t understand.'))
616 Send a direct message
618 t
= Twitter(auth
=authen())
619 user
= g
['stuff'].split()[0]
622 content
= g
['stuff'].split()[1]
623 t
.direct_messages
.new(
624 screen_name
=user
[1:],
627 printNicely(green('Message sent.'))
629 printNicely(red('Sorry I can\'t understand.'))
631 printNicely(red('A name should begin with a \'@\''))
638 t
= Twitter(auth
=authen())
640 target
= g
['stuff'].split()[0]
641 if target
!= 'image':
643 id = int(g
['stuff'].split()[1])
644 tid
= db
.rainbow_to_tweet_query(id)[0].tweet_id
645 tweet
= t
.statuses
.show(id=tid
)
646 media
= tweet
['entities']['media']
648 res
= requests
.get(m
['media_url'])
649 img
= Image
.open(StringIO(res
.content
))
652 printNicely(red('Sorry I can\'t show this image.'))
657 List friends for followers
659 t
= Twitter(auth
=authen())
662 name
= g
['stuff'].split()[1]
666 printNicely(red('A name should begin with a \'@\''))
667 raise Exception('Invalid name')
669 name
= g
['original_name']
670 # Get list followers or friends
672 target
= g
['stuff'].split()[0]
673 d
= {'fl': 'followers', 'fr': 'friends'}
677 while next_cursor
!= 0:
678 list = getattr(t
, d
[target
]).list(
682 include_entities
=False,
684 for u
in list['users']:
685 rel
[u
['name']] = '@' + u
['screen_name']
686 next_cursor
= list['next_cursor']
688 printNicely('All: ' + str(len(rel
)) + ' people.')
690 user
= ' ' + cycle_color(name
) + grey(' ' + rel
[name
] + ' ')
693 printNicely(red('Omg some syntax is wrong.'))
698 Inbox direct messages
700 t
= Twitter(auth
=authen())
701 num
= MESSAGES_DISPLAY
703 if g
['stuff'].isdigit():
706 # Max message per page is 20 so we have to loop
708 rel
= rel
+ t
.direct_messages(
711 include_entities
=False,
716 rel
= rel
+ t
.direct_messages(
719 include_entities
=False,
723 printNicely('Inbox: newest ' + str(len(rel
)) + ' messages.')
724 for m
in reversed(rel
):
733 t
= Twitter(auth
=authen())
734 num
= MESSAGES_DISPLAY
736 if g
['stuff'].isdigit():
737 num
= int(g
['stuff'])
739 # Max message per page is 20 so we have to loop
741 rel
= rel
+ t
.direct_messages
.sent(
744 include_entities
=False,
749 rel
= rel
+ t
.direct_messages
.sent(
752 include_entities
=False,
756 printNicely('Sent: newest ' + str(len(rel
)) + ' messages.')
757 for m
in reversed(rel
):
766 t
= Twitter(auth
=authen())
768 rid
= int(g
['stuff'].split()[0])
769 mid
= db
.rainbow_to_message_query(rid
)[0].message_id
770 t
.direct_messages
.destroy(id=mid
)
771 printNicely(green('Message deleted.'))
773 printNicely(red('Sorry I can\'t understand.'))
778 Show profile of a specific user
780 t
= Twitter(auth
=authen())
781 screen_name
= g
['stuff'].split()[0]
782 if screen_name
[0] == '@':
785 screen_name
=screen_name
[1:],
786 include_entities
=False)
789 printNicely(red('Omg no user.'))
791 printNicely(red('Sorry I can\'t understand.'))
798 t
= Twitter(auth
=authen())
799 screen_name
= g
['stuff'].split()[0]
800 if screen_name
[0] == '@':
802 t
.friendships
.create(screen_name
=screen_name
[1:], follow
=True)
803 printNicely(green('You are following ' + screen_name
+ ' now!'))
805 printNicely(red('Sorry can not follow at this time.'))
807 printNicely(red('Sorry I can\'t understand.'))
814 t
= Twitter(auth
=authen())
815 screen_name
= g
['stuff'].split()[0]
816 if screen_name
[0] == '@':
818 t
.friendships
.destroy(
819 screen_name
=screen_name
[1:],
820 include_entities
=False)
821 printNicely(green('Unfollow ' + screen_name
+ ' success!'))
823 printNicely(red('Sorry can not unfollow at this time.'))
825 printNicely(red('Sorry I can\'t understand.'))
832 t
= Twitter(auth
=authen())
833 screen_name
= g
['stuff'].split()[0]
834 if screen_name
[0] == '@':
837 screen_name
=screen_name
[1:],
838 include_entities
=False,
840 printNicely(green('You blocked ' + screen_name
+ '.'))
842 printNicely(red('Sorry something went wrong.'))
844 printNicely(red('Sorry I can\'t understand.'))
851 t
= Twitter(auth
=authen())
852 screen_name
= g
['stuff'].split()[0]
853 if screen_name
[0] == '@':
856 screen_name
=screen_name
[1:],
857 include_entities
=False,
859 printNicely(green('Unblock ' + screen_name
+ ' success!'))
861 printNicely(red('Sorry something went wrong.'))
863 printNicely(red('Sorry I can\'t understand.'))
868 Report a user as a spam account
870 t
= Twitter(auth
=authen())
871 screen_name
= g
['stuff'].split()[0]
872 if screen_name
[0] == '@':
875 screen_name
=screen_name
[1:])
876 printNicely(green('You reported ' + screen_name
+ '.'))
878 printNicely(red('Sorry something went wrong.'))
880 printNicely(red('Sorry I can\'t understand.'))
888 h
, w
= os
.popen('stty size', 'r').read().split()
891 usage
+= s
+ 'Hi boss! I\'m ready to serve you right now!\n'
892 usage
+= s
+ '-' * (int(w
) - 4) + '\n'
893 usage
+= s
+ 'You are ' + yellow('already') + ' on your personal stream.\n'
895 usage
+= s
* 2 + green('trend') + ' will show global trending topics. ' + \
896 'You can try ' + green('trend US') + ' or ' + \
897 green('trend JP Tokyo') + '.\n'
898 usage
+= s
* 2 + green('home') + ' will show your timeline. ' + \
899 green('home 7') + ' will show 7 tweets.\n'
900 usage
+= s
* 2 + green('view @mdo') + \
901 ' will show ' + magenta('@mdo') + '\'s home.\n'
902 usage
+= s
* 2 + green('mentions') + ' will show mentions timeline. ' + \
903 green('mentions 7') + ' will show 7 mention tweets.\n'
904 usage
+= s
* 2 + green('t oops ') + \
905 'will tweet "' + yellow('oops') + '" immediately.\n'
907 green('rt 12 ') + ' will retweet to tweet with ' + \
908 yellow('[id=12]') + '.\n'
910 green('fav 12 ') + ' will favorite the tweet with ' + \
911 yellow('[id=12]') + '.\n'
912 usage
+= s
* 2 + green('rep 12 oops') + ' will reply "' + \
913 yellow('oops') + '" to tweet with ' + yellow('[id=12]') + '.\n'
915 green('del 12 ') + ' will delete tweet with ' + \
916 yellow('[id=12]') + '.\n'
918 green('ufav 12 ') + ' will unfavorite tweet with ' + \
919 yellow('[id=12]') + '.\n'
920 usage
+= s
* 2 + green('s #AKB48') + ' will search for "' + \
921 yellow('AKB48') + '" and return 5 newest tweet.\n'
922 usage
+= s
* 2 + green('mes @dtvd88 hi') + ' will send a "hi" messege to ' + \
923 magenta('@dtvd88') + '.\n'
924 usage
+= s
* 2 + green('show image 12') + ' will show image in tweet with ' + \
925 yellow('[id=12]') + ' in your OS\'s image viewer.\n'
928 ' will list all followers (people who are following you).\n'
931 ' will list all friends (people who you are following).\n'
932 usage
+= s
* 2 + green('inbox') + ' will show inbox messages. ' + \
933 green('inbox 7') + ' will show newest 7 messages.\n'
934 usage
+= s
* 2 + green('sent') + ' will show sent messages. ' + \
935 green('sent 7') + ' will show newest 7 messages.\n'
936 usage
+= s
* 2 + green('trash 5') + ' will remove message with ' + \
937 yellow('[message_id=5]') + '.\n'
938 usage
+= s
* 2 + green('whois @dtvd88') + ' will show profile of ' + \
939 magenta('@dtvd88') + '.\n'
940 usage
+= s
* 2 + green('fl @dtvd88') + ' will follow ' + \
941 magenta('@dtvd88') + '.\n'
942 usage
+= s
* 2 + green('ufl @dtvd88') + ' will unfollow ' + \
943 magenta('@dtvd88') + '.\n'
944 usage
+= s
* 2 + green('block @dtvd88') + ' will block ' + \
945 magenta('@dtvd88') + '.\n'
946 usage
+= s
* 2 + green('unblock @dtvd88') + ' will unblock ' + \
947 magenta('@dtvd88') + '.\n'
948 usage
+= s
* 2 + green('report @dtvd88') + ' will report ' + \
949 magenta('@dtvd88') + ' as a spam account.\n'
950 usage
+= s
* 2 + green('h') + ' will show this help again.\n'
951 usage
+= s
* 2 + green('c') + ' will clear the screen.\n'
952 usage
+= s
* 2 + green('q') + ' will quit.\n'
954 usage
+= s
+ 'For switching streams: \n'
955 usage
+= s
* 2 + green('switch public #AKB') + \
956 ' will switch to public stream and follow "' + \
957 yellow('AKB') + '" keyword.\n'
958 usage
+= s
* 2 + green('switch mine') + \
959 ' will switch to your personal stream.\n'
960 usage
+= s
* 2 + green('switch mine -f ') + \
961 ' will prompt to enter the filter.\n'
962 usage
+= s
* 3 + yellow('Only nicks') + \
963 ' filter will decide nicks will be INCLUDE ONLY.\n'
964 usage
+= s
* 3 + yellow('Ignore nicks') + \
965 ' filter will decide nicks will be EXCLUDE.\n'
966 usage
+= s
* 2 + green('switch mine -d') + \
967 ' will use the config\'s ONLY_LIST and IGNORE_LIST.\n'
968 usage
+= s
* 3 + '(see ' + grey('rainbowstream/config.py') + ').\n'
970 usage
+= s
+ '-' * (int(w
) - 4) + '\n'
971 usage
+= s
+ 'Have fun and hang tight!\n'
987 os
.system('rm -rf rainbow.db')
988 os
.kill(g
['stream_pid'], signal
.SIGKILL
)
997 printNicely(magenta('Need tips ? Type "h" and hit Enter key!'))
1041 Listen to user's input
1046 ['public', 'mine'], # switch
1059 ['image'], # show image
1060 ['fl', 'fr'], # list
1075 init_interactive_shell(d
)
1080 line
= raw_input(g
['decorated_name'])
1084 cmd
= line
.split()[0]
1087 # Save cmd to global variable and call process
1088 g
['stuff'] = ' '.join(line
.split()[1:])
1090 if cmd
in ['switch', 't', 'rt', 'rep']:
1096 def stream(domain
, args
, name
='Rainbow Stream'):
1104 PUBLIC_DOMAIN
: args
.track_keywords
,
1105 SITE_DOMAIN
: 'Site Stream',
1107 ascii_art(art_dict
[domain
])
1109 # These arguments are optional:
1111 timeout
=args
.timeout
,
1112 block
=not args
.no_block
,
1113 heartbeat_timeout
=args
.heartbeat_timeout
)
1117 if args
.track_keywords
:
1118 query_args
['track'] = args
.track_keywords
1121 stream
= TwitterStream(
1126 if domain
== USER_DOMAIN
:
1127 tweet_iter
= stream
.user(**query_args
)
1128 elif domain
== SITE_DOMAIN
:
1129 tweet_iter
= stream
.site(**query_args
)
1131 if args
.track_keywords
:
1132 tweet_iter
= stream
.statuses
.filter(**query_args
)
1134 tweet_iter
= stream
.statuses
.sample()
1136 # Iterate over the stream.
1137 for tweet
in tweet_iter
:
1139 printNicely("-- None --")
1140 elif tweet
is Timeout
:
1141 printNicely("-- Timeout --")
1142 elif tweet
is HeartbeatTimeout
:
1143 printNicely("-- Heartbeat Timeout --")
1144 elif tweet
is Hangup
:
1145 printNicely("-- Hangup --")
1146 elif tweet
.get('text'):
1149 iot
=args
.image_on_term
,
1150 keyword
=args
.track_keywords
,
1160 # Spawn stream process
1161 args
= parse_arguments()
1162 get_decorated_name()
1163 p
= Process(target
=stream
, args
=(USER_DOMAIN
, args
, g
['original_name']))
1166 # Start listen process
1170 g
['stream_pid'] = p
.pid
1171 g
['iot'] = args
.image_on_term