forked from jogordo/DnD_Archive
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
807 B
41 lines
807 B
import os
|
|
import sys
|
|
|
|
import json
|
|
|
|
fpath = sys.argv[1]
|
|
|
|
logfile = '/'.join(fpath.split("/")[:-1])[:-1]+".json"
|
|
print(logfile)
|
|
fname = fpath.split("/")[-1]
|
|
#print(fname)
|
|
with open(fpath) as f:
|
|
lines = f.read().split("\n")
|
|
name = lines[0][6:]
|
|
#print(name)
|
|
logLines = []
|
|
lf = open("./"+logfile,'r')
|
|
log = json.load(lf)
|
|
log[name] = fname
|
|
#print(log)
|
|
lf.close()
|
|
lf = open("./"+logfile,'w')
|
|
json.dump(log,lf)
|
|
lf.close()
|
|
|
|
|
|
"""
|
|
with open(logfile,'rw') as log:
|
|
numl=0
|
|
for l in log.read().split("\n"):
|
|
logLines.append(l)
|
|
numl+=1
|
|
logLines.insert(numl-1,"\"{}\" : \"{}\"".format(name,fname))
|
|
log.seek(0)
|
|
log.truncate()
|
|
for l in logLines:
|
|
print(l)
|
|
log.write(l+"\n")
|
|
|
|
"""
|
|
|