Skip to content

Commit

Permalink
fixes Naereen#3
Browse files Browse the repository at this point in the history
  • Loading branch information
Burrito-Bazooka authored Oct 16, 2016
1 parent 7a50371 commit 6f0f8fd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/ulogme_serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SocketServer
import SimpleHTTPServer
import cgi

import subprocess
from export_events import updateEvents
from rewind7am import rewindTime

Expand All @@ -26,6 +26,12 @@
rootdir = os.getcwd()
os.chdir(os.path.join("..", "render"))

def writenote(note, time_=None):
cmd = ["./note.sh"]
if time_ is not None:
cmd.append(str(time_))
process = subprocess.Popen(cmd, stdin=subprocess.PIPE)
process.communicate(input=note)

# Custom handler
class CustomHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
Expand Down Expand Up @@ -58,7 +64,7 @@ def do_POST(self):
note = form.getvalue("note")
note_time = form.getvalue("time")
os.chdir(rootdir) # pop out
os.system("echo %s | ../scripts/note.sh %s" % (note, note_time))
writenote(note, note_time)
updateEvents() # defined in export_events.py
os.chdir(os.path.join("..", "render")) # go back to render
result = "OK"
Expand Down

0 comments on commit 6f0f8fd

Please sign in to comment.