add share command and show Twitter client name
authorOrakaro <nhatminh_179@hotmail.com>
Wed, 24 Sep 2014 17:24:24 +0000 (02:24 +0900)
committerOrakaro <nhatminh_179@hotmail.com>
Wed, 24 Sep 2014 17:24:24 +0000 (02:24 +0900)
docs/conf.py
docs/index.rst
rainbowstream/colorset/config
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 eafb44f450356da565a3ea78f0e6a01d926b1ff1..c0cbe384eab81f348149e720783499f84fa26bfc 100644 (file)
@@ -48,9 +48,9 @@ copyright = u'2014, Vu Nhat Minh'
 # built documents.
 #
 # The short X.Y version.
 # built documents.
 #
 # The short X.Y version.
-version = '1.0.7'
+version = '1.0.8'
 # The full version, including alpha/beta/rc tags.
 # The full version, including alpha/beta/rc tags.
-release = '1.0.7'
+release = '1.0.8'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
index e42c9276afc5c402b0ecc3a16d93d8a9c2cb8e53..f241303685e1e30888923a0eb58db31de205744a 100644 (file)
@@ -144,6 +144,8 @@ Here is full list of supported command:
 \r
 -  ``ufav 12`` will unfavorite tweet with *[id=12]*.\r
 \r
 \r
 -  ``ufav 12`` will unfavorite tweet with *[id=12]*.\r
 \r
+-  ``share 12`` will copy tweet with *[id=12]* to your clipboard.\r
+\r
 -  ``del 12`` will delete tweet with *[id=12]*.\r
 \r
 -  ``show image 12`` will show the image in tweet with *[id=12]* in your OS’s image viewer.\r
 -  ``del 12`` will delete tweet with *[id=12]*.\r
 \r
 -  ``show image 12`` will show the image in tweet with *[id=12]* in your OS’s image viewer.\r
index 14046fe1181356ca9d14aa0479209535feeaf92b..2d0b36e9ec3eb35608017b0f24a1c940ad4c062b 100644 (file)
@@ -53,7 +53,7 @@
     "FORMAT": {
         "TWEET": {
             "CLOCK_FORMAT" : "%Y/%m/%d %H:%M:%S",
     "FORMAT": {
         "TWEET": {
             "CLOCK_FORMAT" : "%Y/%m/%d %H:%M:%S",
-            "DISPLAY" : "\n  #name #nick #clock \n  \u20AA:#rt_count \u2665:#fa_count id:#id #fav\n  #tweet"
+            "DISPLAY" : "\n  #name #nick #clock \n  \u20AA:#rt_count \u2665:#fa_count id:#id via #client #fav\n  #tweet"
         },
         "MESSAGE": {
             "CLOCK_FORMAT" : "%Y/%m/%d %H:%M:%S",
         },
         "MESSAGE": {
             "CLOCK_FORMAT" : "%Y/%m/%d %H:%M:%S",
index fd75cc630f53b2da40dfb1c0faffd521cf9e5e4b..922a115a025b56c31bd2ccad6f61b44754c41a34 100644 (file)
@@ -27,6 +27,7 @@
         "nick"            : 37,
         "clock"           : 184,
         "id"              : 184,
         "nick"            : 37,
         "clock"           : 184,
         "id"              : 184,
+        "client"          : 154,
         "favorited"       : 154,
         "retweet_count"   : 154,
         "favorite_count"  : 202,
         "favorited"       : 154,
         "retweet_count"   : 154,
         "favorite_count"  : 202,
index 6eac09f3dee06af80e264815b776d7a63508ae5b..c777eb2aa0829e19aac407b92a84c95774367f96 100644 (file)
@@ -27,6 +27,7 @@
         "nick"            : 112,
         "clock"           : 57,
         "id"              : 166,
         "nick"            : 112,
         "clock"           : 57,
         "id"              : 166,
+        "client"          : 74,
         "favorited"       : 50,
         "retweet_count"   : 50,
         "favorite_count"  : 198,
         "favorited"       : 50,
         "retweet_count"   : 50,
         "favorite_count"  : 198,
index 7e77bb725877c36c3b099994cec0ea80587805b3..9053da8a3d0ebf28fa4be9c9117fd37d66362df5 100644 (file)
@@ -27,6 +27,7 @@
         "nick"            : 64,
         "clock"           : 32,
         "id"              : 130,
         "nick"            : 64,
         "clock"           : 32,
         "id"              : 130,
+        "client"          : 23,
         "favorited"       : 64,
         "retweet_count"   : 64,
         "favorite_count"  : 124,
         "favorited"       : 64,
         "retweet_count"   : 64,
         "favorite_count"  : 124,
index f48bdb7366c4080137b2bce3316dbce1edebab29..309d889d194d971aca3144ee8f2663f5f8b63bbf 100644 (file)
@@ -27,6 +27,7 @@
         "nick"            : 67,
         "clock"           : 58,
         "id"              : 58,
         "nick"            : 67,
         "clock"           : 58,
         "id"              : 58,
+        "client"          : 58,
         "favorited"       : 97,
         "retweet_count"   : 97,
         "favorite_count"  : 166,
         "favorited"       : 97,
         "retweet_count"   : 97,
         "favorite_count"  : 166,
index 429bd279220512ef7e353c2d8253941e187b6777..dd32297dd8d8da02781363b20dcbf6a0904e9ec6 100644 (file)
@@ -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']
     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']
     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)
 
     # 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 = []
     # Get expanded url
     try:
         expanded_url = []
@@ -330,6 +337,11 @@ def draw(t, keyword=None, humanize=True, noti=False, fil=[], ig=[]):
         word = [wo for wo in formater.split() if '#id' in wo][0]
         delimiter = color_func(c['TWEET']['id'])(id.join(word.split('#id')))
         formater = delimiter.join(formater.split(word))
         word = [wo for wo in formater.split() if '#id' in wo][0]
         delimiter = color_func(c['TWEET']['id'])(id.join(word.split('#id')))
         formater = delimiter.join(formater.split(word))
+        # 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))
         # Change retweet count word
         word = [wo for wo in formater.split() if '#rt_count' in wo][0]
         delimiter = color_func(c['TWEET']['retweet_count'])(
         # Change retweet count word
         word = [wo for wo in formater.split() if '#rt_count' in wo][0]
         delimiter = color_func(c['TWEET']['retweet_count'])(
index 500c2dba3244f86b9dbdbcebf7113b19233d49a7..49e3308f7fe70654b3a8c33ee4a1cd8b70f49280 100644 (file)
@@ -482,6 +482,24 @@ def unfavorite():
     printNicely('')
 
 
     printNicely('')
 
 
+def share():
+    """
+    Copy url of a tweet to clipboard
+    """
+    t = Twitter(auth=authen())
+    try:
+        id = int(g['stuff'].split()[0])
+    except:
+        printNicely(red('Sorry I can\'t understand.'))
+        return
+    tid = c['tweet_dict'][id]
+    tweet = t.statuses.show(id=tid)
+    url = 'https://twitter.com/' + \
+        tweet['user']['screen_name'] + '/status/' + str(tid)
+    os.system("echo '%s' | pbcopy" % url)
+    printNicely(green('Copied tweet\'s url to clipboard.'))
+
+
 def delete():
     """
     Delete
 def delete():
     """
     Delete
@@ -1394,6 +1412,9 @@ def help_tweets():
     usage += s * 2 + \
         light_green('ufav 12 ') + ' will unfavorite tweet with ' + \
         light_yellow('[id=12]') + '.\n'
     usage += s * 2 + \
         light_green('ufav 12 ') + ' will unfavorite tweet with ' + \
         light_yellow('[id=12]') + '.\n'
+    usage += s * 2 + \
+        light_green('share 12 ') + ' will copy the url of the tweet with ' + \
+        light_yellow('[id=12]') + ' to your clipboard.\n'
     usage += s * 2 + \
         light_green('del 12 ') + ' will delete tweet with ' + \
         light_yellow('[id=12]') + '.\n'
     usage += s * 2 + \
         light_green('del 12 ') + ' will delete tweet with ' + \
         light_yellow('[id=12]') + '.\n'
@@ -1674,6 +1695,7 @@ cmdset = [
     'rep',
     'del',
     'ufav',
     'rep',
     'del',
     'ufav',
+    'share',
     's',
     'mes',
     'show',
     's',
     'mes',
     'show',
@@ -1719,6 +1741,7 @@ funcset = [
     reply,
     delete,
     unfavorite,
     reply,
     delete,
     unfavorite,
+    share,
     search,
     message,
     show,
     search,
     message,
     show,
@@ -1777,6 +1800,7 @@ def listen():
             [],  # reply
             [],  # delete
             [],  # unfavorite
             [],  # reply
             [],  # delete
             [],  # unfavorite
+            [],  # url
             ['#'],  # search
             ['@'],  # message
             ['image'],  # show image
             ['#'],  # search
             ['@'],  # message
             ['image'],  # show image
index dec267a4ad187e774fe7d61412a4f7e82f0125d2..82eed6e3ca762b6251d55222ac160e75ab0e3a2a 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@ import os
 import os.path
 
 # Bumped version
 import os.path
 
 # Bumped version
-version = '1.0.7'
+version = '1.0.8'
 
 # Require
 install_requires = [
 
 # Require
 install_requires = [
index a679141f77acdf85de36d95838ee865cf56ef384..4f1a6035f8cbafc95c731784ec3484b50be6b0e2 100644 (file)
--- a/theme.md
+++ b/theme.md
@@ -25,15 +25,18 @@ Examples are available in
     "DECORATED_NAME" : 198,
     "CYCLE_COLOR" :[198,57,166,50,179,74,112],
     "TWEET" : {
     "DECORATED_NAME" : 198,
     "CYCLE_COLOR" :[198,57,166,50,179,74,112],
     "TWEET" : {
+        "mynick"          : 179,
         "nick"            : 112,
         "clock"           : 57,
         "id"              : 166,
         "nick"            : 112,
         "clock"           : 57,
         "id"              : 166,
+        "client"          : 74,
         "favorited"       : 50,
         "retweet_count"   : 50,
         "favorite_count"  : 198,
         "rt"              : 179,
         "link"            : 74,
         "hashtag"         : 198,
         "favorited"       : 50,
         "retweet_count"   : 50,
         "favorite_count"  : 198,
         "rt"              : 179,
         "link"            : 74,
         "hashtag"         : 198,
+        "mytweet"         : 179,
         "keyword"         : "on_light_green"
     },
 
         "keyword"         : "on_light_green"
     },
 
@@ -46,8 +49,8 @@ Examples are available in
     "MESSAGE" : {
         "partner"       : 112,
         "me"            : 112,
     "MESSAGE" : {
         "partner"       : 112,
         "me"            : 112,
-        "me_frame"      : 74,
         "partner_frame" : 198,
         "partner_frame" : 198,
+        "me_frame"      : 74,
         "sender"        : 112,
         "recipient"     : 112,
         "to"            : 50,
         "sender"        : 112,
         "recipient"     : 112,
         "to"            : 50,
@@ -144,6 +147,7 @@ Color reference can be found at
   * `nick` : color for other Twitter __username__.
   * `clock`: color for time of tweet.
   * `id`: color for tweet's id.
   * `nick` : color for other Twitter __username__.
   * `clock`: color for time of tweet.
   * `id`: color for tweet's id.
+  * `client`: color for used Twitter client.
   * `favorite`: color for the star symbol when a tweet is favorited by you.
   * `retweet_count`: color for retweets count.
   * `favorite_count`: color for favorites count.
   * `favorite`: color for the star symbol when a tweet is favorited by you.
   * `retweet_count`: color for retweets count.
   * `favorite_count`: color for favorites count.