From e169cf1b6b4df506dc893603164602d228d92d3a Mon Sep 17 00:00:00 2001 From: Michael Rodin Date: Mon, 28 Nov 2022 10:56:33 +0100 Subject: [PATCH] made get_randhex a global function --- image-index | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/image-index b/image-index index abaf808..e193f20 100755 --- a/image-index +++ b/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()))