ReArchitecting . . .

March 30, 2006

What is your perfect major? (Quizfarm.com)

Filed under: fun, personal — rearchitect @ 12:58 pm

Tests show that I have to leave computers for dedicating to great themes of life….

  You scored as Philosophy. You should be a Philosophy major! Like the Philosopher, you are contemplative and you enjoy thinking about the purpose for humanity's existence.

Philosophy
 
83%
Sociology
 
75%
English
 
75%
Engineering
 
67%
Biology
 
67%
Mathematics
 
67%
Linguistics
 
58%
Chemistry
 
50%
Journalism
 
50%
Anthropology
 
50%
Psychology
 
50%
Theater
 
42%
Dance
 
25%
Art
 
25%

What is your Perfect Major? (PLEASE RATE ME!!<3)
created with QuizFarm.com

January 19, 2006

Recording streams with mplayer (real audio, asf, …)

Filed under: audio, hack, personal, tools — rearchitect @ 3:08 pm

Problem: I have a Gentoo server always on and I want to record real audio streams daily, encoding them in mp3 to listen later in my ipod.

Solution: mplayer, lame, shell script and cron

1) I wrote a script called record.sh that get an output filename and an url representing the stream to record

#!/bin/sh
# Usage:
#     record.sh <file> <url_to_record>
mplayer -quiet -cache 32 -vc dummy -vo null -ao pcm:file=$1.wav $2 > /dev/null
lame --quiet --preset radio $1.wav $1.mp3
rm $1.wav > /dev/null

2) I wrote a script that grabs my favourite program. Call it for example grab_xyz.sh

#!/bin/sh
RECORD=/home/pc/bin/record.sh
filename=/data/shared/P2PDownload/toListen/$(date +%y%m%d)_xyz
$RECORD $filename rtsp://url/xyz.rm

3) Finally I edited a cron job (cfr: crontab -e)

# Record 'XYZ from Live Stream' (from 13.30 to 14.30)
30 13 * * *     $HOME/bin/grab_xyz.sh
30 14 * * *     /bin/killall mplayer

4) At end I’ll find (in toListen directory)

060118_xyz.mp3
060117_xyz.mp3
060116_xyz.mp3
..................

Ok it’s a small and simple hack but it works and it avoids to buy dedicated shareware.

Blog at WordPress.com.