remove default theme, add retweet count and favorites count
authorOrakaro <nhatminh_179@hotmail.com>
Sat, 9 Aug 2014 16:13:47 +0000 (01:13 +0900)
committerOrakaro <nhatminh_179@hotmail.com>
Sat, 9 Aug 2014 16:13:47 +0000 (01:13 +0900)
12 files changed:
docs/conf.py
docs/index.rst
rainbowstream/colorset/config
rainbowstream/colorset/default.json [deleted file]
rainbowstream/colorset/larapaste.json
rainbowstream/colorset/monokai.json
rainbowstream/colorset/solarized.json
rainbowstream/colorset/tomorrow_night.json
rainbowstream/draw.py
rainbowstream/rainbow.py
setup.py
theme.md

index 2f37041..0f10c6f 100644 (file)
@@ -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.
index 545002b..377d21f 100644 (file)
@@ -254,8 +254,6 @@ Here is full list of supported command:
 \r
 -  ``q`` will quit.\r
 \r
-Available commands are listed in `Read The Docs`_.\r
-\r
 Theme customization\r
 ^^^^^^^^^^^^^^^^^^^\r
 \r
@@ -334,8 +332,11 @@ You can view or set a new value of every config key by ``config`` command (See *
     + ``#name``: Twitter's name\r
     + ``#nick``: Twitter's screen name\r
     + ``#clock``: Datetime\r
+    + ``#rt_count``: retweets count\r
+    + ``#fa_count``: favorites count\r
     + ``#id``: ID\r
     + ``#fav``: favorited symbol\r
+    + ``#fav``: favorited symbol\r
     + ``#tweet``: Tweet's content\r
     + ``#sender_name``: Message's sender name\r
     + ``#sender_nick``: Message's sender screen name\r
index 2003630..086ec40 100644 (file)
@@ -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 (file)
index cfa251c..0000000
+++ /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"
-    }
-}
index a89e095..87c6d98 100644 (file)
     "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" : {
index b0741c1..4365b7c 100644 (file)
     "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" : {
index efb1dd4..6340d74 100644 (file)
     "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" : {
index 57590b0..1939de2 100644 (file)
     "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" : {
index 5dd0788..bae4106 100644 (file)
@@ -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)
index c66ae9a..f456a84 100644 (file)
@@ -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.'))
 
 
index 48949bc..43574cf 100644 (file)
--- 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 = [
index 2916402..6a28446 100644 (file)
--- 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