manage cli messages commands, add size, remove command, colors in printing inifile
This commit is contained in:
parent
7a838d2317
commit
6a81cdd89a
150
impra/cli.py
150
impra/cli.py
|
@ -66,10 +66,10 @@ ImpraStorage randomly upload each parts then update the index.
|
||||||
|
|
||||||
def printLineSep(sep,lenSep):
|
def printLineSep(sep,lenSep):
|
||||||
""""""
|
""""""
|
||||||
Clz.print(sep*lenSep, Clz.fgB0)
|
Clz.print(sep*lenSep, Clz.fgN0)
|
||||||
def printHeaderTitle(title):
|
def printHeaderTitle(title):
|
||||||
""""""
|
""""""
|
||||||
Clz.print(' -- %s -- ' % title, Clz.BG4+Clz.fgB7, False, True)
|
Clz.print(' == '+title+' == ', Clz.BG4+Clz.fgB7, False, True)
|
||||||
|
|
||||||
def printHeaderPart(label,value):
|
def printHeaderPart(label,value):
|
||||||
""""""
|
""""""
|
||||||
|
@ -169,6 +169,7 @@ data command Examples:
|
||||||
gpData.add_option('-r', '--remove' , help='remove FILE with specified ID from server' , action='store', metavar='ID ')
|
gpData.add_option('-r', '--remove' , help='remove FILE with specified ID from server' , action='store', metavar='ID ')
|
||||||
gpData.add_option('-c', '--category' , help='set specified CATEGORY (crit. for opt. -l,-a or -s)' , action='store', metavar='CATG ' , default='')
|
gpData.add_option('-c', '--category' , help='set specified CATEGORY (crit. for opt. -l,-a or -s)' , action='store', metavar='CATG ' , default='')
|
||||||
gpData.add_option('-u', '--user' , help='set specified USER (crit. for opt. -l,-a or -s)' , action='store', metavar='OWNER ' , default='all')
|
gpData.add_option('-u', '--user' , help='set specified USER (crit. for opt. -l,-a or -s)' , action='store', metavar='OWNER ' , default='all')
|
||||||
|
gpData.add_option('-o', '--order' , help='set colon ORDER (crit. for opt. -l and -s)' , action='store', metavar='ORDER ' , default='ID')
|
||||||
#gpData.add_option('-o', '--output-dir' , help='set specified OUTPUT DIR (for opt. -l,-a,-d or -g)' , action='store', metavar='DIR ')
|
#gpData.add_option('-o', '--output-dir' , help='set specified OUTPUT DIR (for opt. -l,-a,-d or -g)' , action='store', metavar='DIR ')
|
||||||
parser.add_option_group(gpData)
|
parser.add_option_group(gpData)
|
||||||
|
|
||||||
|
@ -187,8 +188,62 @@ data command Examples:
|
||||||
|
|
||||||
(o, a) = parser.parse_args()
|
(o, a) = parser.parse_args()
|
||||||
|
|
||||||
|
# USAGE :
|
||||||
|
#
|
||||||
|
# imprastorage add {filePath} [{name} -c {category} -u {owner}]
|
||||||
|
# imprastorage list [-o {colon}, -c {category} -u {owner}]
|
||||||
|
# imprastorage get {id|ids} | -n {name}
|
||||||
|
# imprastorage remove {id} | -n {name}
|
||||||
|
# imprastorage search {pattern} [-c {category} -u {owner} -o {colon}]
|
||||||
|
# imprastorage conf [-A profileName] -L | -V |
|
||||||
|
# -S [-K, -H {host}, -U {user}, -X {password}, -P {port}, -B {box}, -N {name}]
|
||||||
|
#
|
||||||
|
# EXEMPLES :
|
||||||
|
#
|
||||||
|
# command add :
|
||||||
|
# imprastorage add /home/Share/2009-mountains.avi
|
||||||
|
# imprastorage add /home/Share/2009-mountains.avi 'summer 2009 - in mountains'
|
||||||
|
# imprastorage add /home/Share/2009-mountains.avi -u family
|
||||||
|
# imprastorage add /home/Share/2009-mountains.avi -c videos/perso/2009
|
||||||
|
# imprastorage add /home/Share/2009-mountains.avi 'summer 2009 - in mountains' -c videos/perso/2009 -u family
|
||||||
|
#
|
||||||
|
# command list :
|
||||||
|
# imprastorage list
|
||||||
|
# imprastorage list -o LABEL
|
||||||
|
# imprastorage list -c videos/perso
|
||||||
|
# imprastorage list -u family
|
||||||
|
# imprastorage list -o SIZE -c videos/perso -u family
|
||||||
|
#
|
||||||
|
# command get :
|
||||||
|
# imprastorage get 15
|
||||||
|
# imprastorage get 15-19
|
||||||
|
# imprastorage get 22,29,30
|
||||||
|
# imprastorage get 22,29,30-35,48
|
||||||
|
# imprastorage get -n 'summer 2009 - in mountains'
|
||||||
|
#
|
||||||
|
# command remove :
|
||||||
|
# imprastorage remove 15
|
||||||
|
# imprastorage remove -n 'summer 2009 - in mountains'
|
||||||
|
#
|
||||||
|
# command search :
|
||||||
|
# imprastorage search 'mountains'
|
||||||
|
# imprastorage search 'mountains' -c videos/perso
|
||||||
|
# imprastorage search 'mountains' -u family
|
||||||
|
# imprastorage search 'mountains' -o LABEL
|
||||||
|
# imprastorage search 'mountains' -c videos/perso -u family -o LABEL
|
||||||
|
# imprastorage search '^mountains'
|
||||||
|
# imprastorage search 'mountains$'
|
||||||
|
#
|
||||||
|
# command conf :
|
||||||
|
# imprastorage conf -L
|
||||||
|
# imprastorage conf -LA bobgmail
|
||||||
|
# imprastorage conf -V
|
||||||
|
# imprastorage conf -VA bobgmail
|
||||||
|
# imprastorage conf -S -K
|
||||||
|
# imprastorage conf -SA bobgmail -K
|
||||||
|
# imprastorage conf -SA bobgmail -K -H imap.gmail.com -U bob22 -X mypassword -N bob
|
||||||
|
#
|
||||||
|
print()
|
||||||
if not a:
|
if not a:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
print()
|
print()
|
||||||
|
@ -204,8 +259,6 @@ data command Examples:
|
||||||
if self.ini.has('profile') : o.active_profile = self.ini.get('profile')
|
if self.ini.has('profile') : o.active_profile = self.ini.get('profile')
|
||||||
else : o.active_profile = 'default'
|
else : o.active_profile = 'default'
|
||||||
|
|
||||||
print(self.ini)
|
|
||||||
|
|
||||||
if o.load_conf : self.load_profile(o)
|
if o.load_conf : self.load_profile(o)
|
||||||
|
|
||||||
elif o.list_conf : print(self.ini.toString(o.active_profile))
|
elif o.list_conf : print(self.ini.toString(o.active_profile))
|
||||||
|
@ -231,7 +284,7 @@ data command Examples:
|
||||||
if self.check_profile(o.active_profile):
|
if self.check_profile(o.active_profile):
|
||||||
self.ini.set('profile', o.active_profile)
|
self.ini.set('profile', o.active_profile)
|
||||||
self.ini.write()
|
self.ini.write()
|
||||||
print(self.ini.toString(o.active_profile))
|
self.ini.print(o.active_profile)
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
# ~~ data CMD ~~
|
# ~~ data CMD ~~
|
||||||
|
@ -249,17 +302,23 @@ data command Examples:
|
||||||
try:
|
try:
|
||||||
impst = core.ImpraStorage(conf)
|
impst = core.ImpraStorage(conf)
|
||||||
except crypt.BadKeyException as e :
|
except crypt.BadKeyException as e :
|
||||||
print('Error : ')
|
print()
|
||||||
print(e)
|
Clz.print(' it seems that your current profile `' , Clz.fgB1, False)
|
||||||
print("""
|
Clz.print(o.active_profile , Clz.fgB3, False)
|
||||||
it seems that your current profile %s has a wrong key to decrypt index on server.
|
Clz.print('` has a wrong key to decrypt index on server.' , Clz.fgB1)
|
||||||
you can remove index but all presents files on the box %s will be unrecoverable
|
Clz.print(' you can remove index but all presents files on the box `', Clz.fgB1, False)
|
||||||
""" % (o.active_profile, conf.get('box','imap')))
|
Clz.print(conf.get('box','imap') , Clz.fgB3, False)
|
||||||
|
Clz.print('` will be unrecoverable\n' , Clz.fgB1, True, False)
|
||||||
|
|
||||||
remIndex = input(' remove index ? (yes/no) ')
|
remIndex = input(' remove index ? (yes/no) ')
|
||||||
if remIndex.lower()=='yes':
|
if remIndex.lower()=='yes':
|
||||||
|
Clz.print(' ',Clz.OFF)
|
||||||
impst = core.ImpraStorage(conf, True)
|
impst = core.ImpraStorage(conf, True)
|
||||||
|
|
||||||
else :
|
else :
|
||||||
|
print()
|
||||||
print(' bye')
|
print(' bye')
|
||||||
|
print()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if o.list :
|
if o.list :
|
||||||
|
@ -278,18 +337,14 @@ you can remove index but all presents files on the box %s will be unrecoverable
|
||||||
printHeaderPart('box',impst.rootBox)
|
printHeaderPart('box',impst.rootBox)
|
||||||
Clz.print(date, Clz.fgB7, True, True)
|
Clz.print(date, Clz.fgB7, True, True)
|
||||||
printLineSep(LINE_SEP_CHAR,LINE_SEP_LEN)
|
printLineSep(LINE_SEP_CHAR,LINE_SEP_LEN)
|
||||||
impst.index.print()
|
impst.index.print(o.order)
|
||||||
|
|
||||||
status, resp = impst.ih.srv.search(None, '(SUBJECT "%s")' % '584d15abeb71fbd92fa5861970088b32ebb1d2d6650cec6115a28b64877d70f2')
|
|
||||||
ids = [m for m in resp[0].split()]
|
|
||||||
for mid in ids :
|
|
||||||
status, resp = impst.ih.srv.fetch(mid,'(UID RFC822.SIZE)')
|
|
||||||
print(mid,status,resp)
|
|
||||||
|
|
||||||
elif o.add :
|
elif o.add :
|
||||||
done = impst.addFile(o.add[0],o.add[1],o.user,o.category)
|
done = impst.addFile(o.add[0],o.add[1],o.user,o.category)
|
||||||
if done :
|
if done :
|
||||||
print('OK')
|
print('\n ',end='')
|
||||||
|
Clz.print(' == OK == ', Clz.bg2+Clz.fgb7)
|
||||||
|
print()
|
||||||
|
|
||||||
elif o.get :
|
elif o.get :
|
||||||
ids = []
|
ids = []
|
||||||
|
@ -302,31 +357,50 @@ you can remove index but all presents files on the box %s will be unrecoverable
|
||||||
if key !=None :
|
if key !=None :
|
||||||
done = impst.getFile(key)
|
done = impst.getFile(key)
|
||||||
if done :
|
if done :
|
||||||
print('OK')
|
print('\n ',end='')
|
||||||
else: print('-- `%s` is not a valid id --' % sid)
|
Clz.print(' == OK == ', Clz.bg2+Clz.fgb7)
|
||||||
|
print()
|
||||||
|
else:
|
||||||
|
print('\n ',end='')
|
||||||
|
Clz.print(' == `' , Clz.bg1+Clz.fgB7, False)
|
||||||
|
Clz.print(str(sid) , Clz.bg1+Clz.fgB3, False)
|
||||||
|
Clz.print('` is not a valid id == ', Clz.bg1+Clz.fgB7)
|
||||||
|
print()
|
||||||
|
|
||||||
elif o.search :
|
elif o.search :
|
||||||
matchIds = impst.index.getByPattern(o.search)
|
matchIds = impst.index.getByPattern(o.search)
|
||||||
if matchIds is not None:
|
if matchIds is not None:
|
||||||
headstr = '-'*120+'\n -- SEARCH: `'+o.search+'` -- found '+str(len(matchIds))+' results --\n'+'-'*120
|
printLineSep(LINE_SEP_CHAR,LINE_SEP_LEN)
|
||||||
impst.index.print(headstr,matchIds)
|
printHeaderTitle('SEARCH')
|
||||||
|
Clz.print(' `'+o.search+'`' , Clz.fgB7, False)
|
||||||
|
Clz.print(' -- found ' , Clz.fgB3, False)
|
||||||
|
Clz.print(str(len(matchIds)), Clz.fgB1, False)
|
||||||
|
Clz.print(' results --' , Clz.fgB3)
|
||||||
|
printLineSep(LINE_SEP_CHAR,LINE_SEP_LEN)
|
||||||
|
impst.index.print(o.order,matchIds)
|
||||||
else:
|
else:
|
||||||
print(' -- no match found for pattern `%s` --' % o.search)
|
print('\n ',end='')
|
||||||
|
Clz.print(' == no match found for pattern `', Clz.bg3+Clz.fgB4, False)
|
||||||
|
Clz.print(o.search , Clz.bg3+Clz.fgB1, False)
|
||||||
|
Clz.print('` == ' , Clz.bg3+Clz.fgB4)
|
||||||
|
print()
|
||||||
elif o.remove :
|
elif o.remove :
|
||||||
print(o.remove)
|
key = impst.index.getById(o.remove)
|
||||||
|
if key !=None :
|
||||||
#~ filePath = '/media/Data/dev/big_toph3.jpg'
|
done = impst.removeFile(key)
|
||||||
#~ lab = 'Meuf\'bonne aussi4'
|
if done :
|
||||||
#~ print('\n -- ADD FILE -- ')
|
print('\n ',end='')
|
||||||
#~ impst.addFile(filePath,lab,conf.get('name','infos'),'images')
|
Clz.print(' == OK == ', Clz.bg2+Clz.fgb7)
|
||||||
|
print()
|
||||||
#~ else :
|
else:
|
||||||
#~ self.load_profile(o)
|
print('\n ',end='')
|
||||||
#~ print('data cmd')
|
Clz.print(' == `' , Clz.bg1+Clz.fgB7, False)
|
||||||
#~ print(o)
|
Clz.print(str(o.remove) , Clz.bg1+Clz.fgB3, False)
|
||||||
|
Clz.print('` is not a valid id == ', Clz.bg1+Clz.fgB7)
|
||||||
|
print()
|
||||||
|
|
||||||
else : parser.print_help()
|
else : parser.print_help()
|
||||||
|
print()
|
||||||
|
|
||||||
|
|
||||||
def check_profile(self,profile):
|
def check_profile(self,profile):
|
||||||
|
|
187
impra/core.py
187
impra/core.py
|
@ -92,7 +92,12 @@ class FSplitter :
|
||||||
m = mmap(f.fileno(), 0)
|
m = mmap(f.fileno(), 0)
|
||||||
p = 0
|
p = 0
|
||||||
psize = ceil(getsize(fromPath)/hlst['head'][1])
|
psize = ceil(getsize(fromPath)/hlst['head'][1])
|
||||||
print(formatBytes(getsize(fromPath))+' on '+str(len(hlst['data']))+' parts (~'+formatBytes(psize)+')')
|
Clz.print(' '+formatBytes(getsize(fromPath)), Clz.fgB2, False)
|
||||||
|
Clz.print(' on ' , Clz.fgn7, False)
|
||||||
|
Clz.print(str(len(hlst['data'])) , Clz.fgB1, False)
|
||||||
|
Clz.print(' parts (~' , Clz.fgn7, False)
|
||||||
|
Clz.print(formatBytes(psize) , Clz.fgB2, False)
|
||||||
|
Clz.print(')' , Clz.fgn7)
|
||||||
while m.tell() < m.size():
|
while m.tell() < m.size():
|
||||||
self._splitPart(m,p,psize,hlst['data'][p])
|
self._splitPart(m,p,psize,hlst['data'][p])
|
||||||
p += 1
|
p += 1
|
||||||
|
@ -125,7 +130,10 @@ class FSplitter :
|
||||||
|
|
||||||
filePath = dirPath+fileName
|
filePath = dirPath+fileName
|
||||||
if file_exists(filePath+ext):
|
if file_exists(filePath+ext):
|
||||||
print('\n-- `%s` already exist, deploying file as :\n-- `%s`\n' % (filePath+ext,filePath+'-'+str(uid)+ext))
|
Clz.print('\n name already exist, deploying file as :' , Clz.fgB1)
|
||||||
|
Clz.print(' '+basename(filePath) , Clz.fgB2, False)
|
||||||
|
Clz.print('-'+str(uid) , Clz.fgB1, False)
|
||||||
|
Clz.print(ext , Clz.fgB2)
|
||||||
filePath += '-'+str(uid)
|
filePath += '-'+str(uid)
|
||||||
filePath += ext
|
filePath += ext
|
||||||
|
|
||||||
|
@ -137,7 +145,7 @@ class FSplitter :
|
||||||
p += 1
|
p += 1
|
||||||
fp.close()
|
fp.close()
|
||||||
rt.stop()
|
rt.stop()
|
||||||
return dirPath+fileName+ext
|
return filePath
|
||||||
|
|
||||||
def _mergePart(self,fp,part,phlst,depDir):
|
def _mergePart(self,fp,part,phlst,depDir):
|
||||||
""""""
|
""""""
|
||||||
|
@ -182,7 +190,6 @@ class ImpraConf:
|
||||||
self.set('types', 'music,films,doc,images,archives,games','catg')
|
self.set('types', 'music,films,doc,images,archives,games','catg')
|
||||||
if save :
|
if save :
|
||||||
self.ini.write()
|
self.ini.write()
|
||||||
#print(self.ini.toString())
|
|
||||||
|
|
||||||
def get(self, key, section='main', profile=None):
|
def get(self, key, section='main', profile=None):
|
||||||
""""""
|
""""""
|
||||||
|
@ -228,8 +235,6 @@ class ImpraIndex:
|
||||||
SEP_KEY_INTERN = '@'
|
SEP_KEY_INTERN = '@'
|
||||||
"""Separator used for internal key such categories"""
|
"""Separator used for internal key such categories"""
|
||||||
|
|
||||||
MD5 = 7
|
|
||||||
""""""
|
|
||||||
HASH = 0
|
HASH = 0
|
||||||
""""""
|
""""""
|
||||||
LABEL = 1
|
LABEL = 1
|
||||||
|
@ -246,10 +251,14 @@ class ImpraIndex:
|
||||||
""""""
|
""""""
|
||||||
BFLAG = 7
|
BFLAG = 7
|
||||||
""""""
|
""""""
|
||||||
|
SIZE = 8
|
||||||
|
""""""
|
||||||
FILE_BINARY = 'b'
|
FILE_BINARY = 'b'
|
||||||
|
""""""
|
||||||
FILE_CRYPT = 'c'
|
FILE_CRYPT = 'c'
|
||||||
|
""""""
|
||||||
|
COLS = ('HASH','LABEL','PART','TYPE','OWNER','CATEGORY','ID','BLFAG','SIZE')
|
||||||
|
""""""
|
||||||
|
|
||||||
def __init__(self, key, mark, encdata='', dicCategory={}, id=0):
|
def __init__(self, key, mark, encdata='', dicCategory={}, id=0):
|
||||||
"""Initialize the index with rsa and encoded data
|
"""Initialize the index with rsa and encoded data
|
||||||
|
@ -272,11 +281,11 @@ class ImpraIndex:
|
||||||
if not self.SEP_KEY_INTERN+k in self.dic:
|
if not self.SEP_KEY_INTERN+k in self.dic:
|
||||||
self.dic[self.SEP_KEY_INTERN+k] = dicCategory[k]
|
self.dic[self.SEP_KEY_INTERN+k] = dicCategory[k]
|
||||||
|
|
||||||
def add(self,key, label, count, ext='', usr='', cat='', md5='', bFlag='b'):
|
def add(self,key, label, count, ext='', usr='', cat='', md5='', bFlag='b', size=''):
|
||||||
"""Add an entry to the index
|
"""Add an entry to the index
|
||||||
"""
|
"""
|
||||||
if self.get(md5) == None :
|
if self.get(md5) == None :
|
||||||
self.dic[md5] = (key,label,count,ext,usr,cat, self.id, bFlag)
|
self.dic[md5] = (key,label,count,ext,usr,cat,self.id,bFlag,size)
|
||||||
self.id +=1
|
self.id +=1
|
||||||
else :
|
else :
|
||||||
print(label+' already exist')
|
print(label+' already exist')
|
||||||
|
@ -390,34 +399,37 @@ class ImpraIndex:
|
||||||
raise BadKeyException(e)
|
raise BadKeyException(e)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def print(self,header='', matchIds=None):
|
def print(self,order='ID', matchIds=None):
|
||||||
"""Print index content as formated bloc"""
|
"""Print index content as formated bloc"""
|
||||||
#clear()
|
#clear()
|
||||||
if header is not '':print(header)
|
|
||||||
from impra.cli import printLineSep, LINE_SEP_LEN, LINE_SEP_CHAR
|
from impra.cli import printLineSep, LINE_SEP_LEN, LINE_SEP_CHAR
|
||||||
#printLineSep(LINE_SEP_CHAR,LINE_SEP_LEN)
|
orderIndex = self.COLS.index(order)
|
||||||
|
if orderIndex is None : orderIndex = self.COLS.index('ID')
|
||||||
|
|
||||||
Clz.print(' ID'+' '*1, Clz.BG4+Clz.fgB7, False, False)
|
Clz.print(' ID'+' '*1, Clz.BG4+Clz.fgB7, False, False)
|
||||||
print('HASH' +' '*15, end='')
|
print('HASH' +' '*6 , end='')
|
||||||
print('LABEL' +' '*38, end='')
|
print('LABEL' +' '*35, end='')
|
||||||
|
print('SIZE' +' '*5 , end='')
|
||||||
print('PART' +' '*2 , end='')
|
print('PART' +' '*2 , end='')
|
||||||
print('TYPE' +' '*2 , end='')
|
print('TYPE' +' '*2 , end='')
|
||||||
print('OWNER' +' '*12, end='')
|
print('OWNER' +' '*10, end='')
|
||||||
Clz.print('CATEGORY'+' '*17, Clz.BG4+Clz.fgB7)
|
Clz.print('CATEGORY'+' '*22, Clz.BG4+Clz.fgB7)
|
||||||
printLineSep(LINE_SEP_CHAR,LINE_SEP_LEN)
|
printLineSep(LINE_SEP_CHAR,LINE_SEP_LEN)
|
||||||
data = ''
|
|
||||||
r = [k for i, k in enumerate(self.dic) if not k.startswith(self.SEP_KEY_INTERN)]
|
d = sorted([(self.dic.get(k),k) for i, k in enumerate(self.dic) if not k.startswith(self.SEP_KEY_INTERN)], key=lambda lst:lst[0][orderIndex])
|
||||||
for k in r :
|
a = ''
|
||||||
v = self.dic.get(k)
|
for v,k in d :
|
||||||
k = k.lstrip('\n\r')
|
|
||||||
if not k[0]==self.SEP_KEY_INTERN and len(k)>1:
|
|
||||||
if matchIds==None or v[self.UID] in matchIds:
|
if matchIds==None or v[self.UID] in matchIds:
|
||||||
Clz.print(str(v[self.UID]).rjust(1+ceil(len(str(v[self.UID]))/10),' ') +' '*2, Clz.fgB1, False)
|
a = ''
|
||||||
Clz.print(str(k)[0:12]+'... ' +' '*2, Clz.fgn2, False)
|
Clz.print(str(v[self.UID]).rjust(1+ceil(len(str(v[self.UID]))/10),' ')+' ', Clz.bg1+Clz.fgB7, False)
|
||||||
Clz.print(str(v[self.LABEL]).ljust(42,' ') +' '*2, Clz.fgB7, False)
|
Clz.print(' '+str(k)[0:6]+'... ' ,Clz.fgN2, False)
|
||||||
Clz.print(str(v[self.PARTS]).rjust(2 ,'0') +' '*2, Clz.fgB5, False)
|
if len(v[self.LABEL])>36 : a = '...'
|
||||||
Clz.print(str(v[self.EXT]).ljust(5,' ') +' '*2, Clz.fgB4, False)
|
Clz.print(str(v[self.LABEL][:36]+a).ljust(40,' ') ,Clz.fgN7, False)
|
||||||
Clz.print(self.getUser(str(v[self.OWNER])).ljust(15,' ') +' '*2, Clz.fgB7, False)
|
Clz.print(formatBytes(int(v[self.SIZE]))[:8].ljust(10,' '),Clz.fgN5, False)
|
||||||
Clz.print(str(v[self.CATG]) +' '*2, Clz.fgB4)
|
Clz.print(str(v[self.PARTS]).rjust(2 ,'0') +' '*2 ,Clz.fgN1, False)
|
||||||
|
Clz.print(str(v[self.EXT][:5]).ljust(7,' ') ,Clz.fgn3, False)
|
||||||
|
Clz.print(self.getUser(str(v[self.OWNER])).ljust(15,' ') ,Clz.fgn7, False)
|
||||||
|
Clz.print(str(v[self.CATG]) +' '*2 ,Clz.fgN3)
|
||||||
|
|
||||||
printLineSep(LINE_SEP_CHAR,LINE_SEP_LEN)
|
printLineSep(LINE_SEP_CHAR,LINE_SEP_LEN)
|
||||||
|
|
||||||
|
@ -497,9 +509,11 @@ class ImpraStorage:
|
||||||
if uid != None and file_exists(self.pathInd): # int(self.idx) == int(uid)
|
if uid != None and file_exists(self.pathInd): # int(self.idx) == int(uid)
|
||||||
self.idx = uid
|
self.idx = uid
|
||||||
encData = get_file_content(self.pathInd)
|
encData = get_file_content(self.pathInd)
|
||||||
|
Clz.print(' get index from cache', Clz.fgn7)
|
||||||
else: refresh = True
|
else: refresh = True
|
||||||
else: refresh = True
|
else: refresh = True
|
||||||
if refresh :
|
if refresh :
|
||||||
|
Clz.print(' refreshing index', Clz.fgn7)
|
||||||
self._getIdIndex()
|
self._getIdIndex()
|
||||||
if self.idx :
|
if self.idx :
|
||||||
encData = self._getCryptIndex()
|
encData = self._getCryptIndex()
|
||||||
|
@ -555,6 +569,12 @@ class ImpraStorage:
|
||||||
with open(path, mode='w') as o:
|
with open(path, mode='w') as o:
|
||||||
o.write(data)
|
o.write(data)
|
||||||
|
|
||||||
|
def checkSendIds(self,sendIds,subject):
|
||||||
|
""""""
|
||||||
|
lloc = [bytes(str(data[0]),'utf-8') for mid, data in enumerate(sendIds)]
|
||||||
|
lsrv = self.ih.searchBySubject(subject,True)
|
||||||
|
return [ i for i in set(lloc).difference(set(lsrv))]
|
||||||
|
|
||||||
def addFile(self, path, label, usr='all', catg=''):
|
def addFile(self, path, label, usr='all', catg=''):
|
||||||
""""""
|
""""""
|
||||||
done = False
|
done = False
|
||||||
|
@ -564,8 +584,15 @@ class ImpraStorage:
|
||||||
_, ext = splitext(path)
|
_, ext = splitext(path)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
size = getsize(path)
|
||||||
|
if size > 0 :
|
||||||
md5 = hash_md5_file(path)
|
md5 = hash_md5_file(path)
|
||||||
print('--\nmd5sum `%s` %s' % (path,md5))
|
print()
|
||||||
|
Clz.print(' file : ' , Clz.fgn7, False)
|
||||||
|
Clz.print(path , Clz.fgN1)
|
||||||
|
Clz.print(' md5sum : ' , Clz.fgn7, False)
|
||||||
|
Clz.print(md5 , Clz.fgN2)
|
||||||
|
print()
|
||||||
if not self.index.get(md5) :
|
if not self.index.get(md5) :
|
||||||
|
|
||||||
if catg=='' : catg = self.index.getAutoCatg(ext)
|
if catg=='' : catg = self.index.getAutoCatg(ext)
|
||||||
|
@ -591,45 +618,101 @@ class ImpraStorage:
|
||||||
msg = self.mb.build(self.conf.get('name','infos'),usr,hlst['head'][2],self.fsplit.DIR_OUTBOX+row[1]+'.ipr')
|
msg = self.mb.build(self.conf.get('name','infos'),usr,hlst['head'][2],self.fsplit.DIR_OUTBOX+row[1]+'.ipr')
|
||||||
mid = self.ih.send(msg.as_string(), self.rootBox)
|
mid = self.ih.send(msg.as_string(), self.rootBox)
|
||||||
if mid is not None :
|
if mid is not None :
|
||||||
print('part %s sent as msg %s' % (row[0],mid[1]))
|
print(' ',end='')
|
||||||
|
Clz.print(' part ' , Clz.fgn7, False)
|
||||||
|
Clz.print(str(row[0]) , Clz.fgB1, False)
|
||||||
|
Clz.print(' sent as msg ', Clz.fgn7, False)
|
||||||
|
Clz.print(str(mid[1]) , Clz.fgB1)
|
||||||
sendIds.append((mid[1],row))
|
sendIds.append((mid[1],row))
|
||||||
remove(self.fsplit.DIR_OUTBOX+row[1]+'.ipr')
|
|
||||||
else:
|
else:
|
||||||
print('\n-- error occured when sending part : %s\n-- retrying' % row[0])
|
print('\n-- error occured when sending part : %s\n-- retrying' % row[0])
|
||||||
mid = self.ih.send(msg.as_string(), self.rootBox)
|
mid = self.ih.send(msg.as_string(), self.rootBox)
|
||||||
if mid is not None :
|
if mid is not None :
|
||||||
print('part %s sent as msg %s' % (row[0],mid[1]))
|
print('part %s sent as msg %s' % (row[0],mid[1]))
|
||||||
sendIds.append((mid[1],row))
|
sendIds.append((mid[1],row))
|
||||||
remove(self.fsplit.DIR_OUTBOX+row[1]+'.ipr')
|
|
||||||
else:
|
else:
|
||||||
print('\n-- can\'t send part %s\n-- cancelling ' % row[0])
|
print('\n-- can\'t send part %s\n-- cancelling ' % row[0])
|
||||||
cancel = True
|
cancel = True
|
||||||
break
|
break
|
||||||
|
print()
|
||||||
if cancel :
|
if not cancel :
|
||||||
|
self.index.add(hlst['head'][3],label,hlst['head'][1],ext,ownerHash,catg,md5,bFlag,size)
|
||||||
|
done = self.saveIndex()
|
||||||
|
self.conf.set('nid', str(self.index.id),'index')
|
||||||
|
diff = self.checkSendIds(sendIds,hlst['head'][2])
|
||||||
|
if len(diff) > 0 :
|
||||||
|
Clz.print(' error when sending, missing parts :', Clz.fgB1)
|
||||||
|
print(diff)
|
||||||
for mid, row in sendIds :
|
for mid, row in sendIds :
|
||||||
self.ih.delete(mid, True)
|
msg = self.mb.build(self.conf.get('name','infos'),usr,hlst['head'][2],self.fsplit.DIR_OUTBOX+row[1]+'.ipr')
|
||||||
|
Clz.print(' resending part ' , Clz.fgn7, False)
|
||||||
|
Clz.print(str(row[0]) , Clz.fgN2, False)
|
||||||
|
mid = self.ih.send(msg.as_string(), self.rootBox)
|
||||||
|
else :
|
||||||
|
print()
|
||||||
|
#Clz.print(' index intall files checked\n', Clz.fgB2)
|
||||||
|
|
||||||
|
|
||||||
|
# clean
|
||||||
|
for mid, row in sendIds :
|
||||||
|
if cancel : self.ih.delete(mid, True)
|
||||||
if file_exists(self.fsplit.DIR_OUTBOX+row[1]+'.ipr') : remove(self.fsplit.DIR_OUTBOX+row[1]+'.ipr')
|
if file_exists(self.fsplit.DIR_OUTBOX+row[1]+'.ipr') : remove(self.fsplit.DIR_OUTBOX+row[1]+'.ipr')
|
||||||
self.clean()
|
self.clean()
|
||||||
|
|
||||||
else :
|
else :
|
||||||
self.index.add(hlst['head'][3],label,hlst['head'][1],ext,ownerHash,catg,md5,bFlag)
|
print(' ',end='')
|
||||||
done = self.saveIndex()
|
Clz.print(' == file already exist on server as ' , Clz.fgN7+Clz.bg1, False)
|
||||||
self.conf.set('nid', str(self.index.id),'index')
|
Clz.print(self.index.dic[md5][ImpraIndex.LABEL] , Clz.bg1+Clz.fgB3, False)
|
||||||
|
Clz.print(' [id:' , Clz.fgN7+Clz.bg1, False)
|
||||||
|
Clz.print(str(self.index.dic[md5][ImpraIndex.UID]) , Clz.bg1+Clz.fgB3, False)
|
||||||
|
Clz.print('] == ' , Clz.fgN7+Clz.bg1)
|
||||||
|
print()
|
||||||
else :
|
else :
|
||||||
print('--\nfile already exist on server as `%s` [id:%i]\n' % (self.index.dic[md5][ImpraIndex.LABEL],self.index.dic[md5][ImpraIndex.UID]))
|
print(' ',end='')
|
||||||
|
Clz.print(' == files is empty or don\t exists == ' , Clz.bg1+Clz.fgN7)
|
||||||
|
print()
|
||||||
|
|
||||||
except Exception as e :
|
except Exception as e :
|
||||||
print(e)
|
print(e)
|
||||||
rt.stop()
|
rt.stop()
|
||||||
return done
|
return done
|
||||||
|
|
||||||
|
def removeFile(self,key):
|
||||||
|
""""""
|
||||||
|
from impra.util import DEBUG, DEBUG_LEVEL, DEBUG_NOTICE, DEBUG_WARN, DEBUG_INFO
|
||||||
|
done = False
|
||||||
|
row = self.index.get(key)
|
||||||
|
if row==None :
|
||||||
|
print()
|
||||||
|
Clz.print(' == `' , Clz.bg1+Clz.fgB7, False)
|
||||||
|
Clz.print(str(key) , Clz.bg1+Clz.fgB3, False)
|
||||||
|
Clz.print('` not on the server == ', Clz.bg1+Clz.fgB7)
|
||||||
|
print()
|
||||||
|
else :
|
||||||
|
rt = RuTime(eval(__CALLER__('"[%i] %s"' % (row[ImpraIndex.UID],row[ImpraIndex.LABEL]))),DEBUG_INFO)
|
||||||
|
ck = ConfigKey(row[ImpraIndex.HASH])
|
||||||
|
hlst = ck.getHashList(key,row[ImpraIndex.PARTS],True)
|
||||||
|
Clz.print(' waiting srv...', Clz.fgn7)
|
||||||
|
ids = self.ih.searchBySubject(hlst['head'][2], True)
|
||||||
|
for mid in ids :
|
||||||
|
self.ih.delete(mid, True)
|
||||||
|
self.index.rem(key)
|
||||||
|
done = self.saveIndex()
|
||||||
|
rt.stop()
|
||||||
|
return done
|
||||||
|
|
||||||
def getFile(self,key):
|
def getFile(self,key):
|
||||||
""""""
|
""""""
|
||||||
from impra.util import DEBUG, DEBUG_LEVEL, DEBUG_NOTICE, DEBUG_WARN, DEBUG_INFO
|
from impra.util import DEBUG, DEBUG_LEVEL, DEBUG_NOTICE, DEBUG_WARN, DEBUG_INFO
|
||||||
done = False
|
done = False
|
||||||
row = self.index.get(key)
|
row = self.index.get(key)
|
||||||
if row==None :
|
if row==None :
|
||||||
print('--\n%s not on the server' % key)
|
print()
|
||||||
|
Clz.print(' == `' , Clz.bg1+Clz.fgB7, False)
|
||||||
|
Clz.print(str(key) , Clz.bg1+Clz.fgB3, False)
|
||||||
|
Clz.print('` not on the server == ', Clz.bg1+Clz.fgB7)
|
||||||
|
print()
|
||||||
|
|
||||||
else :
|
else :
|
||||||
rt = RuTime(eval(__CALLER__('"[%i] %s"' % (row[ImpraIndex.UID],row[ImpraIndex.LABEL]))),DEBUG_INFO)
|
rt = RuTime(eval(__CALLER__('"[%i] %s"' % (row[ImpraIndex.UID],row[ImpraIndex.LABEL]))),DEBUG_INFO)
|
||||||
ck = ConfigKey(row[ImpraIndex.HASH])
|
ck = ConfigKey(row[ImpraIndex.HASH])
|
||||||
|
@ -648,11 +731,27 @@ class ImpraStorage:
|
||||||
path = self.fsplit.deployFile(hlst, row[ImpraIndex.LABEL], row[ImpraIndex.EXT], row[ImpraIndex.UID], row[ImpraIndex.CATG])
|
path = self.fsplit.deployFile(hlst, row[ImpraIndex.LABEL], row[ImpraIndex.EXT], row[ImpraIndex.UID], row[ImpraIndex.CATG])
|
||||||
if row[ImpraIndex.BFLAG] == ImpraIndex.FILE_CRYPT:
|
if row[ImpraIndex.BFLAG] == ImpraIndex.FILE_CRYPT:
|
||||||
self.decryptTextFile(path)
|
self.decryptTextFile(path)
|
||||||
|
print()
|
||||||
|
Clz.print(' deploying in ', Clz.fgn7, False)
|
||||||
|
Clz.print(dirname(path), Clz.fgB2)
|
||||||
|
print()
|
||||||
done = True
|
done = True
|
||||||
else :
|
else :
|
||||||
print('--\n`%s` is private' % row[ImpraIndex.LABEL])
|
print()
|
||||||
|
Clz.print(' == `' , Clz.bg3+Clz.fgB4, False)
|
||||||
|
Clz.print(str(row[ImpraIndex.LABEL]) , Clz.bg3+Clz.fgB1, False)
|
||||||
|
Clz.print('` is private == ' , Clz.bg3+Clz.fgB4)
|
||||||
|
print()
|
||||||
else :
|
else :
|
||||||
print('--\n`%s` invalid count parts %i/%i' %(row[ImpraIndex.LABEL],len(ids),row[ImpraIndex.PARTS]))
|
print()
|
||||||
|
Clz.print(' == `' , Clz.bg3+Clz.fgB4, False)
|
||||||
|
Clz.print(row[ImpraIndex.LABEL] , Clz.bg3+Clz.fgB1, False)
|
||||||
|
Clz.print('` invalid count parts ' , Clz.bg3+Clz.fgB4)
|
||||||
|
Clz.print(str(len(ids)) , Clz.bg3+Clz.fgB1)
|
||||||
|
Clz.print('/' , Clz.bg3+Clz.fgB4)
|
||||||
|
Clz.print(str(len(row[ImpraIndex.PARTS])) , Clz.bg3+Clz.fgB1)
|
||||||
|
Clz.print(' == ' , Clz.bg3+Clz.fgB4)
|
||||||
|
print()
|
||||||
|
|
||||||
rt.stop()
|
rt.stop()
|
||||||
return done
|
return done
|
||||||
|
|
|
@ -35,9 +35,9 @@ from email.message import Message
|
||||||
from imaplib import IMAP4_SSL, Time2Internaldate
|
from imaplib import IMAP4_SSL, Time2Internaldate
|
||||||
from os.path import join
|
from os.path import join
|
||||||
from re import search, split
|
from re import search, split
|
||||||
from time import time
|
from time import time, sleep
|
||||||
|
|
||||||
from impra.util import __CALLER__, RuTime, bstr, stack
|
from impra.util import __CALLER__, RuTime, bstr, stack, Clz
|
||||||
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -305,6 +305,7 @@ class ImapHelper:
|
||||||
self.srv.select(self.BOX_BIN)
|
self.srv.select(self.BOX_BIN)
|
||||||
ids = self.search('ALL',True)
|
ids = self.search('ALL',True)
|
||||||
if len(ids) > 0 and ids[0]!='' and ids[0]!=None:
|
if len(ids) > 0 and ids[0]!='' and ids[0]!=None:
|
||||||
|
print()
|
||||||
#print(str(ids[0],'utf-8').split())
|
#print(str(ids[0],'utf-8').split())
|
||||||
for mid in ids:
|
for mid in ids:
|
||||||
#~ uid = bytes(mid)
|
#~ uid = bytes(mid)
|
||||||
|
@ -312,11 +313,14 @@ class ImapHelper:
|
||||||
#~ print(mid)
|
#~ print(mid)
|
||||||
#status, resp = self.srv.store(mid, '+FLAGS', '\\Deleted')
|
#status, resp = self.srv.store(mid, '+FLAGS', '\\Deleted')
|
||||||
status, resp = self.srv.uid('store', mid, '+FLAGS', '\\Deleted' )
|
status, resp = self.srv.uid('store', mid, '+FLAGS', '\\Deleted' )
|
||||||
print('deleting msg %i' % int(mid))
|
print(' ',end='')
|
||||||
|
Clz.print(' deleting msg ',Clz.fgN7+Clz.bg1, False)
|
||||||
|
Clz.print(str(int(mid)) ,Clz.bg1+Clz.fgB3)
|
||||||
if DEBUG and DEBUG_LEVEL <= DEBUG_NOTICE:
|
if DEBUG and DEBUG_LEVEL <= DEBUG_NOTICE:
|
||||||
print(status)
|
print(status)
|
||||||
print(resp)
|
print(resp)
|
||||||
self.srv.expunge()
|
self.srv.expunge()
|
||||||
|
print()
|
||||||
self.srv.select(self.rootBox)
|
self.srv.select(self.rootBox)
|
||||||
rt.stop()
|
rt.stop()
|
||||||
|
|
||||||
|
@ -329,7 +333,14 @@ class ImapHelper:
|
||||||
status, resp = self.srv.uid( 'store', mid, '+FLAGS', '\\Deleted' )
|
status, resp = self.srv.uid( 'store', mid, '+FLAGS', '\\Deleted' )
|
||||||
else :
|
else :
|
||||||
status, resp = self.srv.store(mid, '+FLAGS', '\\Deleted')
|
status, resp = self.srv.store(mid, '+FLAGS', '\\Deleted')
|
||||||
|
Clz.print(' flag msg ' , Clz.fgn7, False)
|
||||||
|
Clz.print(str(mid) , Clz.fgB1, False)
|
||||||
|
Clz.print(' as deleted', Clz.fgn7)
|
||||||
|
|
||||||
|
Clz.print('\n expunge, waiting server...\n', Clz.fgB1)
|
||||||
self.srv.expunge()
|
self.srv.expunge()
|
||||||
|
sleep(2)
|
||||||
|
|
||||||
rt.stop()
|
rt.stop()
|
||||||
return status == self.OK
|
return status == self.OK
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ from errno import EEXIST
|
||||||
from hashlib import sha256
|
from hashlib import sha256
|
||||||
from math import log, floor, ceil
|
from math import log, floor, ceil
|
||||||
from os import urandom, popen, sep, makedirs, system
|
from os import urandom, popen, sep, makedirs, system
|
||||||
from os.path import dirname, realpath, abspath, join
|
from os.path import dirname, realpath, abspath, join, getsize
|
||||||
from random import choice
|
from random import choice
|
||||||
from re import split as regsplit, search as regsearch, finditer as regfinditer
|
from re import split as regsplit, search as regsearch, finditer as regfinditer
|
||||||
from subprocess import PIPE, Popen
|
from subprocess import PIPE, Popen
|
||||||
|
@ -231,7 +231,7 @@ class RuTime:
|
||||||
ep = [m.start() for m in regfinditer('\)', data)]
|
ep = [m.start() for m in regfinditer('\)', data)]
|
||||||
if len(sp) > 0 :
|
if len(sp) > 0 :
|
||||||
Clz.print(data[:sp[0]+1], Clz.fgb3, False)
|
Clz.print(data[:sp[0]+1], Clz.fgb3, False)
|
||||||
Clz.print(data[sp[0]+1:ep[0]], Clz.fgn2, False)
|
Clz.print(data[sp[0]+1:ep[0]], Clz.fgn7, False)
|
||||||
Clz.print(data[ep[0]:], Clz.fgb3, False)
|
Clz.print(data[ep[0]:], Clz.fgb3, False)
|
||||||
else:
|
else:
|
||||||
Clz.print(data, Clz.fgb3, False, True)
|
Clz.print(data, Clz.fgb3, False, True)
|
||||||
|
@ -240,7 +240,7 @@ class RuTime:
|
||||||
global Clz
|
global Clz
|
||||||
Clz.print(' <== ', Clz.fgb1, False)
|
Clz.print(' <== ', Clz.fgb1, False)
|
||||||
self._paramize(self.label)
|
self._paramize(self.label)
|
||||||
Clz.print('%.5f' % (self.ec-self.sc), Clz.fgn7)
|
Clz.print('%.5f' % (self.ec-self.sc), Clz.fgN4)
|
||||||
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -317,6 +317,26 @@ class IniFile:
|
||||||
else : main += k+' = '+self.dic[s][k]+'\n'
|
else : main += k+' = '+self.dic[s][k]+'\n'
|
||||||
return main + content
|
return main + content
|
||||||
|
|
||||||
|
def print(self,section='*'):
|
||||||
|
""""""
|
||||||
|
a = ''
|
||||||
|
for s in self.dic:
|
||||||
|
if section=='*' or section+'.'==s[:len(section)+1]:
|
||||||
|
if s!='main':
|
||||||
|
#~ if section=='*': content += '\n['+s+']\n'
|
||||||
|
#~ else : content += '\n['+s[len(section)+1:]+']\n'
|
||||||
|
print()
|
||||||
|
Clz.print('['+s+']', Clz.fgB3)
|
||||||
|
for k in sorted(self.dic[s]):
|
||||||
|
k = k.rstrip(' ')
|
||||||
|
if s!='main' :
|
||||||
|
a = ''
|
||||||
|
if len(self.dic[s][k]) > 50: a = '...'
|
||||||
|
Clz.print(k.ljust(10,' ')+' = ' , Clz.fgn7, False)
|
||||||
|
if Clz.isUnix or k is not 'key' :
|
||||||
|
Clz.print(self.dic[s][k][:50]+a, Clz.fgN2)
|
||||||
|
else: Clz.print('key is masked', Clz.fgb1)
|
||||||
|
|
||||||
def read(self):
|
def read(self):
|
||||||
""""""
|
""""""
|
||||||
try:
|
try:
|
||||||
|
@ -403,6 +423,8 @@ class Coloriz:
|
||||||
pc = PColor()
|
pc = PColor()
|
||||||
pc.print('%smon label%s:%sma value%s' % (pc.BG4+pc.fgN7, pc.OFF+pc.fgn1, pc.fgb4, pc.OFF))
|
pc.print('%smon label%s:%sma value%s' % (pc.BG4+pc.fgN7, pc.OFF+pc.fgn1, pc.fgb4, pc.OFF))
|
||||||
"""
|
"""
|
||||||
|
global COLOR_MODE
|
||||||
|
self.active = COLOR_MODE
|
||||||
if not self.isUnix:
|
if not self.isUnix:
|
||||||
j = 0
|
j = 0
|
||||||
for i in (0,4,2,6,1,5,3,7):
|
for i in (0,4,2,6,1,5,3,7):
|
||||||
|
@ -444,6 +466,7 @@ class Coloriz:
|
||||||
""""""
|
""""""
|
||||||
if not endLF : ev = ''
|
if not endLF : ev = ''
|
||||||
else: ev = self._LF
|
else: ev = self._LF
|
||||||
|
if self.active :
|
||||||
tokens = [c.lstrip(self._MARKER[0]).rstrip(self._SEP) for c in colors.split(self._MARKER) if c is not '']
|
tokens = [c.lstrip(self._MARKER[0]).rstrip(self._SEP) for c in colors.split(self._MARKER) if c is not '']
|
||||||
if self.isUnix :
|
if self.isUnix :
|
||||||
if endClz : data += self._uOFF
|
if endClz : data += self._uOFF
|
||||||
|
@ -453,5 +476,7 @@ class Coloriz:
|
||||||
print(data,end=ev)
|
print(data,end=ev)
|
||||||
stdout.flush()
|
stdout.flush()
|
||||||
if endClz : self.setColor(self._wOFF)
|
if endClz : self.setColor(self._wOFF)
|
||||||
|
else:
|
||||||
|
print(data,end=ev)
|
||||||
|
|
||||||
Clz = Coloriz()
|
Clz = Coloriz()
|
||||||
|
|
|
@ -32,28 +32,7 @@ from impra.cli import Cli
|
||||||
import sys, os
|
import sys, os
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
#~ try :
|
|
||||||
#~ print('\033[1;30mGray like Ghost\033[1;m')
|
|
||||||
#~ print('\033[1;31mRed like Radish\033[1;m')
|
|
||||||
#~ print('\033[1;32mGreen like Grass\033[1;m')
|
|
||||||
#~ print('\033[1;33mYellow like Yolk\033[1;m')
|
|
||||||
#~ print('\033[1;34mBlue like Blood\033[1;m')
|
|
||||||
#~ print('\033[1;35mMagenta like Mimosa\033[1;m')
|
|
||||||
#~ print('\033[1;36mCyan like Caribbean\033[1;m')
|
|
||||||
#~ print('\033[1;37mWhite like Whipped Cream\033[1;m')
|
|
||||||
#~ print('\033[1;38mCrimson like Chianti\033[1;m')
|
|
||||||
#~ print('\033[1;41mHighlighted Red like Radish\033[1;m')
|
|
||||||
#~ print('\033[1;42mHighlighted Green like Grass\033[1;m')
|
|
||||||
#~ print('\033[1;43mHighlighted Brown like Bear\033[1;m')
|
|
||||||
#~ print('\033[1;44mHighlighted Blue like Blood\033[1;m')
|
|
||||||
#~ print('\033[1;45mHighlighted Magenta like Mimosa\033[1;m')
|
|
||||||
#~ print('\033[1;46mHighlighted Cyan like Caribbean\033[1;m')
|
|
||||||
#~ print('\033[1;47mHighlighted Gray like Ghost\033[1;m')
|
|
||||||
#~ print('\033[1;48mHighlighted Crimson like Chianti\033[1;m')
|
|
||||||
Cli(get_file_path(__file__ ))
|
|
||||||
#os.system('echo python imprastorage data -l')
|
|
||||||
|
|
||||||
#~ except Exception as e :
|
Cli(get_file_path(__file__ ))
|
||||||
#~ print(e)
|
|
||||||
|
|
||||||
#python -O -m compileall impra/*.py
|
#python -O -m compileall impra/*.py
|
||||||
|
|
Loading…
Reference in New Issue
Block a user