Implement alarm sound
This commit is contained in:
parent
b7dbc597d8
commit
df31c4dcd1
15 changed files with 531 additions and 50 deletions
|
|
@ -250,6 +250,25 @@ func DeleteAlarmSingle(db *LevelDBStorage, alarm *AlarmSingle) (err error) {
|
|||
return db.delete(fmt.Sprintf("alarm-single-%s", alarm.Id.ToString()))
|
||||
}
|
||||
|
||||
func RemoveOldAlarmsSingle(db *LevelDBStorage) error {
|
||||
alarms, err := GetAlarmsSingle(db)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
for _, alarm := range alarms {
|
||||
if now.After(time.Time(alarm.Time)) {
|
||||
err = DeleteAlarmSingle(db, alarm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type AlarmException struct {
|
||||
Id Identifier `json:"id"`
|
||||
Start *Date `json:"start"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue