curls follow redirects. file listings have days to removal
This commit is contained in:
@@ -154,9 +154,18 @@ def file_mime(filename):
|
||||
# magic not imported
|
||||
return "NA"
|
||||
|
||||
def file_stat(path, filename):
|
||||
full_path = os.path.join(path, filename)
|
||||
def file_stat(share, filename):
|
||||
|
||||
full_path = os.path.join(share['path'], filename)
|
||||
s = os.stat(full_path)
|
||||
autoremove = get_or_none('autoremove', share, 0)
|
||||
if autoremove == 0:
|
||||
to_remove = "NA"
|
||||
else:
|
||||
now = datetime.now()
|
||||
then = datetime.fromtimestamp(s.st_mtime)
|
||||
diff = now - then
|
||||
to_remove = "%d d"%( autoremove - diff.days, )
|
||||
return {
|
||||
'size': file_size_MB(s.st_size),
|
||||
'hsize': file_size_human(s.st_size, HTML = False),
|
||||
@@ -164,7 +173,8 @@ def file_stat(path, filename):
|
||||
'name': filename,
|
||||
'url': path2url(filename),
|
||||
'editable': (s.st_size < 65536 and filename.endswith(".txt")),
|
||||
'mime': file_mime(full_path)
|
||||
'mime': file_mime(full_path),
|
||||
'to_remove': to_remove
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user