Add toggle to disable auto-clearing slskd search history
Users who keep manual searches in slskd as reminders were losing them when SoulSync auto-cleaned at 200+ entries. New toggle in Settings → Downloads → Soulseek: "Auto-clear slskd search history" (on by default, preserving current behavior). When disabled, both the hourly cleanup automation and the full cleanup step skip the search history maintenance.
This commit is contained in:
parent
d1397722e2
commit
cfe2ab7dec
3 changed files with 27 additions and 8 deletions
|
|
@ -1316,6 +1316,10 @@ def _register_automation_handlers():
|
|||
def _auto_clean_search_history(config):
|
||||
"""Remove old searches from Soulseek."""
|
||||
automation_id = config.get('_automation_id')
|
||||
if not config_manager.get('soulseek.auto_clear_searches', True):
|
||||
_update_automation_progress(automation_id,
|
||||
log_line='Auto-clear disabled in settings', log_type='skip')
|
||||
return {'status': 'skipped'}
|
||||
try:
|
||||
success = run_async(soulseek_client.maintain_search_history_with_buffer(
|
||||
keep_searches=50, trigger_threshold=200
|
||||
|
|
@ -1458,15 +1462,20 @@ def _register_automation_handlers():
|
|||
_update_automation_progress(automation_id,
|
||||
log_line=f'Staging: removed {s_removed} empty directories', log_type='success' if s_removed else 'info')
|
||||
|
||||
# --- 5. Clean search history ---
|
||||
# --- 5. Clean search history (if enabled) ---
|
||||
_update_automation_progress(automation_id, phase='Cleaning search history...', progress=80)
|
||||
try:
|
||||
run_async(soulseek_client.maintain_search_history_with_buffer(
|
||||
keep_searches=50, trigger_threshold=200
|
||||
))
|
||||
steps.append('Search history: cleaned')
|
||||
_update_automation_progress(automation_id,
|
||||
log_line='Search history: cleaned', log_type='success')
|
||||
if not config_manager.get('soulseek.auto_clear_searches', True):
|
||||
steps.append('Search cleanup: disabled in settings')
|
||||
_update_automation_progress(automation_id,
|
||||
log_line='Search cleanup: disabled in settings', log_type='skip')
|
||||
else:
|
||||
run_async(soulseek_client.maintain_search_history_with_buffer(
|
||||
keep_searches=50, trigger_threshold=200
|
||||
))
|
||||
steps.append('Search history: cleaned')
|
||||
_update_automation_progress(automation_id,
|
||||
log_line='Search history: cleaned', log_type='success')
|
||||
except Exception as e:
|
||||
steps.append(f'Search history: error ({e})')
|
||||
_update_automation_progress(automation_id,
|
||||
|
|
|
|||
|
|
@ -4218,6 +4218,14 @@
|
|||
max="60" value="10">
|
||||
<small class="settings-hint">Abandon stuck downloads after this many minutes</small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" id="soulseek-auto-clear-searches" checked>
|
||||
Auto-clear slskd search history
|
||||
</label>
|
||||
<small class="settings-hint">Automatically cleans old searches from slskd when over 200 entries.
|
||||
Disable if you want to keep manual searches in slskd's queue.</small>
|
||||
</div>
|
||||
<div class="form-actions" style="margin-top: 8px;">
|
||||
<button class="test-button" onclick="testConnection('soulseek')">Test Soulseek Connection</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -5710,6 +5710,7 @@ async function loadSettingsData() {
|
|||
document.getElementById('soulseek-min-peer-speed').value = settings.soulseek?.min_peer_upload_speed || 0;
|
||||
document.getElementById('soulseek-max-peer-queue').value = settings.soulseek?.max_peer_queue || 0;
|
||||
document.getElementById('soulseek-download-timeout').value = Math.round((settings.soulseek?.download_timeout || 600) / 60);
|
||||
document.getElementById('soulseek-auto-clear-searches').checked = settings.soulseek?.auto_clear_searches !== false;
|
||||
|
||||
// Populate ListenBrainz settings
|
||||
document.getElementById('listenbrainz-base-url').value = settings.listenbrainz?.base_url || '';
|
||||
|
|
@ -6764,7 +6765,8 @@ async function saveSettings(quiet = false) {
|
|||
search_timeout_buffer: parseInt(document.getElementById('soulseek-search-timeout-buffer').value) || 15,
|
||||
min_peer_upload_speed: parseInt(document.getElementById('soulseek-min-peer-speed').value) || 0,
|
||||
max_peer_queue: parseInt(document.getElementById('soulseek-max-peer-queue').value) || 0,
|
||||
download_timeout: (parseInt(document.getElementById('soulseek-download-timeout').value) || 10) * 60
|
||||
download_timeout: (parseInt(document.getElementById('soulseek-download-timeout').value) || 10) * 60,
|
||||
auto_clear_searches: document.getElementById('soulseek-auto-clear-searches').checked
|
||||
},
|
||||
listenbrainz: {
|
||||
base_url: document.getElementById('listenbrainz-base-url').value,
|
||||
|
|
|
|||
Loading…
Reference in a new issue