Contact me to be added to this repository. Push the creations you make for D&D, and they will be displayed in a nice website. See the website for how to contribute.
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

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")
"""