From 841260feb5d0bc4d556b3fab34d2f7efbeb78a51 Mon Sep 17 00:00:00 2001 From: vunhat_minh Date: Fri, 5 Sep 2014 12:47:40 +0900 Subject: [PATCH] Mac emoji support --- docs/conf.py | 4 +- rainbowstream/draw.py | 6 + rainbowstream/emoji.py | 910 +++++++++++++++++++++++++++++++++++++++ rainbowstream/rainbow.py | 2 + setup.py | 2 +- 5 files changed, 921 insertions(+), 3 deletions(-) create mode 100644 rainbowstream/emoji.py diff --git a/docs/conf.py b/docs/conf.py index caec26b..2dc6498 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,9 +48,9 @@ copyright = u'2014, Vu Nhat Minh' # built documents. # # The short X.Y version. -version = '0.9.8' +version = '0.9.9' # The full version, including alpha/beta/rc tags. -release = '0.9.8' +release = '0.9.9' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/rainbowstream/draw.py b/rainbowstream/draw.py index 767c9d5..202b629 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 @@ -1054,6 +1059,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 diff --git a/rainbowstream/emoji.py b/rainbowstream/emoji.py new file mode 100644 index 0000000..b6edd83 --- /dev/null +++ b/rainbowstream/emoji.py @@ -0,0 +1,910 @@ +# This file is based on emoji (https:://github.com/kyokomi/emoji). +# and (https://github.com/carpedm20/emoji) +# +# The MIT License (MIT) +# +# Copyright (c) 2014 kyokomi +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions:: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +import re + +emojiCodeDict = { + "::capricorn::": u"\U00002651", + "::end::": u"\U0001f51a", + "::no_mobile_phones::": u"\U0001f4f5", + "::couple::": u"\U0001f46b", + "::snowman::": u"\U000026c4", + "::sunrise_over_mountains::": u"\U0001f304", + "::suspension_railway::": u"\U0001f69f", + "::arrows_counterclockwise::": u"\U0001f504", + "::bug::": u"\U0001f41b", + "::confused::": u"\U0001f615", + "::dress::": u"\U0001f457", + "::honeybee::": u"\U0001f41d", + "::waning_crescent_moon::": u"\U0001f318", + "::balloon::": u"\U0001f388", + "::bus::": u"\U0001f68c", + "::package::": u"\U0001f4e6", + "::pencil2::": u"\U0000270f", + "::rage::": u"\U0001f621", + "::space_invader::": u"\U0001f47e", + "::white_medium_small_square::": u"\U000025fd", + "::fast_forward::": u"\U000023e9", + "::rice_cracker::": u"\U0001f358", + "::incoming_envelope::": u"\U0001f4e8", + "::sa::": u"\U0001f202", + "::womens::": u"\U0001f6ba", + "::arrow_right::": u"\U000027a1", + "::construction_worker::": u"\U0001f477", + "::notes::": u"\U0001f3b6", + "::goat::": u"\U0001f410", + "::grey_question::": u"\U00002754", + "::lantern::": u"\U0001f3ee", + "::rice_scene::": u"\U0001f391", + "::running::": u"\U0001f3c3", + "::ferris_wheel::": u"\U0001f3a1", + "::musical_score::": u"\U0001f3bc", + "::sparkle::": u"\U00002747", + "::wink::": u"\U0001f609", + "::art::": u"\U0001f3a8", + "::clock330::": u"\U0001f55e", + "::minidisc::": u"\U0001f4bd", + "::no_entry_sign::": u"\U0001f6ab", + "::wind_chime::": u"\U0001f390", + "::cyclone::": u"\U0001f300", + "::herb::": u"\U0001f33f", + "::leopard::": u"\U0001f406", + "::banana::": u"\U0001f34c", + "::handbag::": u"\U0001f45c", + "::honey_pot::": u"\U0001f36f", + "::ok::": u"\U0001f197", + "::hearts::": u"\U00002665", + "::passport_control::": u"\U0001f6c2", + "::moyai::": u"\U0001f5ff", + "::smile::": u"\U0001f604", + "::tiger2::": u"\U0001f405", + "::twisted_rightwards_arrows::": u"\U0001f500", + "::children_crossing::": u"\U0001f6b8", + "::cow::": u"\U0001f42e", + "::point_up::": u"\U0000261d", + "::house::": u"\U0001f3e0", + "::man_with_turban::": u"\U0001f473", + "::mountain_railway::": u"\U0001f69e", + "::vibration_mode::": u"\U0001f4f3", + "::blowfish::": u"\U0001f421", + "::it::": u"\U0001f1ee\U0001f1f9", + "::oden::": u"\U0001f362", + "::clock3::": u"\U0001f552", + "::lollipop::": u"\U0001f36d", + "::train::": u"\U0001f68b", + "::scissors::": u"\U00002702", + "::triangular_ruler::": u"\U0001f4d0", + "::wedding::": u"\U0001f492", + "::flashlight::": u"\U0001f526", + "::secret::": u"\U00003299", + "::sushi::": u"\U0001f363", + "::blue_car::": u"\U0001f699", + "::cd::": u"\U0001f4bf", + "::milky_way::": u"\U0001f30c", + "::mortar_board::": u"\U0001f393", + "::crown::": u"\U0001f451", + "::speech_balloon::": u"\U0001f4ac", + "::bento::": u"\U0001f371", + "::grey_exclamation::": u"\U00002755", + "::hotel::": u"\U0001f3e8", + "::keycap_ten::": u"\U0001f51f", + "::newspaper::": u"\U0001f4f0", + "::outbox_tray::": u"\U0001f4e4", + "::racehorse::": u"\U0001f40e", + "::laughing::": u"\U0001f606", + "::black_large_square::": u"\U00002b1b", + "::books::": u"\U0001f4da", + "::eight_spoked_asterisk::": u"\U00002733", + "::heavy_check_mark::": u"\U00002714", + "::m::": u"\U000024c2", + "::wave::": u"\U0001f44b", + "::bicyclist::": u"\U0001f6b4", + "::cocktail::": u"\U0001f378", + "::european_castle::": u"\U0001f3f0", + "::point_down::": u"\U0001f447", + "::tokyo_tower::": u"\U0001f5fc", + "::battery::": u"\U0001f50b", + "::dancer::": u"\U0001f483", + "::repeat::": u"\U0001f501", + "::ru::": u"\U0001f1f7\U0001f1fa", + "::new_moon::": u"\U0001f311", + "::church::": u"\U000026ea", + "::date::": u"\U0001f4c5", + "::earth_americas::": u"\U0001f30e", + "::footprints::": u"\U0001f463", + "::libra::": u"\U0000264e", + "::mountain_cableway::": u"\U0001f6a0", + "::small_red_triangle_down::": u"\U0001f53b", + "::top::": u"\U0001f51d", + "::sunglasses::": u"\U0001f60e", + "::abcd::": u"\U0001f521", + "::cl::": u"\U0001f191", + "::ski::": u"\U0001f3bf", + "::book::": u"\U0001f4d6", + "::hourglass_flowing_sand::": u"\U000023f3", + "::stuck_out_tongue_closed_eyes::": u"\U0001f61d", + "::cold_sweat::": u"\U0001f630", + "::headphones::": u"\U0001f3a7", + "::confetti_ball::": u"\U0001f38a", + "::gemini::": u"\U0000264a", + "::new::": u"\U0001f195", + "::pray::": u"\U0001f64f", + "::watch::": u"\U0000231a", + "::coffee::": u"\U00002615", + "::ghost::": u"\U0001f47b", + "::on::": u"\U0001f51b", + "::pouch::": u"\U0001f45d", + "::taxi::": u"\U0001f695", + "::hocho::": u"\U0001f52a", + "::yum::": u"\U0001f60b", + "::heavy_plus_sign::": u"\U00002795", + "::tada::": u"\U0001f389", + "::arrow_heading_down::": u"\U00002935", + "::clock530::": u"\U0001f560", + "::poultry_leg::": u"\U0001f357", + "::elephant::": u"\U0001f418", + "::gb::": u"\U0001f1ec\U0001f1e7", + "::mahjong::": u"\U0001f004", + "::rice::": u"\U0001f35a", + "::musical_note::": u"\U0001f3b5", + "::beginner::": u"\U0001f530", + "::small_red_triangle::": u"\U0001f53a", + "::tomato::": u"\U0001f345", + "::clock1130::": u"\U0001f566", + "::japanese_castle::": u"\U0001f3ef", + "::sun_with_face::": u"\U0001f31e", + "::four::": u"\U00000034\U000020e3", + "::microphone::": u"\U0001f3a4", + "::tennis::": u"\U0001f3be", + "::arrow_up_down::": u"\U00002195", + "::cn::": u"\U0001f1e8\U0001f1f3", + "::horse_racing::": u"\U0001f3c7", + "::no_bicycles::": u"\U0001f6b3", + "::snail::": u"\U0001f40c", + "::free::": u"\U0001f193", + "::beetle::": u"\U0001f41e", + "::black_small_square::": u"\U000025aa", + "::file_folder::": u"\U0001f4c1", + "::hushed::": u"\U0001f62f", + "::skull::": u"\U0001f480", + "::ab::": u"\U0001f18e", + "::rocket::": u"\U0001f680", + "::sweet_potato::": u"\U0001f360", + "::guitar::": u"\U0001f3b8", + "::poodle::": u"\U0001f429", + "::tulip::": u"\U0001f337", + "::large_orange_diamond::": u"\U0001f536", + "::-1::": u"\U0001f44e", + "::chart_with_upwards_trend::": u"\U0001f4c8", + "::de::": u"\U0001f1e9\U0001f1ea", + "::grapes::": u"\U0001f347", + "::ideograph_advantage::": u"\U0001f250", + "::japanese_ogre::": u"\U0001f479", + "::telephone::": u"\U0000260e", + "::clock230::": u"\U0001f55d", + "::hourglass::": u"\U0000231b", + "::leftwards_arrow_with_hook::": u"\U000021a9", + "::sparkler::": u"\U0001f387", + "::black_joker::": u"\U0001f0cf", + "::clock730::": u"\U0001f562", + "::first_quarter_moon_with_face::": u"\U0001f31b", + "::man::": u"\U0001f468", + "::clock4::": u"\U0001f553", + "::fishing_pole_and_fish::": u"\U0001f3a3", + "::tophat::": u"\U0001f3a9", + "::white_medium_square::": u"\U000025fb", + "::mega::": u"\U0001f4e3", + "::spaghetti::": u"\U0001f35d", + "::dart::": u"\U0001f3af", + "::girl::": u"\U0001f467", + "::womans_hat::": u"\U0001f452", + "::bullettrain_front::": u"\U0001f685", + "::department_store::": u"\U0001f3ec", + "::heartbeat::": u"\U0001f493", + "::palm_tree::": u"\U0001f334", + "::swimmer::": u"\U0001f3ca", + "::yellow_heart::": u"\U0001f49b", + "::arrow_upper_right::": u"\U00002197", + "::clock2::": u"\U0001f551", + "::high_heel::": u"\U0001f460", + "::arrow_double_up::": u"\U000023eb", + "::cry::": u"\U0001f622", + "::dvd::": u"\U0001f4c0", + "::e-mail::": u"\U0001f4e7", + "::baby_bottle::": u"\U0001f37c", + "::cool::": u"\U0001f192", + "::floppy_disk::": u"\U0001f4be", + "::iphone::": u"\U0001f4f1", + "::minibus::": u"\U0001f690", + "::rooster::": u"\U0001f413", + "::three::": u"\U00000033\U000020e3", + "::white_small_square::": u"\U000025ab", + "::cancer::": u"\U0000264b", + "::question::": u"\U00002753", + "::sake::": u"\U0001f376", + "::birthday::": u"\U0001f382", + "::dog2::": u"\U0001f415", + "::loudspeaker::": u"\U0001f4e2", + "::arrow_up_small::": u"\U0001f53c", + "::camel::": u"\U0001f42b", + "::koala::": u"\U0001f428", + "::mag_right::": u"\U0001f50e", + "::soccer::": u"\U000026bd", + "::bike::": u"\U0001f6b2", + "::ear_of_rice::": u"\U0001f33e", + "::shit::": u"\U0001f4a9", + "::u7981::": u"\U0001f232", + "::bath::": u"\U0001f6c0", + "::baby::": u"\U0001f476", + "::lock_with_ink_pen::": u"\U0001f50f", + "::necktie::": u"\U0001f454", + "::bikini::": u"\U0001f459", + "::blush::": u"\U0001f60a", + "::heartpulse::": u"\U0001f497", + "::pig_nose::": u"\U0001f43d", + "::straight_ruler::": u"\U0001f4cf", + "::u6e80::": u"\U0001f235", + "::gift::": u"\U0001f381", + "::traffic_light::": u"\U0001f6a5", + "::hibiscus::": u"\U0001f33a", + "::couple_with_heart::": u"\U0001f491", + "::pushpin::": u"\U0001f4cc", + "::u6709::": u"\U0001f236", + "::walking::": u"\U0001f6b6", + "::grinning::": u"\U0001f600", + "::hash::": u"\U00000023\U000020e3", + "::radio_button::": u"\U0001f518", + "::raised_hand::": u"\U0000270b", + "::shaved_ice::": u"\U0001f367", + "::barber::": u"\U0001f488", + "::cat::": u"\U0001f431", + "::heavy_exclamation_mark::": u"\U00002757", + "::ice_cream::": u"\U0001f368", + "::mask::": u"\U0001f637", + "::pig2::": u"\U0001f416", + "::triangular_flag_on_post::": u"\U0001f6a9", + "::arrow_upper_left::": u"\U00002196", + "::bee::": u"\U0001f41d", + "::beer::": u"\U0001f37a", + "::black_nib::": u"\U00002712", + "::exclamation::": u"\U00002757", + "::dog::": u"\U0001f436", + "::fire::": u"\U0001f525", + "::ant::": u"\U0001f41c", + "::broken_heart::": u"\U0001f494", + "::chart::": u"\U0001f4b9", + "::clock1::": u"\U0001f550", + "::bomb::": u"\U0001f4a3", + "::virgo::": u"\U0000264d", + "::a::": u"\U0001f170", + "::fork_and_knife::": u"\U0001f374", + "::copyright::": u"\U000000a9", + "::curly_loop::": u"\U000027b0", + "::full_moon::": u"\U0001f315", + "::shoe::": u"\U0001f45e", + "::european_post_office::": u"\U0001f3e4", + "::ng::": u"\U0001f196", + "::office::": u"\U0001f3e2", + "::raising_hand::": u"\U0001f64b", + "::revolving_hearts::": u"\U0001f49e", + "::aquarius::": u"\U00002652", + "::electric_plug::": u"\U0001f50c", + "::meat_on_bone::": u"\U0001f356", + "::mens::": u"\U0001f6b9", + "::briefcase::": u"\U0001f4bc", + "::ship::": u"\U0001f6a2", + "::anchor::": u"\U00002693", + "::ballot_box_with_check::": u"\U00002611", + "::bear::": u"\U0001f43b", + "::beers::": u"\U0001f37b", + "::dromedary_camel::": u"\U0001f42a", + "::nut_and_bolt::": u"\U0001f529", + "::construction::": u"\U0001f6a7", + "::golf::": u"\U000026f3", + "::toilet::": u"\U0001f6bd", + "::blue_book::": u"\U0001f4d8", + "::boom::": u"\U0001f4a5", + "::deciduous_tree::": u"\U0001f333", + "::kissing_closed_eyes::": u"\U0001f61a", + "::smiley_cat::": u"\U0001f63a", + "::fuelpump::": u"\U000026fd", + "::kiss::": u"\U0001f48b", + "::clock10::": u"\U0001f559", + "::sheep::": u"\U0001f411", + "::white_flower::": u"\U0001f4ae", + "::boar::": u"\U0001f417", + "::currency_exchange::": u"\U0001f4b1", + "::facepunch::": u"\U0001f44a", + "::flower_playing_cards::": u"\U0001f3b4", + "::person_frowning::": u"\U0001f64d", + "::poop::": u"\U0001f4a9", + "::satisfied::": u"\U0001f606", + "::8ball::": u"\U0001f3b1", + "::disappointed_relieved::": u"\U0001f625", + "::panda_face::": u"\U0001f43c", + "::ticket::": u"\U0001f3ab", + "::us::": u"\U0001f1fa\U0001f1f8", + "::waxing_crescent_moon::": u"\U0001f312", + "::dragon::": u"\U0001f409", + "::gun::": u"\U0001f52b", + "::mount_fuji::": u"\U0001f5fb", + "::new_moon_with_face::": u"\U0001f31a", + "::star2::": u"\U0001f31f", + "::grimacing::": u"\U0001f62c", + "::confounded::": u"\U0001f616", + "::congratulations::": u"\U00003297", + "::custard::": u"\U0001f36e", + "::frowning::": u"\U0001f626", + "::maple_leaf::": u"\U0001f341", + "::police_car::": u"\U0001f693", + "::cloud::": u"\U00002601", + "::jeans::": u"\U0001f456", + "::fish::": u"\U0001f41f", + "::wavy_dash::": u"\U00003030", + "::clock5::": u"\U0001f554", + "::santa::": u"\U0001f385", + "::japan::": u"\U0001f5fe", + "::oncoming_taxi::": u"\U0001f696", + "::whale::": u"\U0001f433", + "::arrow_forward::": u"\U000025b6", + "::kissing_heart::": u"\U0001f618", + "::bullettrain_side::": u"\U0001f684", + "::fearful::": u"\U0001f628", + "::moneybag::": u"\U0001f4b0", + "::runner::": u"\U0001f3c3", + "::mailbox::": u"\U0001f4eb", + "::sandal::": u"\U0001f461", + "::zzz::": u"\U0001f4a4", + "::apple::": u"\U0001f34e", + "::arrow_heading_up::": u"\U00002934", + "::family::": u"\U0001f46a", + "::heavy_minus_sign::": u"\U00002796", + "::saxophone::": u"\U0001f3b7", + "::u5272::": u"\U0001f239", + "::black_square_button::": u"\U0001f532", + "::bouquet::": u"\U0001f490", + "::love_letter::": u"\U0001f48c", + "::metro::": u"\U0001f687", + "::small_blue_diamond::": u"\U0001f539", + "::thought_balloon::": u"\U0001f4ad", + "::arrow_up::": u"\U00002b06", + "::no_pedestrians::": u"\U0001f6b7", + "::smirk::": u"\U0001f60f", + "::blue_heart::": u"\U0001f499", + "::large_blue_diamond::": u"\U0001f537", + "::vs::": u"\U0001f19a", + "::v::": u"\U0000270c", + "::wheelchair::": u"\U0000267f", + "::couplekiss::": u"\U0001f48f", + "::tent::": u"\U000026fa", + "::purple_heart::": u"\U0001f49c", + "::relaxed::": u"\U0000263a", + "::accept::": u"\U0001f251", + "::green_heart::": u"\U0001f49a", + "::pouting_cat::": u"\U0001f63e", + "::tram::": u"\U0001f68a", + "::bangbang::": u"\U0000203c", + "::collision::": u"\U0001f4a5", + "::convenience_store::": u"\U0001f3ea", + "::person_with_blond_hair::": u"\U0001f471", + "::uk::": u"\U0001f1ec\U0001f1e7", + "::peach::": u"\U0001f351", + "::tired_face::": u"\U0001f62b", + "::bread::": u"\U0001f35e", + "::mailbox_closed::": u"\U0001f4ea", + "::open_mouth::": u"\U0001f62e", + "::pig::": u"\U0001f437", + "::put_litter_in_its_place::": u"\U0001f6ae", + "::u7a7a::": u"\U0001f233", + "::bulb::": u"\U0001f4a1", + "::clock9::": u"\U0001f558", + "::envelope_with_arrow::": u"\U0001f4e9", + "::pisces::": u"\U00002653", + "::baggage_claim::": u"\U0001f6c4", + "::egg::": u"\U0001f373", + "::sweat_smile::": u"\U0001f605", + "::boat::": u"\U000026f5", + "::fr::": u"\U0001f1eb\U0001f1f7", + "::heavy_division_sign::": u"\U00002797", + "::muscle::": u"\U0001f4aa", + "::paw_prints::": u"\U0001f43e", + "::arrow_left::": u"\U00002b05", + "::black_circle::": u"\U000026ab", + "::kissing_smiling_eyes::": u"\U0001f619", + "::star::": u"\U00002b50", + "::steam_locomotive::": u"\U0001f682", + "::1234::": u"\U0001f522", + "::clock130::": u"\U0001f55c", + "::kr::": u"\U0001f1f0\U0001f1f7", + "::monorail::": u"\U0001f69d", + "::school::": u"\U0001f3eb", + "::seven::": u"\U00000037\U000020e3", + "::baby_chick::": u"\U0001f424", + "::bridge_at_night::": u"\U0001f309", + "::hotsprings::": u"\U00002668", + "::rose::": u"\U0001f339", + "::love_hotel::": u"\U0001f3e9", + "::princess::": u"\U0001f478", + "::ramen::": u"\U0001f35c", + "::scroll::": u"\U0001f4dc", + "::tropical_fish::": u"\U0001f420", + "::heart_eyes_cat::": u"\U0001f63b", + "::information_desk_person::": u"\U0001f481", + "::mouse::": u"\U0001f42d", + "::no_smoking::": u"\U0001f6ad", + "::post_office::": u"\U0001f3e3", + "::stars::": u"\U0001f320", + "::arrow_double_down::": u"\U000023ec", + "::unlock::": u"\U0001f513", + "::arrow_backward::": u"\U000025c0", + "::hand::": u"\U0000270b", + "::hospital::": u"\U0001f3e5", + "::ocean::": u"\U0001f30a", + "::mountain_bicyclist::": u"\U0001f6b5", + "::octopus::": u"\U0001f419", + "::sos::": u"\U0001f198", + "::dizzy_face::": u"\U0001f635", + "::tongue::": u"\U0001f445", + "::train2::": u"\U0001f686", + "::checkered_flag::": u"\U0001f3c1", + "::orange_book::": u"\U0001f4d9", + "::sound::": u"\U0001f509", + "::aerial_tramway::": u"\U0001f6a1", + "::bell::": u"\U0001f514", + "::dragon_face::": u"\U0001f432", + "::flipper::": u"\U0001f42c", + "::ok_woman::": u"\U0001f646", + "::performing_arts::": u"\U0001f3ad", + "::postal_horn::": u"\U0001f4ef", + "::clock1030::": u"\U0001f565", + "::email::": u"\U00002709", + "::green_book::": u"\U0001f4d7", + "::point_up_2::": u"\U0001f446", + "::high_brightness::": u"\U0001f506", + "::running_shirt_with_sash::": u"\U0001f3bd", + "::bookmark::": u"\U0001f516", + "::sob::": u"\U0001f62d", + "::arrow_lower_right::": u"\U00002198", + "::point_left::": u"\U0001f448", + "::purse::": u"\U0001f45b", + "::sparkles::": u"\U00002728", + "::black_medium_small_square::": u"\U000025fe", + "::pound::": u"\U0001f4b7", + "::rabbit::": u"\U0001f430", + "::woman::": u"\U0001f469", + "::negative_squared_cross_mark::": u"\U0000274e", + "::open_book::": u"\U0001f4d6", + "::smiling_imp::": u"\U0001f608", + "::spades::": u"\U00002660", + "::baseball::": u"\U000026be", + "::fountain::": u"\U000026f2", + "::joy::": u"\U0001f602", + "::lipstick::": u"\U0001f484", + "::partly_sunny::": u"\U000026c5", + "::ram::": u"\U0001f40f", + "::red_circle::": u"\U0001f534", + "::cop::": u"\U0001f46e", + "::green_apple::": u"\U0001f34f", + "::registered::": u"\U000000ae", + "::+1::": u"\U0001f44d", + "::crying_cat_face::": u"\U0001f63f", + "::innocent::": u"\U0001f607", + "::mobile_phone_off::": u"\U0001f4f4", + "::underage::": u"\U0001f51e", + "::dolphin::": u"\U0001f42c", + "::busts_in_silhouette::": u"\U0001f465", + "::umbrella::": u"\U00002614", + "::angel::": u"\U0001f47c", + "::small_orange_diamond::": u"\U0001f538", + "::sunflower::": u"\U0001f33b", + "::link::": u"\U0001f517", + "::notebook::": u"\U0001f4d3", + "::oncoming_bus::": u"\U0001f68d", + "::bookmark_tabs::": u"\U0001f4d1", + "::calendar::": u"\U0001f4c6", + "::izakaya_lantern::": u"\U0001f3ee", + "::mans_shoe::": u"\U0001f45e", + "::name_badge::": u"\U0001f4db", + "::closed_lock_with_key::": u"\U0001f510", + "::fist::": u"\U0000270a", + "::id::": u"\U0001f194", + "::ambulance::": u"\U0001f691", + "::musical_keyboard::": u"\U0001f3b9", + "::ribbon::": u"\U0001f380", + "::seedling::": u"\U0001f331", + "::tv::": u"\U0001f4fa", + "::football::": u"\U0001f3c8", + "::nail_care::": u"\U0001f485", + "::seat::": u"\U0001f4ba", + "::alarm_clock::": u"\U000023f0", + "::money_with_wings::": u"\U0001f4b8", + "::relieved::": u"\U0001f60c", + "::womans_clothes::": u"\U0001f45a", + "::lips::": u"\U0001f444", + "::clubs::": u"\U00002663", + "::house_with_garden::": u"\U0001f3e1", + "::sunrise::": u"\U0001f305", + "::monkey::": u"\U0001f412", + "::six::": u"\U00000036\U000020e3", + "::smiley::": u"\U0001f603", + "::feet::": u"\U0001f43e", + "::waning_gibbous_moon::": u"\U0001f316", + "::yen::": u"\U0001f4b4", + "::baby_symbol::": u"\U0001f6bc", + "::signal_strength::": u"\U0001f4f6", + "::boy::": u"\U0001f466", + "::busstop::": u"\U0001f68f", + "::computer::": u"\U0001f4bb", + "::night_with_stars::": u"\U0001f303", + "::older_woman::": u"\U0001f475", + "::parking::": u"\U0001f17f", + "::trumpet::": u"\U0001f3ba", + "::100::": u"\U0001f4af", + "::sweat_drops::": u"\U0001f4a6", + "::wc::": u"\U0001f6be", + "::b::": u"\U0001f171", + "::cupid::": u"\U0001f498", + "::five::": u"\U00000035\U000020e3", + "::part_alternation_mark::": u"\U0000303d", + "::snowboarder::": u"\U0001f3c2", + "::warning::": u"\U000026a0", + "::white_large_square::": u"\U00002b1c", + "::zap::": u"\U000026a1", + "::arrow_down_small::": u"\U0001f53d", + "::clock430::": u"\U0001f55f", + "::expressionless::": u"\U0001f611", + "::phone::": u"\U0000260e", + "::roller_coaster::": u"\U0001f3a2", + "::lemon::": u"\U0001f34b", + "::one::": u"\U00000031\U000020e3", + "::christmas_tree::": u"\U0001f384", + "::hankey::": u"\U0001f4a9", + "::hatched_chick::": u"\U0001f425", + "::u7533::": u"\U0001f238", + "::large_blue_circle::": u"\U0001f535", + "::up::": u"\U0001f199", + "::wine_glass::": u"\U0001f377", + "::x::": u"\U0000274c", + "::nose::": u"\U0001f443", + "::rewind::": u"\U000023ea", + "::two_hearts::": u"\U0001f495", + "::envelope::": u"\U00002709", + "::oncoming_automobile::": u"\U0001f698", + "::ophiuchus::": u"\U000026ce", + "::ring::": u"\U0001f48d", + "::tropical_drink::": u"\U0001f379", + "::turtle::": u"\U0001f422", + "::crescent_moon::": u"\U0001f319", + "::koko::": u"\U0001f201", + "::microscope::": u"\U0001f52c", + "::rugby_football::": u"\U0001f3c9", + "::smoking::": u"\U0001f6ac", + "::anger::": u"\U0001f4a2", + "::aries::": u"\U00002648", + "::city_sunset::": u"\U0001f306", + "::clock1230::": u"\U0001f567", + "::mailbox_with_no_mail::": u"\U0001f4ed", + "::movie_camera::": u"\U0001f3a5", + "::pager::": u"\U0001f4df", + "::zero::": u"\U00000030\U000020e3", + "::bank::": u"\U0001f3e6", + "::eight_pointed_black_star::": u"\U00002734", + "::knife::": u"\U0001f52a", + "::u7121::": u"\U0001f21a", + "::customs::": u"\U0001f6c3", + "::melon::": u"\U0001f348", + "::rowboat::": u"\U0001f6a3", + "::corn::": u"\U0001f33d", + "::eggplant::": u"\U0001f346", + "::heart_decoration::": u"\U0001f49f", + "::rotating_light::": u"\U0001f6a8", + "::round_pushpin::": u"\U0001f4cd", + "::cat2::": u"\U0001f408", + "::chocolate_bar::": u"\U0001f36b", + "::no_bell::": u"\U0001f515", + "::radio::": u"\U0001f4fb", + "::droplet::": u"\U0001f4a7", + "::hamburger::": u"\U0001f354", + "::fire_engine::": u"\U0001f692", + "::heart::": u"\U00002764", + "::potable_water::": u"\U0001f6b0", + "::telephone_receiver::": u"\U0001f4de", + "::dash::": u"\U0001f4a8", + "::globe_with_meridians::": u"\U0001f310", + "::guardsman::": u"\U0001f482", + "::heavy_multiplication_x::": u"\U00002716", + "::chart_with_downwards_trend::": u"\U0001f4c9", + "::imp::": u"\U0001f47f", + "::earth_asia::": u"\U0001f30f", + "::mouse2::": u"\U0001f401", + "::notebook_with_decorative_cover::": u"\U0001f4d4", + "::telescope::": u"\U0001f52d", + "::trolleybus::": u"\U0001f68e", + "::card_index::": u"\U0001f4c7", + "::euro::": u"\U0001f4b6", + "::dollar::": u"\U0001f4b5", + "::fax::": u"\U0001f4e0", + "::mailbox_with_mail::": u"\U0001f4ec", + "::raised_hands::": u"\U0001f64c", + "::disappointed::": u"\U0001f61e", + "::foggy::": u"\U0001f301", + "::person_with_pouting_face::": u"\U0001f64e", + "::statue_of_liberty::": u"\U0001f5fd", + "::dolls::": u"\U0001f38e", + "::light_rail::": u"\U0001f688", + "::pencil::": u"\U0001f4dd", + "::speak_no_evil::": u"\U0001f64a", + "::calling::": u"\U0001f4f2", + "::clock830::": u"\U0001f563", + "::cow2::": u"\U0001f404", + "::hear_no_evil::": u"\U0001f649", + "::scream_cat::": u"\U0001f640", + "::smile_cat::": u"\U0001f638", + "::tractor::": u"\U0001f69c", + "::clock11::": u"\U0001f55a", + "::doughnut::": u"\U0001f369", + "::hammer::": u"\U0001f528", + "::loop::": u"\U000027bf", + "::moon::": u"\U0001f314", + "::soon::": u"\U0001f51c", + "::cinema::": u"\U0001f3a6", + "::factory::": u"\U0001f3ed", + "::flushed::": u"\U0001f633", + "::mute::": u"\U0001f507", + "::neutral_face::": u"\U0001f610", + "::scorpius::": u"\U0000264f", + "::wolf::": u"\U0001f43a", + "::clapper::": u"\U0001f3ac", + "::joy_cat::": u"\U0001f639", + "::pensive::": u"\U0001f614", + "::sleeping::": u"\U0001f634", + "::credit_card::": u"\U0001f4b3", + "::leo::": u"\U0000264c", + "::man_with_gua_pi_mao::": u"\U0001f472", + "::open_hands::": u"\U0001f450", + "::tea::": u"\U0001f375", + "::arrow_down::": u"\U00002b07", + "::nine::": u"\U00000039\U000020e3", + "::punch::": u"\U0001f44a", + "::slot_machine::": u"\U0001f3b0", + "::clap::": u"\U0001f44f", + "::information_source::": u"\U00002139", + "::tiger::": u"\U0001f42f", + "::city_sunrise::": u"\U0001f307", + "::dango::": u"\U0001f361", + "::thumbsdown::": u"\U0001f44e", + "::u6307::": u"\U0001f22f", + "::curry::": u"\U0001f35b", + "::cherries::": u"\U0001f352", + "::clock6::": u"\U0001f555", + "::clock7::": u"\U0001f556", + "::older_man::": u"\U0001f474", + "::oncoming_police_car::": u"\U0001f694", + "::syringe::": u"\U0001f489", + "::heavy_dollar_sign::": u"\U0001f4b2", + "::open_file_folder::": u"\U0001f4c2", + "::arrow_right_hook::": u"\U000021aa", + "::articulated_lorry::": u"\U0001f69b", + "::dancers::": u"\U0001f46f", + "::kissing_cat::": u"\U0001f63d", + "::rainbow::": u"\U0001f308", + "::u5408::": u"\U0001f234", + "::boot::": u"\U0001f462", + "::carousel_horse::": u"\U0001f3a0", + "::fried_shrimp::": u"\U0001f364", + "::lock::": u"\U0001f512", + "::non-potable_water::": u"\U0001f6b1", + "::o::": u"\U00002b55", + "::persevere::": u"\U0001f623", + "::diamond_shape_with_a_dot_inside::": u"\U0001f4a0", + "::fallen_leaf::": u"\U0001f342", + "::massage::": u"\U0001f486", + "::volcano::": u"\U0001f30b", + "::gem::": u"\U0001f48e", + "::shower::": u"\U0001f6bf", + "::speaker::": u"\U0001f508", + "::last_quarter_moon_with_face::": u"\U0001f31c", + "::mag::": u"\U0001f50d", + "::anguished::": u"\U0001f627", + "::monkey_face::": u"\U0001f435", + "::sunny::": u"\U00002600", + "::tangerine::": u"\U0001f34a", + "::point_right::": u"\U0001f449", + "::railway_car::": u"\U0001f683", + "::triumph::": u"\U0001f624", + "::two::": u"\U00000032\U000020e3", + "::gift_heart::": u"\U0001f49d", + "::ledger::": u"\U0001f4d2", + "::sagittarius::": u"\U00002650", + "::snowflake::": u"\U00002744", + "::abc::": u"\U0001f524", + "::horse::": u"\U0001f434", + "::ok_hand::": u"\U0001f44c", + "::video_camera::": u"\U0001f4f9", + "::sparkling_heart::": u"\U0001f496", + "::taurus::": u"\U00002649", + "::frog::": u"\U0001f438", + "::hamster::": u"\U0001f439", + "::helicopter::": u"\U0001f681", + "::fries::": u"\U0001f35f", + "::mushroom::": u"\U0001f344", + "::penguin::": u"\U0001f427", + "::truck::": u"\U0001f69a", + "::bar_chart::": u"\U0001f4ca", + "::evergreen_tree::": u"\U0001f332", + "::bow::": u"\U0001f647", + "::clock12::": u"\U0001f55b", + "::four_leaf_clover::": u"\U0001f340", + "::inbox_tray::": u"\U0001f4e5", + "::smirk_cat::": u"\U0001f63c", + "::two_men_holding_hands::": u"\U0001f46c", + "::water_buffalo::": u"\U0001f403", + "::alien::": u"\U0001f47d", + "::video_game::": u"\U0001f3ae", + "::candy::": u"\U0001f36c", + "::page_facing_up::": u"\U0001f4c4", + "::watermelon::": u"\U0001f349", + "::white_check_mark::": u"\U00002705", + "::blossom::": u"\U0001f33c", + "::crocodile::": u"\U0001f40a", + "::no_mouth::": u"\U0001f636", + "::o2::": u"\U0001f17e", + "::shirt::": u"\U0001f455", + "::clock8::": u"\U0001f557", + "::eyes::": u"\U0001f440", + "::rabbit2::": u"\U0001f407", + "::tanabata_tree::": u"\U0001f38b", + "::wrench::": u"\U0001f527", + "::es::": u"\U0001f1ea\U0001f1f8", + "::trophy::": u"\U0001f3c6", + "::two_women_holding_hands::": u"\U0001f46d", + "::clock630::": u"\U0001f561", + "::pineapple::": u"\U0001f34d", + "::stuck_out_tongue::": u"\U0001f61b", + "::angry::": u"\U0001f620", + "::athletic_shoe::": u"\U0001f45f", + "::cookie::": u"\U0001f36a", + "::flags::": u"\U0001f38f", + "::game_die::": u"\U0001f3b2", + "::bird::": u"\U0001f426", + "::jack_o_lantern::": u"\U0001f383", + "::ox::": u"\U0001f402", + "::paperclip::": u"\U0001f4ce", + "::sleepy::": u"\U0001f62a", + "::astonished::": u"\U0001f632", + "::back::": u"\U0001f519", + "::closed_book::": u"\U0001f4d5", + "::hatching_chick::": u"\U0001f423", + "::arrows_clockwise::": u"\U0001f503", + "::car::": u"\U0001f697", + "::ear::": u"\U0001f442", + "::haircut::": u"\U0001f487", + "::icecream::": u"\U0001f366", + "::bust_in_silhouette::": u"\U0001f464", + "::diamonds::": u"\U00002666", + "::no_good::": u"\U0001f645", + "::pizza::": u"\U0001f355", + "::chicken::": u"\U0001f414", + "::eyeglasses::": u"\U0001f453", + "::see_no_evil::": u"\U0001f648", + "::earth_africa::": u"\U0001f30d", + "::fireworks::": u"\U0001f386", + "::page_with_curl::": u"\U0001f4c3", + "::rice_ball::": u"\U0001f359", + "::white_square_button::": u"\U0001f533", + "::cake::": u"\U0001f370", + "::red_car::": u"\U0001f697", + "::tm::": u"\U00002122", + "::unamused::": u"\U0001f612", + "::fish_cake::": u"\U0001f365", + "::key::": u"\U0001f511", + "::speedboat::": u"\U0001f6a4", + "::closed_umbrella::": u"\U0001f302", + "::pear::": u"\U0001f350", + "::satellite::": u"\U0001f4e1", + "::scream::": u"\U0001f631", + "::first_quarter_moon::": u"\U0001f313", + "::jp::": u"\U0001f1ef\U0001f1f5", + "::repeat_one::": u"\U0001f502", + "::shell::": u"\U0001f41a", + "::interrobang::": u"\U00002049", + "::trident::": u"\U0001f531", + "::u55b6::": u"\U0001f23a", + "::atm::": u"\U0001f3e7", + "::door::": u"\U0001f6aa", + "::kissing::": u"\U0001f617", + "::six_pointed_star::": u"\U0001f52f", + "::thumbsup::": u"\U0001f44d", + "::u6708::": u"\U0001f237", + "::do_not_litter::": u"\U0001f6af", + "::whale2::": u"\U0001f40b", + "::school_satchel::": u"\U0001f392", + "::cactus::": u"\U0001f335", + "::clipboard::": u"\U0001f4cb", + "::dizzy::": u"\U0001f4ab", + "::waxing_gibbous_moon::": u"\U0001f314", + "::camera::": u"\U0001f4f7", + "::capital_abcd::": u"\U0001f520", + "::leaves::": u"\U0001f343", + "::left_luggage::": u"\U0001f6c5", + "::bamboo::": u"\U0001f38d", + "::bowling::": u"\U0001f3b3", + "::eight::": u"\U00000038\U000020e3", + "::kimono::": u"\U0001f458", + "::left_right_arrow::": u"\U00002194", + "::stuck_out_tongue_winking_eye::": u"\U0001f61c", + "::surfer::": u"\U0001f3c4", + "::sweat::": u"\U0001f613", + "::violin::": u"\U0001f3bb", + "::postbox::": u"\U0001f4ee", + "::bride_with_veil::": u"\U0001f470", + "::recycle::": u"\U0000267b", + "::station::": u"\U0001f689", + "::vhs::": u"\U0001f4fc", + "::crossed_flags::": u"\U0001f38c", + "::memo::": u"\U0001f4dd", + "::no_entry::": u"\U000026d4", + "::white_circle::": u"\U000026aa", + "::arrow_lower_left::": u"\U00002199", + "::chestnut::": u"\U0001f330", + "::crystal_ball::": u"\U0001f52e", + "::last_quarter_moon::": u"\U0001f317", + "::loud_sound::": u"\U0001f50a", + "::strawberry::": u"\U0001f353", + "::worried::": u"\U0001f61f", + "::circus_tent::": u"\U0001f3aa", + "::weary::": u"\U0001f629", + "::bathtub::": u"\U0001f6c1", + "::snake::": u"\U0001f40d", + "::grin::": u"\U0001f601", + "::symbols::": u"\U0001f523", + "::airplane::": u"\U00002708", + "::heart_eyes::": u"\U0001f60d", + "::sailboat::": u"\U000026f5", + "::stew::": u"\U0001f372", + "::tshirt::": u"\U0001f455", + "::rat::": u"\U0001f400", + "::black_medium_square::": u"\U000025fc", + "::clock930::": u"\U0001f564", + "::full_moon_with_face::": u"\U0001f31d", + "::japanese_goblin::": u"\U0001f47a", + "::restroom::": u"\U0001f6bb", + "::vertical_traffic_light::": u"\U0001f6a6", + "::basketball::": u"\U0001f3c0", + "::cherry_blossom::": u"\U0001f338", + "::low_brightness::": u"\U0001f505", + "::pill::": u"\U0001f48a", +} + +def emojize(text): + """ + Emoji regex + """ + pattern = re.compile('(::[a-z0-9\+\-_]+::)') + def emorepl(match): + value = match.group(1) + if value in emojiCodeDict: + return emojiCodeDict[value] + return pattern.sub(emorepl, text) diff --git a/rainbowstream/rainbow.py b/rainbowstream/rainbow.py index 72e2160..bc7d85a 100644 --- a/rainbowstream/rainbow.py +++ b/rainbowstream/rainbow.py @@ -22,6 +22,7 @@ from .consumer import * from .interactive import * from .c_image import * from .py3patch import * +from .emoji import * # Global values g = {} @@ -136,6 +137,7 @@ def init(args): name = credential['name'] if not get_config('PREFIX'): set_config('PREFIX', screen_name) + c['PREFIX'] = emojize(c['PREFIX']) g['PREFIX'] = u2str(c['PREFIX']) c['original_name'] = g['original_name'] = screen_name[1:] g['full_name'] = name diff --git a/setup.py b/setup.py index 5067dcc..ac0c342 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import os import os.path # Bumped version -version = '0.9.8' +version = '0.9.9' # Require install_requires = [ -- 2.25.1