X-Git-Url: https://vcs.fsf.org/?p=rainbowstream.git;a=blobdiff_plain;f=rainbowstream%2Frainbow.py;h=dfbfb3b7ac3d559e7ad5a76bc92e88a1504c4197;hp=71310a9e50d289fc02255595d15b6fa10d0f4c1b;hb=4819f9859f66a5777f4d545666de206e9842e327;hpb=8715dda0d85c8aba3aceda1dc6de5c9b5ef127cc diff --git a/rainbowstream/rainbow.py b/rainbowstream/rainbow.py index 71310a9..dfbfb3b 100644 --- a/rainbowstream/rainbow.py +++ b/rainbowstream/rainbow.py @@ -312,7 +312,7 @@ def quote(): """ Quote a tweet """ - # Retrieve info + # Get tweet t = Twitter(auth=authen()) try: id = int(g['stuff'].split()[0]) @@ -321,34 +321,16 @@ def quote(): return tid = c['tweet_dict'][id] tweet = t.statuses.show(id=tid) - screen_name = '@' + tweet['user']['screen_name'] - text = tweet['text'] - # Validate quote format - if '#owner' not in c['QUOTE_FORMAT']: - printNicely(light_magenta('Quote should contains #owner')) + # Get formater + formater = format_quote(tweet) + if not formater: return - if '#comment' not in c['QUOTE_FORMAT']: - printNicely(light_magenta('Quote format should have #comment')) - return - # Notice - notice = light_magenta('Current quote format is: ') - notice += light_green(c['QUOTE_FORMAT']) - printNicely(notice) - # Build formater - formater = '' - try: - formater = c['QUOTE_FORMAT'] - formater = screen_name.join(formater.split('#owner')) - formater = text.join(formater.split('#tweet')) - formater = u2str(formater) - except: - pass # Get comment prefix = light_magenta('Compose your ') + light_green('#comment: ') comment = raw_input(prefix) if comment: quote = comment.join(formater.split('#comment')) - t.statuses.update(status = quote) + t.statuses.update(status=quote) else: printNicely(light_magenta('No text added.')) @@ -1365,7 +1347,7 @@ def help(): light_yellow('already') + ' on your personal stream.\n' usage += s + 'Any update from Twitter will show up ' + \ light_yellow('immediately') + '.\n' - usage += s + 'In addtion, following commands are available right now:\n' + usage += s + 'In addition, following commands are available right now:\n' # Twitter help section usage += '\n' usage += s + grey(u'\u266A' + ' Twitter help\n')