projects
/
rainbowstream.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
83be0cb
)
quote and pause bug fix
author
Orakaro
<nhatminh_179@hotmail.com>
Sun, 24 Aug 2014 07:32:32 +0000
(16:32 +0900)
committer
Orakaro
<nhatminh_179@hotmail.com>
Sun, 24 Aug 2014 07:32:32 +0000
(16:32 +0900)
docs/conf.py
patch
|
blob
|
blame
|
history
rainbowstream/draw.py
patch
|
blob
|
blame
|
history
rainbowstream/rainbow.py
patch
|
blob
|
blame
|
history
screenshot/themes/Monokai.png
patch
|
blob
|
blame
|
history
screenshot/themes/Solarized.png
patch
|
blob
|
blame
|
history
screenshot/themes/TomorrowNight.png
patch
|
blob
|
blame
|
history
screenshot/themes/larapaste.png
patch
|
blob
|
blame
|
history
setup.py
patch
|
blob
|
blame
|
history
diff --git
a/docs/conf.py
b/docs/conf.py
index
f219765
..
ece453c
100644
(file)
--- 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.
# built documents.
#
# The short X.Y version.
-version = '0.8.
5
'
+version = '0.8.
6
'
# The full version, including alpha/beta/rc tags.
# The full version, including alpha/beta/rc tags.
-release = '0.8.
5
'
+release = '0.8.
6
'
# 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.
diff --git
a/rainbowstream/draw.py
b/rainbowstream/draw.py
index
4fbe827
..
bfa3e2c
100644
(file)
--- a/
rainbowstream/draw.py
+++ b/
rainbowstream/draw.py
@@
-144,18
+144,10
@@
def color_func(func_name):
return globals()[func_name]
return globals()[func_name]
-def draw(t, keyword=None, humanize=True,
check_semaphore=False,
fil=[], ig=[]):
+def draw(t, keyword=None, humanize=True, fil=[], ig=[]):
"""
Draw the rainbow
"""
"""
Draw the rainbow
"""
-
- # Check the semaphore pause and lock (stream process only)
- if check_semaphore:
- if c['pause']:
- return
- while c['lock']:
- time.sleep(0.5)
-
# Check config
check_config()
# Check config
check_config()
@@
-318,18
+310,10
@@
def draw(t, keyword=None, humanize=True, check_semaphore=False, fil=[], ig=[]):
printNicely(red('Sorry, image link is broken'))
printNicely(red('Sorry, image link is broken'))
-def print_message(m
, check_semaphore=False
):
+def print_message(m):
"""
Print direct message
"""
"""
Print direct message
"""
-
- # Check the semaphore pause and lock (stream process only)
- if check_semaphore:
- if c['pause']:
- return
- while c['lock']:
- time.sleep(0.5)
-
# Retrieve message
sender_screen_name = '@' + m['sender_screen_name']
sender_name = m['sender']['name']
# Retrieve message
sender_screen_name = '@' + m['sender_screen_name']
sender_name = m['sender']['name']
@@
-574,31
+558,31
@@
def format_quote(tweet):
except:
pass
# Highlight like a tweet
except:
pass
# Highlight like a tweet
-
formater
= formater.split()
-
formater
= lmap(
+
notice
= formater.split()
+
notice
= lmap(
lambda x: light_green(x)
if x == '#comment'
else x,
lambda x: light_green(x)
if x == '#comment'
else x,
-
formater
)
-
formater
= lmap(
+
notice
)
+
notice
= lmap(
lambda x: color_func(c['TWEET']['rt'])(x)
if x == 'RT'
else x,
lambda x: color_func(c['TWEET']['rt'])(x)
if x == 'RT'
else x,
-
formater
)
-
formater = lmap(lambda x: cycle_color(x) if x[0] == '@' else x, formater
)
-
formater
= lmap(
+
notice
)
+
notice = lmap(lambda x: cycle_color(x) if x[0] == '@' else x, notice
)
+
notice
= lmap(
lambda x: color_func(c['TWEET']['link'])(x)
if x[0:4] == 'http'
else x,
lambda x: color_func(c['TWEET']['link'])(x)
if x[0:4] == 'http'
else x,
-
formater
)
-
formater
= lmap(
+
notice
)
+
notice
= lmap(
lambda x: color_func(c['TWEET']['hashtag'])(x)
if x.startswith('#')
else x,
lambda x: color_func(c['TWEET']['hashtag'])(x)
if x.startswith('#')
else x,
-
formater
)
-
formater = ' '.join(formater
)
+
notice
)
+
notice = ' '.join(notice
)
# Notice
# Notice
- notice = light_magenta('Quoting: "') +
formater
+ light_magenta('"')
+ notice = light_magenta('Quoting: "') +
notice
+ light_magenta('"')
printNicely(notice)
return formater
printNicely(notice)
return formater
diff --git
a/rainbowstream/rainbow.py
b/rainbowstream/rainbow.py
index
c497937
..
94b2e4b
100644
(file)
--- a/
rainbowstream/rainbow.py
+++ b/
rainbowstream/rainbow.py
@@
-127,11
+127,11
@@
def init(args):
files = os.listdir(os.path.dirname(__file__) + '/colorset')
themes = [f.split('.')[0] for f in files if f.split('.')[-1] == 'json']
g['themes'] = themes
files = os.listdir(os.path.dirname(__file__) + '/colorset')
themes = [f.split('.')[0] for f in files if f.split('.')[-1] == 'json']
g['themes'] = themes
+ g['pause'] = False
# Startup cmd
g['cmd'] = ''
# Semaphore init
c['lock'] = False
# Startup cmd
g['cmd'] = ''
# Semaphore init
c['lock'] = False
- c['pause'] = False
# Init tweet dict and message dict
c['tweet_dict'] = []
c['message_dict'] = []
# Init tweet dict and message dict
c['tweet_dict'] = []
c['message_dict'] = []
@@
-1450,7
+1450,7
@@
def pause():
"""
Pause stream display
"""
"""
Pause stream display
"""
-
c
['pause'] = True
+
g
['pause'] = True
printNicely(green('Stream is paused'))
printNicely(green('Stream is paused'))
@@
-1458,7
+1458,7
@@
def replay():
"""
Replay stream
"""
"""
Replay stream
"""
-
c
['pause'] = False
+
g
['pause'] = False
printNicely(green('Stream is running back now'))
printNicely(green('Stream is running back now'))
@@
-1760,11
+1760,16
@@
def stream(domain, args, name='Rainbow Stream'):
elif tweet is Hangup:
printNicely("-- Hangup --")
elif tweet.get('text'):
elif tweet is Hangup:
printNicely("-- Hangup --")
elif tweet.get('text'):
+ # Check the semaphore pause and lock (stream process only)
+ if g['pause']:
+ continue
+ while c['lock']:
+ time.sleep(0.5)
+ # Draw the tweet
draw(
t=tweet,
keyword=args.track_keywords,
humanize=False,
draw(
t=tweet,
keyword=args.track_keywords,
humanize=False,
- check_semaphore=True,
fil=args.filter,
ig=args.ignore,
)
fil=args.filter,
ig=args.ignore,
)
@@
-1782,7
+1787,12
@@
def stream(domain, args, name='Rainbow Stream'):
sys.stdout.write(g['decorated_name'](c['PREFIX']))
sys.stdout.flush()
elif tweet.get('direct_message'):
sys.stdout.write(g['decorated_name'](c['PREFIX']))
sys.stdout.flush()
elif tweet.get('direct_message'):
- print_message(tweet['direct_message'], check_semaphore=True)
+ # Check the semaphore pause and lock (stream process only)
+ if g['pause']:
+ continue
+ while c['lock']:
+ time.sleep(0.5)
+ print_message(tweet['direct_message'])
except TwitterHTTPError:
printNicely('')
printNicely(
except TwitterHTTPError:
printNicely('')
printNicely(
diff --git
a/screenshot/themes/Monokai.png
b/screenshot/themes/Monokai.png
index
0da6361
..
9c56c2d
100644
(file)
Binary files a/screenshot/themes/Monokai.png and b/screenshot/themes/Monokai.png differ
diff --git
a/screenshot/themes/Solarized.png
b/screenshot/themes/Solarized.png
index
50df993
..
2237320
100644
(file)
Binary files a/screenshot/themes/Solarized.png and b/screenshot/themes/Solarized.png differ
diff --git
a/screenshot/themes/TomorrowNight.png
b/screenshot/themes/TomorrowNight.png
index
520c616
..
d07631c
100644
(file)
Binary files a/screenshot/themes/TomorrowNight.png and b/screenshot/themes/TomorrowNight.png differ
diff --git
a/screenshot/themes/larapaste.png
b/screenshot/themes/larapaste.png
index
866c077
..
376dee7
100644
(file)
Binary files a/screenshot/themes/larapaste.png and b/screenshot/themes/larapaste.png differ
diff --git
a/setup.py
b/setup.py
index
1bd609e
..
a4e6dba
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 = '0.8.
5
'
+version = '0.8.
6
'
# Require
install_requires = [
# Require
install_requires = [