Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jsk_robot_startup/smach_to_mail.py] Add space for concatenated base64 images #8

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions jsk_robot_common/jsk_robot_startup/scripts/smach_to_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,24 @@ def _send_twitter(self, subject, state_list):
if isinstance(subject, bytes):
subject = subject.decode('utf-8')
text += subject
prev_text_type = ''
for x in state_list:
if 'DESCRIPTION' in x and x['DESCRIPTION']:
desc = x['DESCRIPTION']
if isinstance(desc, bytes):
desc = desc.decode('utf-8')
text += '\n' + desc
prev_text_type = 'DESCRIPTION'
if 'IMAGE' in x and x['IMAGE']:
img_txt = x['IMAGE']
if isinstance(img_txt, bytes):
img_txt = img_txt.decode('utf-8')
if prev_text_type == 'IMAGE':
# [rostwitter] Do not concatenate
# multiple base64 images without spaces.
text += ' '
text += img_txt
prev_text_type = 'IMAGE'
if len(text) > 1:
self.pub_twitter.publish(String(text))

Expand Down