def build_date(self, index, once, once_date, every, every_spin, from_date, to_date): value = "" if index == 0: #once if once == 0: value = once_date else: value = self.once_combo[once] elif index == 1: #every day value = "every day" elif index == 2: #every X days value = "every " value += str(int(every_spin)) value += " days" elif index == 3: #every Xth of the month value = "every " value += str(int(every_spin)) elif index == 4: #every <day> value = "every " value += self.every_combo[every] elif index == 5: #every other day value = "every other" elif index == 6: #Next X days value = "next " value += str(int(every_spin)) value += " days" if index > 0: if from_date != "": value += " from " + from_date if index != 6: if from_date != "" and to_date != "": value += " to " + to_date return datetimeutil.date_to_local(value.lower())
def __init__(self, filename): self.filename = filename self.database = db.Database(self.filename) self.database.close() self.settings = Config() self.label = self.settings.label self.time = datetimeutil.time_to_local(self.settings.time) self.date = datetimeutil.date_to_local(self.settings.date) self.command = self.settings.command self.notes = "" self.popup = self.settings.popup self.dialog = self.settings.dialog self.boxcar = self.settings.boxcar_notify self.boxcar_ok = self.settings.boxcar_token != '' self.pushbullet_api_key = self.settings.pushbullet_api_key self.pushbullet_device = self.settings.pushbullet_device self.pushbullet_devices = self.settings.pushbullet_devices self.pushbullet_ok = self.settings.pushbullet_api_key != '' self.pushbullet_device_index = self.get_pushbullet_index() self.sound_file = self.settings.sound_file self.sound_length = self.settings.sound_play_length self.sound_loop = self.settings.sound_loop self.sound_loop_times = self.settings.sound_loop_times self.time_format = self.settings.time_format self.date_format = self.settings.date_format self.play_sound = False if self.sound_file is not None and not self.sound_file == "": self.play_sound = True