diff sat/core/constants.py @ 3187:d92a144f3589

plugin download: use cache if dest_path is empty: if dest_path is not set, the file will be downloaded in cache. A new name will be generated using a hash of the uri. If the file is already downloded in cache, it won't be downloaded again (in this case returned progress_id is an empty string).
author Goffi <goffi@goffi.org>
date Wed, 26 Feb 2020 22:03:11 +0100
parents 343b8076e967
children a15773c6c273
line wrap: on
line diff
--- a/sat/core/constants.py	Wed Feb 26 15:54:43 2020 +0100
+++ b/sat/core/constants.py	Wed Feb 26 22:03:11 2020 +0100
@@ -346,6 +346,8 @@
     ## Files ##
     FILE_TYPE_DIRECTORY = "directory"
     FILE_TYPE_FILE = "file"
+    # when filename can't be found automatically, this one will be used
+    FILE_DEFAULT_NAME = "unnamed"
 
     ## Permissions management ##
     ACCESS_PERM_READ = "read"
@@ -378,10 +380,13 @@
     ## Misc ##
     SAVEFILE_DATABASE = APP_NAME_FILE + ".db"
     IQ_SET = '/iq[@type="set"]'
-    ENV_PREFIX = "SAT_"  # Prefix used for environment variables
+    # Prefix used for environment variables
+    ENV_PREFIX = "SAT_"
     IGNORE = "ignore"
-    NO_LIMIT = -1  # used in bridge when a integer value is expected
-    DEFAULT_MAX_AGE = 1209600  # default max age of cached files, in seconds
+    # used in bridge when a integer value is expected
+    NO_LIMIT = -1
+    # default max age of cached files, in seconds
+    DEFAULT_MAX_AGE = 3600 * 24 * 14
     HASH_SHA1_EMPTY = "da39a3ee5e6b4b0d3255bfef95601890afd80709"
     STANZA_NAMES = ("iq", "message", "presence")