Skip to content

Commit

Permalink
[jsk_robot_startup/smach_to_mail.py] Add space for concatenated base6…
Browse files Browse the repository at this point in the history
…4 images
  • Loading branch information
iory authored and tkmtnt7000 committed Sep 8, 2022
1 parent 408f551 commit c069170
Showing 1 changed file with 7 additions and 0 deletions.
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 @@ -197,17 +197,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

0 comments on commit c069170

Please sign in to comment.