reset PREFIX after switch stream
[rainbowstream.git] / rainbowstream / draw.py
index 429bd27..a947506 100644 (file)
@@ -190,6 +190,7 @@ def draw(t, keyword=None, humanize=True, noti=False, fil=[], ig=[]):
     favorited = t['favorited']
     retweet_count = t['retweet_count']
     favorite_count = t['favorite_count']
     favorited = t['favorited']
     retweet_count = t['retweet_count']
     favorite_count = t['favorite_count']
+    client = t['source']
     date = parser.parse(created_at)
     try:
         clock_format = c['FORMAT']['TWEET']['CLOCK_FORMAT']
     date = parser.parse(created_at)
     try:
         clock_format = c['FORMAT']['TWEET']['CLOCK_FORMAT']
@@ -215,6 +216,12 @@ def draw(t, keyword=None, humanize=True, noti=False, fil=[], ig=[]):
     # Unescape HTML character
     text = unescape(text)
 
     # Unescape HTML character
     text = unescape(text)
 
+    # Get client name
+    try:
+        client = client.split('>')[-2].split('<')[0]
+    except:
+        client = None
+
     # Get expanded url
     try:
         expanded_url = []
     # Get expanded url
     try:
         expanded_url = []
@@ -321,6 +328,7 @@ def draw(t, keyword=None, humanize=True, noti=False, fil=[], ig=[]):
         formater = nick.join(formater.split('#nick'))
         formater = fav.join(formater.split('#fav'))
         formater = tweet.join(formater.split('#tweet'))
         formater = nick.join(formater.split('#nick'))
         formater = fav.join(formater.split('#fav'))
         formater = tweet.join(formater.split('#tweet'))
+        formater = emojize(formater)
         # Change clock word
         word = [wo for wo in formater.split() if '#clock' in wo][0]
         delimiter = color_func(c['TWEET']['clock'])(
         # Change clock word
         word = [wo for wo in formater.split() if '#clock' in wo][0]
         delimiter = color_func(c['TWEET']['clock'])(
@@ -340,7 +348,11 @@ def draw(t, keyword=None, humanize=True, noti=False, fil=[], ig=[]):
         delimiter = color_func(c['TWEET']['favorite_count'])(
             str(favorite_count).join(word.split('#fa_count')))
         formater = delimiter.join(formater.split(word))
         delimiter = color_func(c['TWEET']['favorite_count'])(
             str(favorite_count).join(word.split('#fa_count')))
         formater = delimiter.join(formater.split(word))
-        formater = emojize(formater)
+        # Change client word
+        word = [wo for wo in formater.split() if '#client' in wo][0]
+        delimiter = color_func(c['TWEET']['client'])(
+            client.join(word.split('#client')))
+        formater = delimiter.join(formater.split(word))
     except:
         pass
 
     except:
         pass