Active Topics

 


Reply
Thread Tools
dr_frost_dk's Avatar
Posts: 1,503 | Thanked: 2,688 times | Joined on Oct 2010 @ Denmark
#1
I was wondering if anybody knew of a program or simple script that can intercept SMS and play a random audio file from a folder.

I have a lot of funny audio clips and wanted to have them play at random when i get an SMS.

Now i have already made a few scripts in the past but my memory sometime works like RAM and gets "reset" and im drawing blanks on how to even do DBUS right now, even thou i made something like this for the simple brightness in the past.
 

The Following User Says Thank You to dr_frost_dk For This Useful Post:
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#2
Originally Posted by dr_frost_dk View Post
I was wondering if anybody knew of a program or simple script that can intercept SMS and play a random audio file from a folder.

I have a lot of funny audio clips and wanted to have them play at random when i get an SMS.

Now i have already made a few scripts in the past but my memory sometime works like RAM and gets "reset" and im drawing blanks on how to even do DBUS right now, even thou i made something like this for the simple brightness in the past.
Excuse the terse rsponse, I am on n900 over 'borrowed' wifi.

To put it simply you would need to use a script triggered by dbus. You need to use either dbus-scripts, dbuscron or a custom script with some kind of loop and dbus-monitor. When your script intercepts the 'sms received' dbus message it needs to use awk, sed, grep, etc to alter the config file for a given profile. So, populate list of folder of random sounds then replace reference to sound in profile config.
__________________
N900: One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.
 

The Following User Says Thank You to vi_ For This Useful Post:
dr_frost_dk's Avatar
Posts: 1,503 | Thanked: 2,688 times | Joined on Oct 2010 @ Denmark
#3
yes that sounds like what i was thinking, my thinking where in the line of turning off sms tone an having the script take over like custom brightness (version 1 )
 
pichlo's Avatar
Posts: 6,445 | Thanked: 20,981 times | Joined on Sep 2012 @ UK
#4
This is not quite what you want but might be simpler to implement. Instead of choosing the file when the SMS arrives, choose it for the next SMS that will arrive. A casual user won't notice any difference.

Now how do you do that? You can employ some dbus magic but the simplest approach is, run a cron job that will periodically link the SMS notification file to the next file in your folder. If you receive SMS randomly (as most people do), the effect will be a random file played on the next SMS.
 

The Following User Says Thank You to pichlo For This Useful Post:
dr_frost_dk's Avatar
Posts: 1,503 | Thanked: 2,688 times | Joined on Oct 2010 @ Denmark
#5
Thanks, i actually like the idea of "next sms" it seems as "less" work for the N900 as it does not have to do it in "real time".

Now i just have to read up on all the DBUS again...., damm this memory
 

The Following User Says Thank You to dr_frost_dk For This Useful Post:
low's Avatar
Posts: 36 | Thanked: 57 times | Joined on Jun 2012
#6
dbus-monitor and a test sms is usually what I use to "remember" what to look for when the dbus fires
 

The Following User Says Thank You to low For This Useful Post:
dr_frost_dk's Avatar
Posts: 1,503 | Thanked: 2,688 times | Joined on Oct 2010 @ Denmark
#7
yes i know, just haven’t had the time yet...
but when i do ill post in post #1 the "results"
 
dr_frost_dk's Avatar
Posts: 1,503 | Thanked: 2,688 times | Joined on Oct 2010 @ Denmark
#8
well i been busy or something, but now after almost a year i think i will complete this....

and so far i have this working
FOR TESTING!!
Code:
#! /bin/sh
dbus-monitor --system interface='Phone.SMS',member='incoming' | while grep -q array
do
echo "SMS recieved"
sleep 2
echo "sleep done"
echo " "
done
this works, now i just need some help with what command/edit conf that controls sms sound....
 
dr_frost_dk's Avatar
Posts: 1,503 | Thanked: 2,688 times | Joined on Oct 2010 @ Denmark
#9
/home/user/.profiled/custom.ini , will post when i get it working with random (or next audio file)

EDIT: nope not that ini file....

Last edited by dr_frost_dk; 2014-04-04 at 21:02.
 
dr_frost_dk's Avatar
Posts: 1,503 | Thanked: 2,688 times | Joined on Oct 2010 @ Denmark
#10
Well... trying to edit a conf to change next does not work....

but adapting my random script for my old diy alarm that would play random sounds from a folder until a random code had been entered to stop it.

Code:
#! /bin/sh
dbus-monitor --system interface='Phone.SMS',member='incoming' | while grep -q array
do
echo "SMS recieved"
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:80
songdir="/home/user/MyDocs/.sounds/SMS-Random/"
sleep 3

a=$(ls "$songdir" -1 | awk 'BEGIN{srand()} {x[NR] = $0} END{print "", x[1 + int(rand() * NR)]}' | sed 's/^ *//')
mplayer -ao pulse "$songdir""$a"

sleep 1
echo "sleep done"
echo " "
done
So now i set the SMS to beep and volume 0, thinking about making a VERY fast click so i has a click before random sound, as script writes, it echoes "SMS recieved" and waits 3 secons (to clear audio from beep) turns audio up to 80%, and plays random file from folder that is specified (songdir)
 
Reply


 
Forum Jump


All times are GMT. The time now is 16:46.