The Following User Says Thank You to ade For This Useful Post: | ||
|
2012-09-25
, 21:26
|
Posts: 569 |
Thanked: 462 times |
Joined on Jul 2010
@ USA
|
#522
|
Side question: is it not more simple to just set a repeating alarm in the alarm clock for this
(I don't know if date 'now+30' is always set on a fixed time, but it looks like you do)?
#!/bin/sh # clockradio.sh -- a clock radio script using command line arguments # # argument 1 ($1): internet radio station url # argument 2 ($2): pause (unmute delay, for skipping an initial commercial) # argument 3 ($3): volume for speakers # can use the N900 Media Player, but checks first for KMPlayer for most reliable connectivity PLAYER=NoPlayer # Check to see if there is at least 1 command line argument, for the internet radio station URL if [ ! $# == 3 ]; then echo "3 command line arguments needed." echo "Usage: clockradio.sh URL pause(in seconds) volume(1-100)" exit fi if [ $2 -lt 0 ]; then echo "Pause must be 0 or greater; $2 entered" echo "Usage: clockradio.sh URL pause(in seconds) volume(1-100)" exit fi if [ $3 -lt 0 -o $3 -gt 100 ]; then echo "Volume level must be between 0 & 100; $2 entered" echo "Usage: clockradio.sh URL pause(in seconds) volume(1-100)" exit fi # Check to see if KMPlayer is installed if [ -e "/opt/kmplayer/bin/kmplayer" ] ; then PLAYER="/opt/kmplayer/bin/kmplayer" else echo "KMPlayer not found, using N900 Media Player" PLAYER="N900 Media Player" fi echo "Connecting $PLAYER to $1, remaining muted for $2 seconds, then increasing volume to $3 %." echo "A standard alarm will be set for 30 minutes from now in case of internet radio station absence." #use alarmed CLI to set a safety alarm in 30 minutes /opt/alarmed/alarmed.py -C --title='Clockradio Safety Alarm' -A --date='now +30 minutes' # set volume level to 0% dbus-send --type=method_call --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.extension.set_extension_property string:volume variant:uint32:0 if [ $PLAYER == "/opt/kmplayer/bin/kmplayer" ] ; then #assemble the command line to play the URL with KMPlayer PLAYER=$PLAYER" "$1 # background process connect KMPlayer to station url ($PLAYER)& else # call the N900 media player dbus-send --print-reply --dest=com.nokia.mediaplayer /com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:$1 > /dev/null fi #sleep specified seconds before unmuting to miss the at-connect commercial if there is one sleep $2 # over 60 seconds, increase the volume to level specified (0 - 100%) SLEEPLEN=$((60/$3)) for i in $(seq 0 $3); do sleep $SLEEPLEN dbus-send --type=method_call --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.extension.set_extension_property string:volume variant:uint32:$i done
The Following 2 Users Say Thank You to rotoflex For This Useful Post: | ||
|
2012-09-25
, 21:50
|
Posts: 1,100 |
Thanked: 2,797 times |
Joined on Apr 2011
@ Netherlands
|
#523
|
/opt/alarmed/alarmed.py -C --title='Clockradio Safety Alarm' -A --date='now +30 minutes'|awk '{print $NF}' >> /tmp/clockalarms_ids.txt
#!/bin/sh for ID in $(cat /tmp/clockalarms_ids.txt) do /opt/alarmed/alarmed.py -C -D $ID done rm -f /tmp/clockalarms_ids.txt
The Following 4 Users Say Thank You to ade For This Useful Post: | ||
|
2012-09-26
, 06:28
|
Posts: 804 |
Thanked: 1,598 times |
Joined on Feb 2010
@ Gdynia, Poland
|
#524
|
Just something I created in a few minutes:
Replace the alarm creation line with:This will collect all your ID'sCode:/opt/alarmed/alarmed.py -C --title='Clockradio Safety Alarm' -A --date='now +30 minutes'|awk '{print $NF}' >> /tmp/clockalarms_ids.txt
Now when this alarms can all be removed start this script:
Now your specific alarms are removed and the id-list is gone.Code:#!/bin/sh for ID in $(cat /tmp/clockalarms_ids.txt) do /opt/alarmed/alarmed.py -C -D $ID done rm -f /tmp/clockalarms_ids.txt
|
2012-09-26
, 16:58
|
Posts: 569 |
Thanked: 462 times |
Joined on Jul 2010
@ USA
|
#525
|
#!/bin/sh # clockradio.sh -- a clock radio script using command line arguments # # argument 1 ($1): internet radio station url # argument 2 ($2): pause (unmute delay, for skipping an initial commercial) # argument 3 ($3): volume for speakers # can use the N900 Media Player, but checks first for KMPlayer for most reliable connectivity PLAYER=NoPlayer # Check to see if there is at least 1 command line argument, for the internet radio station URL if [ ! $# == 3 ]; then echo "3 command line arguments needed." echo "Usage: clockradio.sh URL pause(in seconds) volume(1-100)" exit fi if [ $2 -lt 0 ]; then echo "Pause must be 0 or greater; $2 entered" echo "Usage: clockradio.sh URL pause(in seconds) volume(1-100)" exit fi if [ $3 -lt 0 -o $3 -gt 100 ]; then echo "Volume level must be between 0 & 100; $2 entered" echo "Usage: clockradio.sh URL pause(in seconds) volume(1-100)" exit fi # Check to see if KMPlayer is installed if [ -e "/opt/kmplayer/bin/kmplayer" ] ; then PLAYER="/opt/kmplayer/bin/kmplayer" else echo "KMPlayer not found, using N900 Media Player" PLAYER="N900 Media Player" fi echo "Connecting $PLAYER to $1, remaining muted for $2 seconds, then increasing volume to $3 %." echo "A standard alarm will be set for 30 minutes from now in case of internet radio station absence." #revised safety alarm creation for old alarm deletion, keeps a list of ID's of the safety alarms #remove old safety alarm entries for ID in $(cat /home/user/clockalarms_ids.txt) do /opt/alarmed/alarmed.py -C -D $ID done rm -f /home/user/clockalarms_ids.txt #use alarmed CLI to set a safety alarm in 30 minutes /opt/alarmed/alarmed.py -C --title='Clockradio Safety Alarm' -A --date='now +30 minutes'|awk '{print $NF}' >> /home/user/clockalarms_ids.txt # set volume level to 0% dbus-send --type=method_call --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.extension.set_extension_property string:volume variant:uint32:0 #call the player & connect it to the URL specified if [ $PLAYER == "/opt/kmplayer/bin/kmplayer" ] ; then #assemble the command line to play the URL with KMPlayer PLAYER=$PLAYER" "$1 # background process connect KMPlayer to station url ($PLAYER)& else # call the N900 media player dbus-send --print-reply --dest=com.nokia.mediaplayer /com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:$1 > /dev/null fi #sleep specified seconds before unmuting to miss the at-connect commercial if there is one sleep $2 # over 60 seconds, increase the volume to level specified (0 - 100%) SLEEPLEN=$((60/$3)) for i in $(seq 0 $3); do sleep $SLEEPLEN dbus-send --type=method_call --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.extension.set_extension_property string:volume variant:uint32:$i done
The Following 2 Users Say Thank You to rotoflex For This Useful Post: | ||
|
2012-09-26
, 17:48
|
Posts: 1,100 |
Thanked: 2,797 times |
Joined on Apr 2011
@ Netherlands
|
#526
|
MINUTES=40 /opt/alarmed/alarmed.py -C --title="Clockradio Safety Alarm" -A --date="now +${MINUTES} minutes"
|
2012-09-27
, 01:30
|
Posts: 569 |
Thanked: 462 times |
Joined on Jul 2010
@ USA
|
#527
|
#!/bin/sh # clockradio.sh -- a clock radio script using command line arguments # # argument 1 ($1): internet radio station url # argument 2 ($2): pause, seconds (unmute delay, for skipping an initial commercial) # argument 3 ($3): volume for speakers, 0 to 100 # argument 4 ($4): minutes to delay N900 safety alarm MINARGS=1 MAXARGS=4 # can use the N900 Media Player, but checks first for KMPlayer for most reliable connectivity # default player assignment, for error message maybe PLAYER=NoPlayer # default unmute delay assignment UNMUTEDELAY=0 # default speaker volume SPEAKERVOL=50 # default minutes to assign to safety alarm SAFETYDELAY=15 # Check to see if there are 1 or 4 command line arguments. # At least one is needed, to specify the internet radio station URL. # Otherwise, all 4 arguments must be specified if [ $# -ne $MINARGS ] && [ $# -ne $MAXARGS ]; then echo "Command line arguments incorrect." echo "Usage: clockradio.sh StationURL" echo "or" echo "Usage: clockradio.sh StationURL Pause(in seconds) Volume(1-100) 2ndAlarmDelay(in minutes)" exit fi # substitue the variables if the command line arguments have been initialized if [ $# == 4 ]; then # set the unmute delay if [ $2 -lt 0 ]; then echo "Pause before increasing volume must be 0 or greater; $2 entered" echo "Usage: clockradio.sh URL pause(in seconds) volume(1-100)" -exit else UNMUTEDELAY=$2 fi # set the volume level if [ $3 -gt 100 ]; then echo "Volume level must be between 0 & 100; $2 entered" echo "Usage: clockradio.sh URL pause(in seconds) volume(1-100)" exit else SPEAKERVOL=$3 fi # set the delay for the safety alarm SAFETYDELAY=$4 fi # Check to see if KMPlayer is installed if [ -e "/opt/kmplayer/bin/kmplayer" ] ; then PLAYER="/opt/kmplayer/bin/kmplayer" else echo "KMPlayer not found, using N900 Media Player" PLAYER="N900 Media Player" fi echo "Connecting $PLAYER to $1, remaining muted for $UNMUTEDELAY seconds, then increasing volume to $SPEAKERVOL%." # If the safety delay argument is less than 0, no safety alarm will be set if [ $SAFETYDELAY -ge 0 ]; then echo "A standard alarm will be set for $SAFETYDELAY minutes from now in case of internet radio station absence." else echo "No safety alarm following the player start will be set." fi #revised safety alarm creation for old alarm deletion, keeps a list of ID's of the safety alarms #remove old safety alarm entries for ID in $(cat /home/user/clockalarms_ids.txt) do /opt/alarmed/alarmed.py -C -D $ID done rm -f /home/user/clockalarms_ids.txt #use alarmed CLI to set a safety alarm in 30 minutes #if SAFETYDELAY is a negative number, set no safety alarm if [ $SAFETYDELAY -ge 0 ]; then #use alarmed CLI to set a safety alarm in 30 minutes /opt/alarmed/alarmed.py -C --title="Clockradio Safety Alarm" -A --date="now +${SAFETYDELAY} minutes"|awk '{print $NF}' >> /home/user/clockalarms_ids.txt fi # set volume level to 0% dbus-send --type=method_call --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.extension.set_extension_property string:volume variant:uint32:0 #call the player & connect it to the URL specified if [ $PLAYER == "/opt/kmplayer/bin/kmplayer" ] ; then #assemble the command line to play the URL with KMPlayer PLAYER=$PLAYER" "$1 # background process connect KMPlayer to station url ($PLAYER)& else # call the N900 media player dbus-send --print-reply --dest=com.nokia.mediaplayer /com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:$1 > /dev/null fi #sleep specified seconds before unmuting to miss the at-connect commercial if there is one sleep $UNMUTEDELAY # over 60 seconds, increase the volume to level specified (0 - 100%) SLEEPLEN=$((60/$SPEAKERVOL)) for i in $(seq 0 $SPEAKERVOL); do sleep $SLEEPLEN dbus-send --type=method_call --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.extension.set_extension_property string:volume variant:uint32:$i done
clockradio.sh http://109.123.116.202:8010 or clockradio.sh http://109.123.116.202:8010 0 55 30
|
2013-02-09
, 22:57
|
Posts: 1,163 |
Thanked: 1,873 times |
Joined on Feb 2011
@ The Netherlands
|
#528
|
found some profile changing config files at /home/user/.config/alarmed/jobs
seems like the ones which still work.
but the time format is strange, like "I1278532860" or "I1278475140"
how do I convert these units to hh:mm time and back?
or it would be easier to delete these configs and create new profile change schedule with Silencer/timed silencer app?
The Following User Says Thank You to mr_pingu For This Useful Post: | ||
|
2013-02-10
, 10:58
|
Posts: 2,290 |
Thanked: 4,133 times |
Joined on Apr 2010
@ UK
|
#529
|
The Following User Says Thank You to sixwheeledbeast For This Useful Post: | ||
|
2013-02-21
, 22:06
|
Posts: 1,100 |
Thanked: 2,797 times |
Joined on Apr 2011
@ Netherlands
|
#530
|
is there a way to delete profile changer without GUI?
deleted the /home/user/.config/alarmed/jobs catalog (namely, moved it to other location), but profile changer still works.
/opt/alarmed/alarmed.py -C -D <your_job-nr>
The Following 2 Users Say Thank You to ade For This Useful Post: | ||
Alarms in Alarmed can be deleted with "-D 'ID'". Not sure if you can create events specifing an ID. If not, you could search the specific ID's according to characteristics and then delete them (would be a simple scripts that can be scheduled in... alarmed ).