inform about file size

This commit is contained in:
Ville Rantanen
2016-12-22 09:02:56 +02:00
parent badc2a66e0
commit bf2f587a2b

View File

@@ -98,14 +98,17 @@ def add_recurse(options):
return
def add_single(conn,filename,change=False,hash=None,minsize=0,fullfile=False):
print "%(f)s" % {'f':filename}
try:
fsize=os.path.getsize(filename)
hsize=humanize_size(fsize)
except IOError:
hsize=""
print("%s (%s)"%(filename,hsize))
db=conn.cursor()
try:
if hash==None:
hash=get_md5(filename,fullfile)
ftime=os.path.getmtime(filename)
fsize=os.path.getsize(filename)
mime=MIME.file(filename.encode('UTF-8'))
except IOError:
print("File '%s' not found. Bad link?"%(filename,))