From 318cdd679598aef40a9dad1dfe66dcd4f82892a7 Mon Sep 17 00:00:00 2001 From: Orakaro Date: Sun, 10 Aug 2014 01:13:47 +0900 Subject: [PATCH] remove default theme, add retweet count and favorites count --- docs/conf.py | 4 +- docs/index.rst | 5 +- rainbowstream/colorset/config | 2 +- rainbowstream/colorset/default.json | 73 ---------------------- rainbowstream/colorset/larapaste.json | 18 +++--- rainbowstream/colorset/monokai.json | 18 +++--- rainbowstream/colorset/solarized.json | 18 +++--- rainbowstream/colorset/tomorrow_night.json | 18 +++--- rainbowstream/draw.py | 16 ++++- rainbowstream/rainbow.py | 3 +- setup.py | 2 +- theme.md | 2 - 12 files changed, 63 insertions(+), 116 deletions(-) delete mode 100644 rainbowstream/colorset/default.json diff --git a/docs/conf.py b/docs/conf.py index 2f37041..0f10c6f 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.6.8' +version = '0.6.9' # The full version, including alpha/beta/rc tags. -release = '0.6.8' +release = '0.6.9' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/index.rst b/docs/index.rst index 545002b..377d21f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -254,8 +254,6 @@ Here is full list of supported command: - ``q`` will quit. -Available commands are listed in `Read The Docs`_. - Theme customization ^^^^^^^^^^^^^^^^^^^ @@ -334,8 +332,11 @@ You can view or set a new value of every config key by ``config`` command (See * + ``#name``: Twitter's name + ``#nick``: Twitter's screen name + ``#clock``: Datetime + + ``#rt_count``: retweets count + + ``#fa_count``: favorites count + ``#id``: ID + ``#fav``: favorited symbol + + ``#fav``: favorited symbol + ``#tweet``: Tweet's content + ``#sender_name``: Message's sender name + ``#sender_nick``: Message's sender screen name diff --git a/rainbowstream/colorset/config b/rainbowstream/colorset/config index 2003630..086ec40 100644 --- a/rainbowstream/colorset/config +++ b/rainbowstream/colorset/config @@ -37,7 +37,7 @@ "FORMAT": { "TWEET": { "CLOCK_FORMAT" : "%Y/%m/%d %H:%M:%S", - "DISPLAY" : "\n #name #nick :\n [#clock] [id=#id] #fav\n #tweet" + "DISPLAY" : "\n #name #nick :\n [#clock] [rt:#rt_count] [fav:#fa_count] [id=#id] #fav\n #tweet" }, "MESSAGE": { "CLOCK_FORMAT" : "%Y/%m/%d %H:%M:%S", diff --git a/rainbowstream/colorset/default.json b/rainbowstream/colorset/default.json deleted file mode 100644 index cfa251c..0000000 --- a/rainbowstream/colorset/default.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - /* Color config - There are 16 basic colors supported : - * default - * black - * red - * green - * yellow - * blue - * magenta - * cyan - * grey - * light_red - * light_green - * light_yellow - * light_blue - * light_magenta - * light_cyan - * white - and 256 colors from term_0 to term_255 - */ - - "DECORATED_NAME" : "grey", - "CYCLE_COLOR" :["light_red","light_green","light_yellow","light_blue","light_magenta","light_cyan"], - "TWEET" : { - "nick" : "grey", - "clock" : "grey", - "id" : "grey", - "favorited" : "light_green", - "rt" : "grey", - "link" : "light_cyan", - "hashtag" : "grey", - "keyword" : "on_light_yellow" - }, - - "MESSAGE" : { - "sender" : "grey", - "recipient" : "grey", - "to" : "light_magenta", - "clock" : "grey", - "id" : "grey" - }, - - "PROFILE" : { - "statuses_count" : "light_green", - "friends_count" : "light_green", - "followers_count" : "light_green", - "nick" : "grey", - "profile_image_url" : "light_cyan", - "description" : "light_yellow", - "location" : "light_magenta", - "url" : "light_cyan", - "clock" : "white" - }, - - "TREND" : { - "url": "light_cyan" - }, - - "CAL" : { - "days": "grey", - "today": "on_grey" - }, - - "GROUP" : { - "name": "grey", - "member": "light_green", - "subscriber": "light_green", - "mode": "grey", - "description": "light_yellow", - "clock": "grey" - } -} diff --git a/rainbowstream/colorset/larapaste.json b/rainbowstream/colorset/larapaste.json index a89e095..87c6d98 100644 --- a/rainbowstream/colorset/larapaste.json +++ b/rainbowstream/colorset/larapaste.json @@ -23,14 +23,16 @@ "DECORATED_NAME" : 73, "CYCLE_COLOR" :[73,209,148,230,220,59], "TWEET" : { - "nick" : 73, - "clock" : 220, - "id" : 209, - "favorited" : 148, - "rt" : 59, - "link" : 148, - "hashtag" : 73, - "keyword" : "on_light_green" + "nick" : 73, + "clock" : 220, + "id" : 209, + "favorited" : 148, + "retweet_count" : 73, + "favorite_count" : 148, + "rt" : 59, + "link" : 148, + "hashtag" : 73, + "keyword" : "on_light_green" }, "MESSAGE" : { diff --git a/rainbowstream/colorset/monokai.json b/rainbowstream/colorset/monokai.json index b0741c1..4365b7c 100644 --- a/rainbowstream/colorset/monokai.json +++ b/rainbowstream/colorset/monokai.json @@ -23,14 +23,16 @@ "DECORATED_NAME" : 198, "CYCLE_COLOR" :[198,57,166,50,179,74,112], "TWEET" : { - "nick" : 112, - "clock" : 57, - "id" : 166, - "favorited" : 50, - "rt" : 179, - "link" : 74, - "hashtag" : 198, - "keyword" : "on_light_green" + "nick" : 112, + "clock" : 57, + "id" : 166, + "favorited" : 50, + "retweet_count" : 198, + "favorite_count" : 50, + "rt" : 179, + "link" : 74, + "hashtag" : 198, + "keyword" : "on_light_green" }, "MESSAGE" : { diff --git a/rainbowstream/colorset/solarized.json b/rainbowstream/colorset/solarized.json index efb1dd4..6340d74 100644 --- a/rainbowstream/colorset/solarized.json +++ b/rainbowstream/colorset/solarized.json @@ -23,14 +23,16 @@ "DECORATED_NAME" : 64, "CYCLE_COLOR" :[124,32,64,66,130,23], "TWEET" : { - "nick" : 64, - "clock" : 32, - "id" : 124, - "favorited" : 64, - "rt" : 66, - "link" : 23, - "hashtag" : 64, - "keyword" : "on_light_green" + "nick" : 64, + "clock" : 32, + "id" : 124, + "favorited" : 64, + "retweet_count" : 130, + "favorite_count" : 64, + "rt" : 66, + "link" : 23, + "hashtag" : 64, + "keyword" : "on_light_green" }, "MESSAGE" : { diff --git a/rainbowstream/colorset/tomorrow_night.json b/rainbowstream/colorset/tomorrow_night.json index 57590b0..1939de2 100644 --- a/rainbowstream/colorset/tomorrow_night.json +++ b/rainbowstream/colorset/tomorrow_night.json @@ -23,14 +23,16 @@ "DECORATED_NAME" : 103, "CYCLE_COLOR" :[103,173,30,54,58,179,145], "TWEET" : { - "nick" : 103, - "clock" : 58, - "id" : 173, - "favorited" : 54, - "rt" : 145, - "link" : 30, - "hashtag" : 103, - "keyword" : "on_light_blue" + "nick" : 103, + "clock" : 58, + "id" : 173, + "favorited" : 54, + "retweet_count" : 103, + "favorite_count" : 54, + "rt" : 145, + "link" : 30, + "hashtag" : 103, + "keyword" : "on_light_blue" }, "MESSAGE" : { diff --git a/rainbowstream/draw.py b/rainbowstream/draw.py index 5dd0788..bae4106 100644 --- a/rainbowstream/draw.py +++ b/rainbowstream/draw.py @@ -165,6 +165,8 @@ def draw(t, keyword=None, check_semaphore=False, fil=[], ig=[]): name = t['user']['name'] created_at = t['created_at'] favorited = t['favorited'] + retweet_count = t['retweet_count'] + favorite_count = t['favorite_count'] date = parser.parse(created_at) date = date - datetime.timedelta(seconds=time.timezone) clock_format = '%Y/%m/%d %H:%M:%S' @@ -270,6 +272,7 @@ def draw(t, keyword=None, check_semaphore=False, fil=[], ig=[]): tweet = delimiter.join(ary) # Load config formater + formater = '' try: formater = c['FORMAT']['TWEET']['DISPLAY'] formater = name.join(formater.split("#name")) @@ -285,9 +288,18 @@ def draw(t, keyword=None, check_semaphore=False, fil=[], ig=[]): word = [w for w in formater.split() if '#id' in w][0] delimiter = color_func(c['TWEET']['id'])(id.join(word.split('#id'))) formater = delimiter.join(formater.split(word)) + # Change retweet count word + word = [w for w in formater.split() if '#rt_count' in w][0] + delimiter = color_func(c['TWEET']['retweet_count'])( + str(retweet_count).join(word.split('#rt_count'))) + formater = delimiter.join(formater.split(word)) + # Change favorites count word + word = [w for w in formater.split() if '#fa_count' in w][0] + delimiter = color_func(c['TWEET']['favorite_count'])( + str(favorite_count).join(word.split('#fa_count'))) + formater = delimiter.join(formater.split(word)) except: - printNicely(red('Wrong format in config.')) - return + pass # Draw printNicely(formater) diff --git a/rainbowstream/rainbow.py b/rainbowstream/rainbow.py index c66ae9a..f456a84 100644 --- a/rainbowstream/rainbow.py +++ b/rainbowstream/rainbow.py @@ -1206,7 +1206,8 @@ def theme(): c['DECORATED_NAME'])( '[' + x + ']: ') printNicely(green('Theme changed.')) - except: + except Exception as e: + print(e) printNicely(red('No such theme exists.')) diff --git a/setup.py b/setup.py index 48949bc..43574cf 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import os import os.path # Bumped version -version = '0.6.8' +version = '0.6.9' # Require install_requires = [ diff --git a/theme.md b/theme.md index 2916402..6a28446 100644 --- a/theme.md +++ b/theme.md @@ -1,6 +1,4 @@ ## Available themes -#### Default -![Default](./screenshot/themes/Default.png) #### Monokai ![Monokai](./screenshot/themes/Monokai.png) #### Solarized -- 2.25.1