more conditions in automations

This commit is contained in:
Mateusz Gruszczyński
2026-05-06 21:58:49 +02:00
parent 21cbd5baa6
commit e2017b8344
5 changed files with 111 additions and 59 deletions

View File

@@ -137,8 +137,11 @@ def _apply_effects(c: Any, profile: dict[str, Any], torrent: dict[str, Any], eff
for eff in effects:
typ = str(eff.get('type') or '')
if typ == 'move':
# Note: Automation move-to-path now uses the same move implementation as the main app action.
path = str(eff.get('path') or '').strip() or rtorrent.default_download_path(profile)
if path: c.call('d.directory.set', h, path); applied.append({'type': 'move', 'path': path})
move_payload = {'path': path, 'move_data': bool(eff.get('move_data')), 'recheck': bool(eff.get('recheck', eff.get('move_data'))), 'keep_seeding': bool(eff.get('keep_seeding'))}
result = rtorrent.move_torrents(profile, [h], move_payload) if path else None
if path: applied.append({'type': 'move', 'path': path, 'move_data': bool(eff.get('move_data')), 'recheck': bool(move_payload['recheck']), 'keep_seeding': bool(eff.get('keep_seeding')), 'result': result})
elif typ == 'add_label':
label = str(eff.get('label') or '').strip()
if label and label not in labels: labels.append(label); c.call('d.custom1.set', h, _label_value(labels))