Beispiel #1
0
def run():
    serviceStatus = mta.getServiceStatus()
    timeStamp = serviceStatus["time"]
    while True:
        serviceStatus = mta.getServiceStatus()
        if serviceStatus["time"] != timeStamp:
            # get subscribers
            subscribers = storage.getSubscribers()
            for phone, trainList in subscribers.items():
                for trainNum in trainList:
                    if serviceStatus["lines"].has_key(trainNum):
                        works = serviceStatus["lines"][trainNum]
                        message = ""
                        for work in works:
                            message += work["short"] + " " + work["detail"] + " "
                        att.sendSMS(phone, message)
        timeStamp = serviceStatus["time"]
        print "running..."
        time.sleep(60)
Beispiel #2
0
 def getServiceStatus(self):
     lineResult = mta.getServiceStatus()
     self.write(json.dumps(lineResult))