Reply
Thread Tools
int_ua's Avatar
Posts: 676 | Thanked: 1,067 times | Joined on Jul 2010 @ Kyiv, Ukraine
#1
Is it possible to disable or at least change alarm sound from python on Maemo 5?
Here is the code that doesn't work:
Code:
import alarm
from time import time

def set_alarm( message = "alarm"):
    event = alarm.Event()
    event.appid = 'test'
    event.message = message

    event.alarm_time = time() + 1
    event.sound = "/home/user/MyDocs/.sounds/sound.wav"

    action_stop, action_snooze = event.add_actions(2)
    action_stop.label = 'Stop'
    action_stop.flags |= alarm.ACTION_WHEN_RESPONDED | alarm.ACTION_TYPE_NOP
    action_snooze.label = 'Snooze'
    action_snooze.flags |= alarm.ACTION_WHEN_RESPONDED | alarm.ACTION_TYPE_SNOOZE

    cookie = alarm.add_event(event)
    return cookie

set_alarm()
According to C documentation sound can be NULL to disable it but python wrapper demands a string
 

The Following User Says Thank You to int_ua For This Useful Post:
Posts: 992 | Thanked: 738 times | Joined on Jun 2010 @ Low Earth Orbit
#2
Create a silent sound file and point to that when you want to disable alarm?
 
Community Council | Posts: 4,920 | Thanked: 12,867 times | Joined on May 2012 @ Southerrn Finland
#3
That occured to me also, but wouldn't it be a little too hacky a kludge
 
int_ua's Avatar
Posts: 676 | Thanked: 1,067 times | Joined on Jul 2010 @ Kyiv, Ukraine
#4
Originally Posted by kureyon View Post
Create a silent sound file and point to that when you want to disable alarm?
Can you please try the code I've posted? It doesn't change the sound for me.
 
Posts: 1,100 | Thanked: 2,797 times | Joined on Apr 2011 @ Netherlands
#5
AFAIK: custom sound per alarm does not work; it is simply ignored and your standard alarm sound is used.
 

The Following User Says Thank You to ade For This Useful Post:
Posts: 3,074 | Thanked: 12,960 times | Joined on Mar 2010 @ Sofia,Bulgaria
#6
Originally Posted by ade View Post
AFAIK: custom sound per alarm does not work; it is simply ignored and your standard alarm sound is used.
Confirming, https://gitorious.org/community-ssu/...larm.c#line685

Maybe someone can send a patch
__________________
Never fear. I is here.

720p video support on N900,SmartReflex on N900,Keyboard and mouse support on N900
Nothing is impossible - Stable thumb2 on n900

Community SSU developer
kernel-power developer and maintainer

 

The Following User Says Thank You to freemangordon For This Useful Post:
Posts: 1,100 | Thanked: 2,797 times | Joined on Apr 2011 @ Netherlands
#7
Originally Posted by freemangordon View Post
Confirming, https://gitorious.org/community-ssu/...larm.c#line685

Maybe someone can send a patch
Looks like a less-than-an-hour patch for someone like you.

What about you adding some additional code in case a custom sound is set, and I will try to add support for custom per alarm sound in the worldclock replacement. Deal or what ?
 

The Following 4 Users Say Thank You to ade For This Useful Post:
Posts: 3,074 | Thanked: 12,960 times | Joined on Mar 2010 @ Sofia,Bulgaria
#8
Originally Posted by ade View Post
Looks like a less-than-an-hour patch for someone like you.

What about you adding some additional code in case a custom sound is set, and I will try to add support for custom per alarm sound in the worldclock replacement. Deal or what ?
Deal .

But I have no time to do it right now, I am chasing some more important bugs in ke-recv. But will do it when I am back to alarmui, anyway there is a bug in it that has to be somehow fixed
__________________
Never fear. I is here.

720p video support on N900,SmartReflex on N900,Keyboard and mouse support on N900
Nothing is impossible - Stable thumb2 on n900

Community SSU developer
kernel-power developer and maintainer

 

The Following 4 Users Say Thank You to freemangordon For This Useful Post:
Posts: 48 | Thanked: 85 times | Joined on Feb 2010
#9
Hi guys,
here I reverse engineered the clockd, to disable clock alarms in vacations.
I have a calendar database added to maemo calendar to know local vacations, using informations of this database my script to disable the clock alarm that respond a specific name.
My solution needs of some tuning actions.
First you need to add a work alarm for your specific working days (e.g. Mon-Fry), and to call it with a specific name (e.g. "work alarm") that you will use in the script "tilafestapiccaniresta.sh".
Later you need to see the flag that results activating and deactivating this specific alarm in the file /var/cache/alarmd/alarm_queue.ini:
cat /var/cache/alarmd/alarm_queue.ini|grep -A 6 -B6 -i "work alarm"
The two number you found must be used in the file "change_flag_alarm.sh" (active_flag and deactive_flag).
And finally you need a calendar database file to add holidays to your calendar (this calendar database must contain the word "holidays" in the name).
The script that change the flag of the alarm can send an email by wget query if you create a php site to manage this (working example provided).

PS: It can be some translation error, I rapidly changed the language to English. You need to install sqlite3. You can decide if the entire August is vacations (for those that like me work in academic places).

Enjoy!!!
Attached Files
File Type: zip alarm.zip (3.6 KB, 168 views)

Last edited by Ilmanowar; 2015-08-20 at 11:15.
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 22:25.