refined autoremove support

This commit is contained in:
2018-11-18 09:42:41 +02:00
parent 375628255d
commit 9e20d4e115
6 changed files with 55 additions and 27 deletions

View File

@@ -1,6 +1,5 @@
import os
from datetime import datetime
from dateutil.relativedelta import relativedelta
from flask import current_app as app
import requests
import re
@@ -122,12 +121,14 @@ def file_age(path):
os.stat(path).st_mtime
)
diff = now - then
rdiff = relativedelta(now, then)
return diff, "%dM %02dD %02d:%02dH" % (
rdiff.years * 12 + rdiff.months,
rdiff.days,
rdiff.hours,
rdiff.minutes
return (
diff,
"%03d d %s"%(
diff.days,
datetime.utcfromtimestamp(
diff.seconds
).strftime('%H:%M:%S')
)
)