X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=rainbowstream%2Fdraw.py;h=3a63f4b8a8185ffd6371e1594d2144722ac20c4d;hb=693406483f2a8a33d7ee64b4988d6875a1950c4d;hp=535794522800236728d50a82fa9fd4877d75a9e5;hpb=38a6dc308c60aa43ad84f9ff0b9230540518ec28;p=rainbowstream.git diff --git a/rainbowstream/draw.py b/rainbowstream/draw.py index 5357945..3a63f4b 100644 --- a/rainbowstream/draw.py +++ b/rainbowstream/draw.py @@ -15,6 +15,7 @@ from .c_image import * from .colors import * from .config import * from .py3patch import * +from .emoji import * # Draw global variables dg = {} @@ -316,6 +317,7 @@ 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) except: pass @@ -460,6 +462,7 @@ def print_right_message(m): word = [wo for wo in formater.split() if '#id' in wo][0] delimiter = color_func(c['MESSAGE']['id'])(id.join(word.split('#id'))) formater = delimiter.join(formater.split(word)) + formater = emojize(formater) except Exception: printNicely(red('Wrong format in config.')) return @@ -524,6 +527,7 @@ def print_left_message(m): word = [wo for wo in formater.split() if '#id' in wo][0] delimiter = color_func(c['MESSAGE']['id'])(id.join(word.split('#id'))) formater = delimiter.join(formater.split(word)) + formater = emojize(formater) except Exception: printNicely(red('Wrong format in config.')) return @@ -589,6 +593,7 @@ def print_message(m): word = [wo for wo in formater.split() if '#id' in wo][0] delimiter = color_func(c['MESSAGE']['id'])(id.join(word.split('#id'))) formater = delimiter.join(formater.split(word)) + formater = emojize(formater) except: printNicely(red('Wrong format in config.')) return @@ -860,7 +865,7 @@ def print_event(e): 'list_user_subscribed': notify_list_user_subscribed, 'list_user_unsubscribed': notify_list_user_unsubscribed, } - event_dict[e['event']](e) + event_dict.get(e['event'], lambda *args: None)(e) def show_profile(u): @@ -1047,6 +1052,7 @@ def format_quote(tweet): formater = c['QUOTE_FORMAT'] formater = screen_name.join(formater.split('#owner')) formater = text.join(formater.split('#tweet')) + formater = emojize(formater) formater = u2str(formater) except: pass