Difference between revisions of "Pager Nagger"

From WebOS Internals
Jump to navigation Jump to search
(New page: I use my phone as a pager when I'm on-call at work. The Pre's notification tone is //way// too short and quiet to wake me up. Here's a script that will nag you by playing a .wav file eve...)
 
Line 62: Line 62:
 
== To Do/Bugs==
 
== To Do/Bugs==
  
As the message is marked read in the database when it is closed, the sound will continue to play every minute until the messaging app is closed (or until that chat card is closed if you've done the [[[stock-application-mods |Create a new card for each conversation]]] mod).
+
As the message is marked read in the database when it is closed, the sound will continue to play every minute until the messaging app is closed (or until that chat card is closed if you've done the [[stock-application-mods |Create a new card for each conversation]] mod).
  
 
Pyrognome tested this and works as stated.
 
Pyrognome tested this and works as stated.
Line 68: Line 68:
 
== Acknowledgments==
 
== Acknowledgments==
  
Thanks to Sargun for the [[[tracking | tracking script]]] which inspired the layout of the code, as well as started me looking at the databases.
+
Thanks to Sargun for the [[tracking | tracking script]] which inspired the layout of the code, as well as started me looking at the databases.

Revision as of 00:45, 22 July 2009

I use my phone as a pager when I'm on-call at work. The Pre's notification tone is //way// too short and quiet to wake me up. Here's a script that will nag you by playing a .wav file every minute while you have unread messages.

Prerequisites

  • Root access
  • Cron enabled

Script code

#!/bin/sh

SOUND=/media/internal/ringtones/pager.wav

check() {
        cmd='SELECT summary FROM com_palm_messaging_data_ChatThread WHERE unreadCount > 0 AND type = "SMS" AND summary != "";'
        output=$(echo $cmd|sqlite3 /var/luna/data/dbdata/PalmDatabase.db3 2> /dev/null) || return 0
        if [ -n "$output" ] ; then
                return 1
        fi
}

play() {
        x=0
        until [ "$x" = 4 ] ; do
                aplay -q "$SOUND"
                sleep 60
                check
                if [ "$?" = 1 ] ; then
                        x=$((x + 1))
                else
                        x=4
                fi
        done
}


if [ ! -f "$SOUND" ] ; then
        SOUND=/usr/palm/sounds/alert.wav
fi

check || play

Installation

  1. Copy a .wav file to /media/internal/ringtones/pager.wav (or to the ringtones directory in USB mode).
mkdir -p /opt/scripts
  1. Copy the script to /opt/scripts/pager.
chmod +x /opt/scripts/pager
rootfs_open -w
  1. Add the following line to /etc/cron/crontabs/root:
*/5 * * * * /opt/scripts/pager

Remember to copy a .wav file to /media/internal/ringtones/pager.wav.

To Do/Bugs

As the message is marked read in the database when it is closed, the sound will continue to play every minute until the messaging app is closed (or until that chat card is closed if you've done the Create a new card for each conversation mod).

Pyrognome tested this and works as stated.

Acknowledgments

Thanks to Sargun for the tracking script which inspired the layout of the code, as well as started me looking at the databases.