amarok Alarm


Written by Andreas Roth
Last Updated on Friday, 15 January 2010 11:00
Work in progress

The amarok Alarm is a script for the amarok 1.x series. This script allows you to configure a PC to be used as alarm clock.
Basic Concept
The amarok alarm script uses cron jobs to wake up the PC which is supposed to be used as alarm clock. On this PC an instance of amarok 1.x is running together with the amarok alarm script. The script will run a predefined playlist when an alarm occurs. There are several options to configure what actions the script should perform on an alarm occurrence. You can use suspend-to-disk (hibernate) or suspend-to-ram(standby) to reduce the power consumption of the alarm PC. The amarok script itself does not wake up the PC at the scheduled time, this is the responsibility of another machine. On this second machine the amarok alarm script can be used to generate the cron jobs and do the wake up of the alarm PC.
Configuration
The configuration of the alarm script is divided into two parts: one part for the generic configuration and the second part for scheduling of the alarms. The generic configuration is stored in a simple file ($HOME/.kde/share/apps/amarok/scripts-data/alarmrc) on the disk. The alarm scheduling is done in a calendar in a Kolab mailbox.
The configuration file includes the mail server name, the user name and password to access your Kolab mailbox. It also includes the default settings for the alarms. The defaults can be set in the configuration file and each alarm can override these settings if necessary.The following table includes all parameters in the configuration file (and if the parameter can be overridden by the alarm configuration).
| Section |
Name
|
Type
|
Description
|
Alarm override
|
Alarm
|
mailserver
|
string
|
hostname of your mail server
|
no
|
| Alarm |
username |
string |
user name to access to mailbox
|
no |
Alarm
|
password
|
string
|
password to your mailbox
|
no
|
Alarm
|
authmech
|
string
|
authentication mechanism used to access your mailbox. Can be either GSSAPI or PLAIN
|
no |
Alarm
|
mailbox
|
string
|
name of the mailbox (e.g. INBOX\Calendar)
|
no
|
Alarm
|
updateinterval
|
integer
|
time in seconds between rescanning of the mailbox |
no
|
Alarm
|
wolserver
|
string
|
name of Wake-On-LAN server
|
yes
|
Alarm
|
fadestart
|
integer
|
start volume in percent for volume fading
|
yes
|
Alarm
|
fadestop
|
integer
|
stop volume in percent for volume fading
|
yes |
Alarm
|
fadetime
|
integer
|
duration of the volume fading in seconds |
yes
|
Alarm
|
snoozelen
|
integer
|
number of seconds to snooze
|
yes
|
Alarm
|
snoozeOnPause |
boolean
|
if enabled snooze when pause is pressed
|
yes
|
Alarm
|
stopAlarmOnStop |
boolean
|
if enabled stop an alarm when stop is pressed
|
yes
|
Playlist
|
playlist
|
string
|
filename of the playlist |
yes
|
Playlist
|
repeatTrack |
boolean
|
enable/disable repeat of track |
yes
|
Playlist
|
repeatPlaylist
|
boolean
|
enable/disable repeat of the whole playlist
|
yes
|
Playlist
|
random
|
boolean
|
enable/disable pick of a random track from the playlist |
yes
|
Sleep
|
execute
|
string
|
command to execute on sleep; usually this command turns off the PC and other related devices. |
no
|
You can use e.g. KOrganizer to create a new alarm or manage existing alarms in your calendar. The alarm script uses a fixed category named 'Wakeup' to distinguish between regular scheduled events and alarms for the script. To schedule an alarm just create a new event and set the start and end time and be sure to select the category 'Wakeup' (just create it if it does not exist yet). amarok alarm also support reoccurring events, so can create a single event to wake you up at 7 o'clock in the morning on every week day. The name of the wake up event can be chosen freely without any restrictions. The description of the event is used by the script for configuration of alarm specific parameters (e.g. playlist).
Download
Requirements
- amarok version 1.4.x
- python version 2.5.x (it might work with older versions of python, but it hasn't been tested)
- python-dateutil
- python-kde3
- python-gsasl (available from here or here)
Changelog
- 2008-12-06
Initial release.