Added changeStatus api endpoint, changed id param in js

This commit is contained in:
dave 2014-08-26 16:31:39 -07:00
parent 75d09c9680
commit 6d52163509
2 changed files with 7 additions and 1 deletions

6
app.py
View File

@ -125,6 +125,12 @@ if __name__ == '__main__' or 'uwsgi' in __name__:
def getStream(self, id):
return json.dumps(self._getStream(id))
@cherrypy.expose
def changeStatus(self, streamid, newStatus):
streamid = int(streamid)
db.execute('UPDATE "streams" SET "status"=? WHERE "ud"=? ;', [newStatus, streamid])
return json.dumps({"result":True})
@cherrypy.expose
def changeTimeDay(self, streamid, day, value):
streamid = int(streamid)

View File

@ -94,7 +94,7 @@ var ui = {
} else {
newStatus = 1
}
$.ajax("/api/changeStatus", {dataType:"json", data:{id:streamid, status:newStatus},error:function(){
$.ajax("/api/changeStatus", {dataType:"json", data:{streamid:streamid, status:newStatus},error:function(){
console.log("Couldn't save! changeStatus");
}})
})