added function to add and remove specific tags from an entry
This commit is contained in:
parent
73904fac53
commit
c8d306dc61
33
image-index
33
image-index
|
@ -246,7 +246,7 @@ class metatable(database):
|
|||
self.collist=["NAME","ALIAS","DESCRIPTION"]
|
||||
super().__init__(filepath)
|
||||
|
||||
def add_index(self,val,alias,randhex= ""):
|
||||
def add_index(self,val,alias,randhex=""):
|
||||
super().add_index([val.lower() + "-" + randhex,alias,''])
|
||||
|
||||
def check_index(self,typ):
|
||||
|
@ -384,7 +384,31 @@ class filestable(database):
|
|||
shutil.move("{}/{}/{}".format(ROOT_DIR,category,filename), "{}/{}/{}".format(ROOT_DIR,update,filename))
|
||||
if typ in ["TAGS"]:
|
||||
tags_list=[]
|
||||
for tag in tags.split(","):
|
||||
if update[0][0] == "+":
|
||||
for tag in sel_list[5].split(","):
|
||||
tags_list.append(tag)
|
||||
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)
|
||||
elif update[0][0] == "-":
|
||||
for tag in sel_list[5].split(","):
|
||||
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 != ".":
|
||||
|
@ -614,8 +638,11 @@ def help(args):
|
|||
print("\tPrompt: image-index update")
|
||||
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 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:
|
||||
print("SYNTAX: image-index <option> [args]")
|
||||
print("OPTIONS:\n\thelp:\tdisplays this text")
|
||||
print("\t\tadd one of the other options to see more info.")
|
||||
print("\tmeta:\tdisplays help for the metadata tables")
|
||||
|
|
Loading…
Reference in a new issue