Added text to indicate successful execution
This commit is contained in:
parent
26744964f2
commit
3f62f678bd
46
image-index
46
image-index
|
@ -254,13 +254,15 @@ class metatable(database):
|
||||||
for i in tb.get_col(typ):
|
for i in tb.get_col(typ):
|
||||||
success=0
|
success=0
|
||||||
for j in self.get_col("NAME"):
|
for j in self.get_col("NAME"):
|
||||||
if j[0] in i[0].lower():
|
if j[0] in i[0]:
|
||||||
success=1
|
success=1
|
||||||
if not i[0] in res and success == 0:
|
if not i[0] in res and success == 0:
|
||||||
res.append(i[0])
|
res.append(i[0])
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def get_alias(self,arg):
|
def get_alias(self,arg):
|
||||||
|
if not arg:
|
||||||
|
return "."
|
||||||
selection=self.search_index(arg,"strict")
|
selection=self.search_index(arg,"strict")
|
||||||
item=selection[0]
|
item=selection[0]
|
||||||
if item[0] != ".":
|
if item[0] != ".":
|
||||||
|
@ -270,6 +272,8 @@ class metatable(database):
|
||||||
return alias
|
return alias
|
||||||
|
|
||||||
def get_name(self,arg):
|
def get_name(self,arg):
|
||||||
|
if not arg:
|
||||||
|
return "."
|
||||||
selection=self.search_index(arg,"strict")
|
selection=self.search_index(arg,"strict")
|
||||||
item=selection[0]
|
item=selection[0]
|
||||||
name=item[0]
|
name=item[0]
|
||||||
|
@ -300,7 +304,7 @@ class filestable(database):
|
||||||
filehash=self.get_hash(filepath) # make hash of file before copy
|
filehash=self.get_hash(filepath) # make hash of file before copy
|
||||||
if filehash in str(self.get_col("HASH")):
|
if filehash in str(self.get_col("HASH")):
|
||||||
print("This file already exists!")
|
print("This file already exists!")
|
||||||
return
|
return False
|
||||||
n=0
|
n=0
|
||||||
randhex=get_randhex()
|
randhex=get_randhex()
|
||||||
# get the name of the category from the meta table
|
# get the name of the category from the meta table
|
||||||
|
@ -335,9 +339,10 @@ class filestable(database):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
print("COULDN'T COPY FILE TO DESTINATION!")
|
print("COULDN'T COPY FILE TO DESTINATION!")
|
||||||
return
|
return False
|
||||||
vallist=[filename,filehash,title,source,category,tags,content]
|
vallist=[filename,filehash,title,source,category,tags,content]
|
||||||
super().add_index(vallist)
|
super().add_index(vallist)
|
||||||
|
return True
|
||||||
|
|
||||||
def check_index(self):
|
def check_index(self):
|
||||||
hash_list=[]
|
hash_list=[]
|
||||||
|
@ -361,6 +366,7 @@ class filestable(database):
|
||||||
def delete_index(self,sel_list):
|
def delete_index(self,sel_list):
|
||||||
self.get_item("HASH",sel_list[1])
|
self.get_item("HASH",sel_list[1])
|
||||||
super().delete_index("HASH",sel_list[1])
|
super().delete_index("HASH",sel_list[1])
|
||||||
|
return True
|
||||||
|
|
||||||
def update_index(self,typ,update,sel_list):
|
def update_index(self,typ,update,sel_list):
|
||||||
typ=typ.upper()
|
typ=typ.upper()
|
||||||
|
@ -539,7 +545,9 @@ def add(args):
|
||||||
print(" The file '{}' doesn't exist or is not a file!".format(eingabe))
|
print(" The file '{}' doesn't exist or is not a file!".format(eingabe))
|
||||||
return 1
|
return 1
|
||||||
n+=1
|
n+=1
|
||||||
tb.add_index(args[0],args[1],args[2],args[3],args[4],args[5])
|
success=tb.add_index(args[0],args[1],args[2],args[3],args[4],args[5])
|
||||||
|
if success:
|
||||||
|
print("Added '{}'!".format(args[2]))
|
||||||
|
|
||||||
def check(args):
|
def check(args):
|
||||||
success=0
|
success=0
|
||||||
|
@ -600,6 +608,7 @@ def delete(args):
|
||||||
print("Couldn't delete a file!")
|
print("Couldn't delete a file!")
|
||||||
return 1
|
return 1
|
||||||
tb.delete_index(sel)
|
tb.delete_index(sel)
|
||||||
|
print("Deleted '{}'!".format(sel[2]))
|
||||||
|
|
||||||
def help(args):
|
def help(args):
|
||||||
syntax=False
|
syntax=False
|
||||||
|
@ -675,7 +684,7 @@ def meta_check(typ,args):
|
||||||
tres=ttb.check_index("TAGS")
|
tres=ttb.check_index("TAGS")
|
||||||
else:
|
else:
|
||||||
print("No valid type specified!")
|
print("No valid type specified!")
|
||||||
return
|
return False
|
||||||
if tres:
|
if tres:
|
||||||
yas=True
|
yas=True
|
||||||
print("Missing items:",','.join(tres))
|
print("Missing items:",','.join(tres))
|
||||||
|
@ -694,6 +703,8 @@ def meta_check(typ,args):
|
||||||
ctb.add_index(val,eingabe,randhex)
|
ctb.add_index(val,eingabe,randhex)
|
||||||
elif re.match('[tT].*',typ):
|
elif re.match('[tT].*',typ):
|
||||||
ttb.add_index(val,eingabe,randhex)
|
ttb.add_index(val,eingabe,randhex)
|
||||||
|
else:
|
||||||
|
print("Everything is good!")
|
||||||
|
|
||||||
def meta_update(typ,args):
|
def meta_update(typ,args):
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
|
@ -756,7 +767,24 @@ def update(args):
|
||||||
update=args[1]
|
update=args[1]
|
||||||
for sel in selection:
|
for sel in selection:
|
||||||
if sel[0] != ".":
|
if sel[0] != ".":
|
||||||
|
n=0
|
||||||
|
for i in tb.collist:
|
||||||
|
if i.lower() == typ.lower():
|
||||||
|
old=sel[n]
|
||||||
|
else:
|
||||||
|
n+=1
|
||||||
tb.update_index(typ,update,sel)
|
tb.update_index(typ,update,sel)
|
||||||
|
if re.match('[tT][aA].*', typ) and re.match('[-+]', update[0]):
|
||||||
|
tags_list=[]
|
||||||
|
for tag in update[1:].split(","):
|
||||||
|
tags_list.append(tag)
|
||||||
|
tagstr=", ".join(tags_list)
|
||||||
|
if update[0] == "-":
|
||||||
|
print("Removed {}!".format(tagstr))
|
||||||
|
elif update[0] == "+":
|
||||||
|
print("Added {}!".format(tagstr))
|
||||||
|
else:
|
||||||
|
print("Updated {} to {}!".format(old,update))
|
||||||
|
|
||||||
def repair(err_list):
|
def repair(err_list):
|
||||||
sel_list=[]
|
sel_list=[]
|
||||||
|
@ -801,11 +829,9 @@ def show(args):
|
||||||
print("\tHash:\t ",res[1])
|
print("\tHash:\t ",res[1])
|
||||||
tags_list=[]
|
tags_list=[]
|
||||||
for tag in res[5].split(","):
|
for tag in res[5].split(","):
|
||||||
name=ttb.get_alias(tag)
|
alias=ttb.get_alias(tag)
|
||||||
if name != ".":
|
if alias != ".":
|
||||||
tags_list.append(name)
|
tags_list.append(alias)
|
||||||
else:
|
|
||||||
tags_list.append(tag)
|
|
||||||
print("\tTags:\t ",",".join(tags_list))
|
print("\tTags:\t ",",".join(tags_list))
|
||||||
print("\tContent: ",res[6])
|
print("\tContent: ",res[6])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue