diff --git a/qalbum/Qalbum.py b/qalbum/Qalbum.py index 173bf6d..c692d84 100755 --- a/qalbum/Qalbum.py +++ b/qalbum/Qalbum.py @@ -324,6 +324,7 @@ def createthumbs(path,list,options): nsum=len(list) r=str(options.width) res=r+'x'+r+'>' + print('') for i in list: outmedium=os.path.join(path,'.med',i+'.jpg') outthumb=os.path.join(path,'.tn',i+'.jpg') @@ -333,12 +334,13 @@ def createthumbs(path,list,options): if (options.force) and os.path.exists(outthumb): os.unlink(outthumb) if (not os.path.exists(outmedium)): - print('Medium.. '+i+' '+str(n)+'/'+str(nsum)) + print_clear('Medium.. '+str(n)+'/'+str(nsum)+' '+i) create_medium_bitmap(inpath,outmedium,r,link=options.link,vector=vectorsearch.match(i)) if (not os.path.exists(outthumb)): - print('Thumbnail.. '+i+' '+str(n)+'/'+str(nsum)) + print_clear('Thumbnail.. '+str(n)+'/'+str(nsum)+' '+i) create_thumb_bitmap(outmedium,outthumb,vector=vectorsearch.match(i),gravity=options.gravity) n+=1 + print_clear('') return def create_medium_bitmap(infile,outfile,r,link=False,vector=False): @@ -407,6 +409,11 @@ def crumblinks(crumbs,title,parent): strout+='' return strout +def print_clear(s): + sys.stdout.write("\033[1K\r") + sys.stdout.write(str(s)) + sys.stdout.flush() + def nicestring(s): ''' Returns a nice version of a long string ''' s = unicode(s, encoding = "utf8") @@ -428,11 +435,13 @@ def sizestring(size): return "%3.1f%s" % (size, x) size /= 1024.0 + def natural_sort_key(s, _nsre=re.compile('([0-9]+)')): ''' Natural sort / Claudiu@Stackoverflow ''' return [int(text) if text.isdigit() else text.lower() for text in re.split(_nsre, s)] + def which(program): ''' emulate shell which command ''' def is_exe(fpath):