added function to add and remove specific tags from an entry
This commit is contained in:
parent
73904fac53
commit
c8d306dc61
45
image-index
45
image-index
|
@ -246,7 +246,7 @@ class metatable(database):
|
||||||
self.collist=["NAME","ALIAS","DESCRIPTION"]
|
self.collist=["NAME","ALIAS","DESCRIPTION"]
|
||||||
super().__init__(filepath)
|
super().__init__(filepath)
|
||||||
|
|
||||||
def add_index(self,val,alias,randhex= ""):
|
def add_index(self,val,alias,randhex=""):
|
||||||
super().add_index([val.lower() + "-" + randhex,alias,''])
|
super().add_index([val.lower() + "-" + randhex,alias,''])
|
||||||
|
|
||||||
def check_index(self,typ):
|
def check_index(self,typ):
|
||||||
|
@ -384,14 +384,38 @@ class filestable(database):
|
||||||
shutil.move("{}/{}/{}".format(ROOT_DIR,category,filename), "{}/{}/{}".format(ROOT_DIR,update,filename))
|
shutil.move("{}/{}/{}".format(ROOT_DIR,category,filename), "{}/{}/{}".format(ROOT_DIR,update,filename))
|
||||||
if typ in ["TAGS"]:
|
if typ in ["TAGS"]:
|
||||||
tags_list=[]
|
tags_list=[]
|
||||||
for tag in tags.split(","):
|
if update[0][0] == "+":
|
||||||
randhex=get_randhex()
|
for tag in sel_list[5].split(","):
|
||||||
name=ttb.get_name(tag)
|
tags_list.append(tag)
|
||||||
if name != ".":
|
for tag in update[1:].split(","):
|
||||||
|
randhex=get_randhex()
|
||||||
|
name=ttb.get_name(tag)
|
||||||
|
if name == ".":
|
||||||
|
ttb.add_index(tag.lower(), tag, randhex)
|
||||||
|
name=ttb.get_name(tag)
|
||||||
tags_list.append(name)
|
tags_list.append(name)
|
||||||
else:
|
elif update[0][0] == "-":
|
||||||
ttb.add_index(tag.lower(), tag, randhex)
|
for tag in sel_list[5].split(","):
|
||||||
tags_list.append(ttb.get_name(tag))
|
success=0
|
||||||
|
for i in update[1:].split(","):
|
||||||
|
name=ttb.get_name(i)
|
||||||
|
if name == ".":
|
||||||
|
randhex=get_randhex()
|
||||||
|
ttb.add_index(tag.lower(), tag)
|
||||||
|
name=ttb.get_name(tag)
|
||||||
|
if name == tag:
|
||||||
|
success = -1
|
||||||
|
if success >= 0:
|
||||||
|
tags_list.append(tag)
|
||||||
|
else:
|
||||||
|
for tag in update.split(","):
|
||||||
|
randhex=get_randhex()
|
||||||
|
name=ttb.get_name(tag)
|
||||||
|
if name != ".":
|
||||||
|
tags_list.append(name)
|
||||||
|
else:
|
||||||
|
ttb.add_index(tag.lower(), tag, randhex)
|
||||||
|
tags_list.append(ttb.get_name(tag))
|
||||||
update=",".join(tags_list)
|
update=",".join(tags_list)
|
||||||
super().update_index(typ, update, "HASH", filehash)
|
super().update_index(typ, update, "HASH", filehash)
|
||||||
|
|
||||||
|
@ -614,8 +638,11 @@ def help(args):
|
||||||
print("\tPrompt: image-index update")
|
print("\tPrompt: image-index update")
|
||||||
print('EXAMPLES:\nimage-index update category "New Category" -t example')
|
print('EXAMPLES:\nimage-index update category "New Category" -t example')
|
||||||
print('image-index update Tags "Tag,Example,Test" -s https:// -a example')
|
print('image-index update Tags "Tag,Example,Test" -s https:// -a example')
|
||||||
print('image-index update title "Some new title" -g "some thing" -a an example\n')
|
print('image-index update title "Some new title" -g "some thing" -a an example')
|
||||||
|
print('SPECIAL EXAMPLES TAGS:\nimage-index update tags +New_tag,hello -g "some thing" (adds the tags "New_tag" and "hello")')
|
||||||
|
print('image-index update tags -Tag -t Example (removes the tag "Tag")\n')
|
||||||
if not args:
|
if not args:
|
||||||
|
print("SYNTAX: image-index <option> [args]")
|
||||||
print("OPTIONS:\n\thelp:\tdisplays this text")
|
print("OPTIONS:\n\thelp:\tdisplays this text")
|
||||||
print("\t\tadd one of the other options to see more info.")
|
print("\t\tadd one of the other options to see more info.")
|
||||||
print("\tmeta:\tdisplays help for the metadata tables")
|
print("\tmeta:\tdisplays help for the metadata tables")
|
||||||
|
|
Loading…
Reference in a new issue