This is the signout script that opens the xl file and fill in signout info.
Opens up list of signin data. This is date of sign in, time, name, and reason. This is .meta. This script appends sign out data. This is signout date, signout time, and comments.
8 urandom 128 keys are generated. Used these in saving the achieve, as .html, and .meta files.
creates date and time mark and asks for comment
This needs rewriten to remove xl stuff opening. keep it to json and dict.
In [1]:
#import xlrd
import os
import time
#from xlutils.copy import copy
#from xlrd import *
import dominate
import json
In [2]:
#wrkbook = xlrd.open_workbook('/home/wcmckee/whai/index.xls')
In [3]:
jsopn = open('/home/wcmckee/visignsys/index.json', 'r')
jsrdv = jsopn.read()
In [4]:
jsrdv
Out[4]:
In [5]:
#print wrkbook.sheet_names()
#worksheet = wrkbook.sheet_by_name('visitor sign database')
#swlis = []
#num_rows = worksheet.nrows - 1
#curr_row = -1
#while curr_row < num_rows:
# curr_row += 1
# row = worksheet.row(curr_row)
#print row
# swlis.append(row)
In [6]:
#valis = []
In [7]:
#for swl in swlis[1]:
# print swl.value
# valis.append(swl.value)
In [8]:
tiran = os.urandom(128).encode('hex')
reran = os.urandom(128).encode('hex')
comran = os.urandom(128).encode('hex')
In [7]:
inpcom = raw_input('comment: ')
In [8]:
endate = time.strftime("%d" + "-" + "%b" + "-" + "%Y")
entim = time.strftime("%H:%M")
In [9]:
snoutm = {'out-date': endate}
snoutm.update({'out-time': entim})
snoutm.update({'out-comment': inpcom})
In [10]:
signoutdic = {endate: tiran}
timoutdic = {entim: reran}
In [11]:
signoutdic.update({entim:reran})
In [12]:
signoutdic.update({inpcom: comran})
In [13]:
signkeys = signoutdic.keys()
In [14]:
wha = open('/home/wcmckee/visignsys/index.json', 'a')
#w = copy(open_workbook('/home/wcmckee/whai/index.xls'))
#w.get_sheet(0).write(1,5, time.strftime("%d" + "-" + "%b" + "-" + "%Y"))
#w.get_sheet(0).write(1,6, time.strftime("%H:%M"))
#w.get_sheet(0).write(1,7, tiran)
#w.save('/home/wcmckee/whai/index.xls')
In [15]:
indsav = ('/home/wcmckee/whai/index.html')
In [16]:
opind = open(indsav, 'w')
In [17]:
import dominate
from dominate.tags import *
doc = dominate.document(title=wrkbook.sheet_names())
with doc.head:
link(rel='stylesheet', href='style.css')
script(type='text/javascript', src='script.js')
with doc:
with div(id='header').add(ol()):
for i in valis:
li(a(i))
with div():
attr(cls='body')
p('visitor sign database is open source. Visit https://github.com/wcmckee/wcmckee ')
#print doc
In [18]:
opind.write(str(doc))
In [19]:
opind.close()
In [20]:
liop = open('/home/wcmckee/visignsys/index.meta', 'a+')
liop.write(str(signkeys))
liop.close()
In [80]:
In [81]:
oplis = open('/home/wcmckee/visignsys/index.meta', 'r')
oplsav = oplis.read()
oplis.close()
In [82]:
trsor = tiran[0:12]
In [83]:
trsor
Out[83]:
In [84]:
optrd = open('/home/wcmckee/visignsys/posts/' + trsor + '.meta', 'w')
optrd.write(oplsav)
optrd.close()
In [85]:
jsnrd = open('/home/wcmckee/visignsys/posts/' + trsor + '.json', 'w')
jsnrd.write(oplsav)
jsnrd.close()
In [86]:
savpos = open('/home/wcmckee/visignsys/index.json', 'r')
signindi = savpos.read()
In [87]:
jsnaccept = signindi.replace("'", "\"")
d = json.loads(jsnaccept)
In [88]:
snct = dict(d.items() + snoutm.items())
In [89]:
savpos.close()
In [90]:
os.chdir('/home/wcmckee/visignsys/posts')
In [91]:
lismet = os.listdir('/home/wcmckee/visignsys/posts')
In [92]:
lismet
Out[92]:
In [99]:
opjsnz = []
In [100]:
for beca in lismet:
if '.json' in beca:
print beca
opjsnz.append(beca)
In [121]:
optjz = []
optjsz = []
In [122]:
apgpls = []
In [124]:
#for opjw in opjsnz:
# print opjw
# optjsz.append(objw)
In [125]:
#for filop in opjsnz:
#print filop
# opt = open(opj, 'r')
# thedict = str(opt.read())
# thedict
# opt.close()
In [126]:
#opt = open(opj, 'r')
In [127]:
#thedict = opt.read()
In [128]:
#thedict
Out[128]:
In [129]:
#convgpj = json.loads(thedict)
In [130]:
#convgpj.values()
Out[130]:
In [130]:
In [ ]: