made get_randhex a global function
This commit is contained in:
parent
302e2d12de
commit
e169cf1b6b
22
image-index
22
image-index
|
@ -107,12 +107,6 @@ class database():
|
|||
return ["."]
|
||||
return res
|
||||
|
||||
def get_randhex(self,count=5):
|
||||
randhex=""
|
||||
for i in range(count):
|
||||
randhex+=random.choice("0123456789abcdef")
|
||||
return randhex
|
||||
|
||||
def select_index(self,sel_list,quiet=False):
|
||||
if quiet == "strict":
|
||||
return sel_list
|
||||
|
@ -296,7 +290,7 @@ class filestable(database):
|
|||
print("This file already exists!")
|
||||
return
|
||||
n=0
|
||||
randhex=self.get_randhex()
|
||||
randhex=get_randhex()
|
||||
# get the name of the category from the meta table
|
||||
if not category:
|
||||
category="default"
|
||||
|
@ -310,7 +304,7 @@ class filestable(database):
|
|||
# get the name of the tags from the meta table
|
||||
tags_list=[]
|
||||
for tag in tags.split(','):
|
||||
randhex=self.get_randhex()
|
||||
randhex=get_randhex()
|
||||
name=ttb.get_name(tag)
|
||||
if name != ".":
|
||||
tag=name
|
||||
|
@ -364,7 +358,7 @@ class filestable(database):
|
|||
category=sel_list[4]
|
||||
filehash=sel_list[1]
|
||||
filename=sel_list[0]
|
||||
randhex=self.get_randhex()
|
||||
randhex=get_randhex()
|
||||
if typ in ["CATEGORY"]:
|
||||
# get alias of category
|
||||
name=ctb.get_name(update)
|
||||
|
@ -379,7 +373,7 @@ class filestable(database):
|
|||
if typ in ["TAGS"]:
|
||||
tags_list=[]
|
||||
for tag in tags.split(","):
|
||||
randhex=self.get_randhex()
|
||||
randhex=get_randhex()
|
||||
name=ttb.get_name(tag)
|
||||
if name != ".":
|
||||
tags_list.append(name)
|
||||
|
@ -476,6 +470,12 @@ class filestable(database):
|
|||
|
||||
return self.select_index(selection,quiet)
|
||||
|
||||
def get_randhex(self,count=5):
|
||||
randhex=""
|
||||
for i in range(count):
|
||||
randhex+=random.choice("0123456789abcdef")
|
||||
return randhex
|
||||
|
||||
def add(args):
|
||||
if len(args) >= 6:
|
||||
tb.add_index(args[0],args[1],args[2],args[3],args[4],args[5])
|
||||
|
@ -645,7 +645,7 @@ def meta_check(typ,args):
|
|||
yas=False
|
||||
print("yo")
|
||||
for val in tres:
|
||||
randhex=tb.get_randhex()
|
||||
randhex=get_randhex()
|
||||
|
||||
if yas:
|
||||
eingabe=input("Enter Alias for {}: ".format(val.upper()))
|
||||
|
|
Loading…
Reference in a new issue