From 89bc51b1f90e459f1b712f944750a42ca164bdc6 Mon Sep 17 00:00:00 2001 From: Marat Fayzullin Date: Tue, 21 Feb 2023 23:05:11 -0500 Subject: [PATCH] Adding limit to the number of stored files. --- owrx/config/defaults.py | 1 + owrx/controllers/file.py | 2 +- owrx/controllers/settings/general.py | 10 ++++++++-- owrx/details.py | 3 ++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/owrx/config/defaults.py b/owrx/config/defaults.py index e028e4db..e6685e86 100644 --- a/owrx/config/defaults.py +++ b/owrx/config/defaults.py @@ -162,6 +162,7 @@ defaultConfig = PropertyLayer( callsign_url="https://www.qrzcq.com/call/{}", usage_policy_url="policy", session_timeout=0, + keep_files=20, decoding_queue_workers=2, decoding_queue_length=10, wsjt_decoding_depth=3, diff --git a/owrx/controllers/file.py b/owrx/controllers/file.py index 4ec64191..fcb5819c 100644 --- a/owrx/controllers/file.py +++ b/owrx/controllers/file.py @@ -25,7 +25,7 @@ class FilesController(WebpageController): for f in files[keepN:]: try: os.unlink(dir + "/" + f) - except: + except Exception: pass def template_variables(self): diff --git a/owrx/controllers/settings/general.py b/owrx/controllers/settings/general.py index fa674166..a96eea1c 100644 --- a/owrx/controllers/settings/general.py +++ b/owrx/controllers/settings/general.py @@ -70,18 +70,24 @@ class GeneralSettingsController(SettingsFormController): NumberInput( "max_clients", "Maximum number of clients", + infotext="Number of people who can connect at the same time.", + ), + NumberInput( + "keep_files", + "Maximum number of files", + infotext="Number of received images and other files to keep.", ), NumberInput( "session_timeout", "Session timeout", - infotext="User session timeout in seconds (0 to disable timeout).", + infotext="Client session timeout in seconds (0 to disable timeout).", append="secs", ), TextInput( "usage_policy_url", "Usage policy URL", infotext="Specifies web page describing receiver usage policy " - + "and shown when the user session times out.", + + "and shown when a client session times out.", ), ), Section( diff --git a/owrx/details.py b/owrx/details.py index 5d979b97..ba672029 100644 --- a/owrx/details.py +++ b/owrx/details.py @@ -19,7 +19,8 @@ class ReceiverDetails(PropertyFilter): "photo_title", "photo_desc", "usage_policy_url", - "session_timeout", + "session_timeout", + "keep_files", ) )