Exemple #1
0
def processFiles(filetype, notification_sent):
    # process each file
    for fname in glob.glob(
            config.get('watchdog', 'watch_dir') + "/*." + filetype):
        print "Processing " + fname

        # upload to dropbox if enabled
        if config.get('watchdog', 'dropbox_upload'):
            uploadToDropBox(fname)

        # send notification
        if not notification_sent and config.get('watchdog', 'notify'):
            print "Sending Notification"

            message = config.get(
                'watchdog',
                'device_name') + " has triggered a WatchDog Alert \n"
            # add dropbox link
            if config.get('dropbox', 'share_link'):
                message += "\n " + config.get('dropbox', 'share_link')

            # Build the notification
            notifier.setConfig(config)
            notifier.setMessage(message)
            notifier.sendNotification()
            notification_sent = True

            # create a flag file
            subprocess.call(["touch", lock_file])

    return notification_sent
Exemple #2
0
 def _setStatus(self, status, notify=True):
     self.status = status
     self.db.execute("UPDATE tasks SET status = '{}' WHERE id = {};".format(
         status, self.id))
     if notify:
         with Notifier() as notifier:
             notifier.sendNotification(
                 "task", "sid={},tatus={}".format(self.id, self.status))
Exemple #3
0
 def _setProgressPercent(self, progress_percent, notify=True):
     self.progress_percent = progress_percent
     self.db.execute(
         "UPDATE tasks SET progress_percent = {} WHERE id = {};".format(
             progress_percent, self.id))
     if notify:
         with Notifier() as notifier:
             notifier.sendNotification(
                 "task", "id={},status={},progress_percent={}".format(
                     self.id, self.status, self.progress_percent))
Exemple #4
0
def main():
    """
    Perform searches for the given flight parameters.
    """
    args = myParser.parse()

    if args.company == "Southwest":
        real_total = swaScraper.scrape(args)

    notifier.sendNotification(real_total, args.max_price)
Exemple #5
0
def ringHandler(pin):
    if "openeButtonCycle" not in globals():
        global openeButtonCycle
        openeButtonCycle = True
        
    if GPIO.input(gpioConfig.ringListenerPin) == 0 and openeButtonCycle is True:
        openeButtonCycle = False

    elif openeButtonCycle is False:
        openeButtonCycle = True

        localtime = time.asctime( time.localtime(time.time()) )
        print("Doorbell rang on PIN #" + str(pin) +" at: " + localtime)

        notifier.sendNotification()
        buzzer.buzz()
Exemple #6
0
def main():
    """
    Perform searches for the given flight parameters.
    """
    args = myParser.parse()

    if args.company == "Southwest":
        real_total = swaScraper.scrape(args)

    # If the user doesn't want text notifications, just print the result to the console.
    if args.no_text:
        from datetime import datetime

        print("[%s] Found a deal. Max Total: $%s. Current Total: $%s." %
              (datetime.now().strftime("%Y-%m-%d %H:%M:%S"), args.max_price,
               str(real_total)))
    else:
        # Send a text notifying the user that a lower price was found.
        import notifier
        notifier.sendNotification(real_total, args.max_price)