|
@@ -84,7 +84,7 @@ def log_create(kind, date, tags, log):
|
|
|
raise FileExistsError()
|
|
|
name = hashlib.sha512((kind + date + tags).encode("utf-8")).hexdigest()
|
|
|
f = open(DIR + "/data/" + kind + "/" + name, "x")
|
|
|
- log_add(kind, date, name)
|
|
|
+ log_add(kind, name, date, tags)
|
|
|
return f
|
|
|
|
|
|
# Open existing log file with the specified mode
|
|
@@ -99,15 +99,15 @@ def log_open(kind, date, mode):
|
|
|
def log_find(kind, date):
|
|
|
with open(DIR + "/data/" + kind + "/.data", "r") as f:
|
|
|
for line in f:
|
|
|
- l = line.split()
|
|
|
- if l[0] == date:
|
|
|
- return l[1]
|
|
|
+ l = line.split(":")
|
|
|
+ if l[1] == date:
|
|
|
+ return l[0]
|
|
|
return 0
|
|
|
|
|
|
# Add the log to the .data file
|
|
|
-def log_add(kind, date, name):
|
|
|
+def log_add(kind, name, date, tags):
|
|
|
with open(DIR + "/data/" + kind + "/.data", "a") as f:
|
|
|
- f.write(date + " " + name + "\n")
|
|
|
+ f.write(name + ":" + date + ":" + tags + "\n")
|
|
|
|
|
|
# Print specified log on stdout
|
|
|
def method_get(kind, date):
|