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