X-Git-Url: https://vcs.fsf.org/?p=rainbowstream.git;a=blobdiff_plain;f=rainbowstream%2Fdraw.py;h=a94750682dda5753ead9be7092acc3a48cad3e90;hp=429bd279220512ef7e353c2d8253941e187b6777;hb=66fe9f758d24e00cc7f4264a420e2a1507aac0af;hpb=e5455a305a891c63ab8926b95acb4d4daea2fda2 diff --git a/rainbowstream/draw.py b/rainbowstream/draw.py index 429bd27..a947506 100644 --- a/rainbowstream/draw.py +++ b/rainbowstream/draw.py @@ -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'] + client = t['source'] 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) + # Get client name + try: + client = client.split('>')[-2].split('<')[0] + except: + client = None + # 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 = emojize(formater) # 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)) - 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