diff --git a/core/automation_engine.py b/core/automation_engine.py index 815a939b..bda829c2 100644 --- a/core/automation_engine.py +++ b/core/automation_engine.py @@ -91,6 +91,13 @@ SYSTEM_AUTOMATIONS = [ 'action_type': 'deep_scan_library', 'initial_delay': 900, # 15 min after startup }, + { + 'name': 'Auto-Backup Database', + 'trigger_type': 'schedule', + 'trigger_config': {'interval': 3, 'unit': 'days'}, + 'action_type': 'backup_database', + 'initial_delay': 600, # 10 min after startup + }, ] diff --git a/web_server.py b/web_server.py index edd065f6..1f8393dd 100644 --- a/web_server.py +++ b/web_server.py @@ -856,7 +856,7 @@ def _register_automation_handlers(): db_path = os.environ.get('DATABASE_PATH', 'database/music_library.db') if not os.path.exists(db_path): return {'status': 'error', 'reason': 'Database file not found'} - max_backups = 3 + max_backups = 5 timestamp = datetime.now().strftime('%Y%m%d_%H%M%S') backup_path = f"{db_path}.backup_{timestamp}" # Use SQLite backup API for safe hot-copy of active database