ReArchitecting . . .

July 18, 2006

YubNub – Command Line for the Web

Filed under: hack, tools — rearchitect @ 11:46 am

Being a big fan of the command line, I find very useful YubNub service, which is a social command line for the web. Search plugins can be easily installed in your favorite browser.

When you are lazy typing commands, you can use Firefox extension called FastYub! from SystemPuntoOut.

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.