feat: auto-remove watched downloads, server watched threshold

close #856
This commit is contained in:
edde746
2026-04-13 22:46:49 +02:00
parent f7e3408c86
commit bc4b4955da
39 changed files with 339 additions and 47 deletions
+20
View File
@@ -82,6 +82,8 @@ class SettingsService extends BaseSharedPreferencesService {
static const String _keyCustomDownloadPath = 'custom_download_path';
static const String _keyCustomDownloadPathType = 'custom_download_path_type';
static const String _keyDownloadOnWifiOnly = 'download_on_wifi_only';
static const String _keyAutoRemoveWatchedDownloads = 'auto_remove_watched_downloads';
static const String _prefixWatchedThreshold = 'watched_threshold_';
static const String _keyVideoPlayerNavigationEnabled = 'video_player_navigation_enabled';
static const String _keyShowPerformanceOverlay = 'show_performance_overlay';
static const String _keyAutoHidePerformanceOverlay = 'auto_hide_performance_overlay';
@@ -957,6 +959,24 @@ class SettingsService extends BaseSharedPreferencesService {
return prefs.getBool(_keyDownloadOnWifiOnly) ?? false;
}
// Auto-remove watched downloads
Future<void> setAutoRemoveWatchedDownloads(bool value) async {
await prefs.setBool(_keyAutoRemoveWatchedDownloads, value);
}
bool getAutoRemoveWatchedDownloads() {
return prefs.getBool(_keyAutoRemoveWatchedDownloads) ?? false;
}
// Per-server watched threshold (cached from server prefs)
Future<void> setWatchedThreshold(String serverId, int percent) async {
await prefs.setInt('$_prefixWatchedThreshold$serverId', percent);
}
int getWatchedThreshold(String serverId) {
return prefs.getInt('$_prefixWatchedThreshold$serverId') ?? 90;
}
// MPV Config (raw text)
/// Get the raw MPV config text. Migrates from legacy JSON entries on first read.