'server': ui['email_notifications_smtp_server'],
'port': ui['email_notifications_smtp_port'],
'account': ui['email_notifications_smtp_account'],
- 'password': ui['email_notifications_smtp_password'],
+ 'password': ui['email_notifications_smtp_password'].replace(';', '\\;'),
'tls': ui['email_notifications_smtp_tls'],
'to': emails,
'timespan': ui['email_notifications_picture_time_span']})
'url': url})
if ui['command_notifications_enabled']:
- commands = ui['command_notifications_exec'].split(';')
- on_event_start += [c.strip() for c in commands]
+ on_event_start += utils.split_semicolon(ui['command_notifications_exec'])
data['on_event_start'] = '; '.join(on_event_start)
'url': url})
if ui['command_storage_enabled']:
- commands = ui['command_storage_exec'].split(';')
- on_movie_end += [c.strip() for c in commands]
+ on_movie_end += utils.split_semicolon(ui['command_storage_exec'])
data['on_movie_end'] = '; '.join(on_movie_end)
'url': url})
if ui['command_storage_enabled']:
- commands = ui['command_storage_exec'].split(';')
- on_picture_save += [c.strip() for c in commands]
+ on_picture_save += utils.split_semicolon(ui['command_storage_exec'])
data['on_picture_save'] = '; '.join(on_picture_save)
# event start
on_event_start = data.get('on_event_start') or []
if on_event_start:
- on_event_start = [e.strip() for e in on_event_start.split(';')]
+ on_event_start = utils.split_semicolon(on_event_start)
ui['email_notifications_picture_time_span'] = 0
command_notifications = []
ui['email_notifications_smtp_server'] = e[-10]
ui['email_notifications_smtp_port'] = e[-9]
ui['email_notifications_smtp_account'] = e[-8]
- ui['email_notifications_smtp_password'] = e[-7]
+ ui['email_notifications_smtp_password'] = e[-7].replace('\\;', ';')
ui['email_notifications_smtp_tls'] = e[-6].lower() == 'true'
ui['email_notifications_addresses'] = e[-5]
try:
# movie end
on_movie_end = data.get('on_movie_end') or []
if on_movie_end:
- on_movie_end = [e.strip() for e in on_movie_end.split(';')]
+ on_movie_end = utils.split_semicolon(on_movie_end)
command_storage = []
for e in on_movie_end:
message = messages.get(options.msg_id)
subject = subjects.get(options.msg_id)
options.moment = datetime.datetime.strptime(options.moment, '%Y-%m-%dT%H:%M:%S')
+ options.password = options.password.replace('\\;', ';') # unescape password
# do not wait too long for media list,
# email notifications are critical
<tr class="settings-item advanced-setting" required="true" depends="commandStorageEnabled" strip="true">
<td class="settings-item-label"><span class="settings-item-label">Command</span></td>
<td class="settings-item-value"><input type="text" class="styled storage camera-config" id="commandStorageEntry" placeholder="command..."></td>
- <td><span class="help-mark" title="a command to be executed after a media file is created; multiple commands can be separated by a semicolon; the following special tokens are accepted: %Y = year, %m = month, %d = date, %H = hour, %M = minute, %S = second, %f = file path">?</span></td>
+ <td><span class="help-mark" title="a command to be executed after a media file is created; multiple commands can be separated by a semicolon; don't use semicolons inside commands; the following special tokens are accepted: %Y = year, %m = month, %d = date, %H = hour, %M = minute, %S = second, %f = file path">?</span></td>
</tr>
{% for config in camera_sections.get('storage', {}).get('configs', []) %}
{{config_item(config)}}
<tr class="settings-item advanced-setting" required="true" depends="commandNotificationsEnabled motionDetectionEnabled" strip="true">
<td class="settings-item-label"><span class="settings-item-label">Command</span></td>
<td class="settings-item-value"><input type="text" class="styled notifications camera-config" id="commandNotificationsEntry" placeholder="command..."></td>
- <td><span class="help-mark" title="a command to be executed when motion is detected; multiple commands can be separated by a semicolon; the following special tokens are accepted: %Y = year, %m = month, %d = date, %H = hour, %M = minute, %S = second, %q = frame number">?</span></td>
+ <td><span class="help-mark" title="a command to be executed when motion is detected; multiple commands can be separated by a semicolon; don't use semilcolons inside commands; the following special tokens are accepted: %Y = year, %m = month, %d = date, %H = hour, %M = minute, %S = second, %q = frame number">?</span></td>
</tr>
{% for config in camera_sections.get('notifications', {}).get('configs', []) %}
{{config_item(config, "motionDetectionEnabled")}}
return str(s).decode('utf8')
+def split_semicolon(s):
+ parts = s.split(';')
+ merged_parts = []
+ for p in parts:
+ if merged_parts and merged_parts[-1][-1] == '\\':
+ merged_parts[-1] = merged_parts[-1][:-1] + ';' + p
+
+ else:
+ merged_parts.append(p)
+
+ if not merged_parts:
+ return []
+
+ return [p.strip() for p in merged_parts]
+
+
def get_disk_usage(path):
logging.debug('getting disk usage for path %(path)s...' % {
'path': path})