Converting Windows Media Audio files into MP3 format is rather easy with mplayer and lame. My car stereo plays MP3s, so WMA is of no use to me!
This code is based on this script but I have to wonder why they overwrote the wma file?
Piping the output of mplayer into lame is left as an easy lesson for the reader!
for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm -waveheader "$i" && lame -m j -h --vbr-new -b 160 audiodump.wav -o "`basename "$i" .wma`.mp3"; done; rm -f audiodump.wav
Tag Archives: Linux
streamtuner – Internet radio tuner
I came across streamtuner a few days ago and installed it from Debian apt when it sparked my interest.
It talks to radio directories like SHOUTcast and Live365 and lists them in a nice gui. Click on any station and up pops xmms!
I never got into the whole streaming radio thing before, but there’s every sort of station out there! I’m amazed!
How to become l33t
How to become l33t – made me chuckle and laugh. Very entertaining read, especially when I remember all the l33t people I’ve come across over the last few years!
Linux: Auto-mounting USB camera memory
I have 2 cameras. One takes Flash cards, the other takes SD cards. If my Sony still worked, I’d also add memory sticks to that list.
I’ve got a routine, a workflow, for copying photos off camera media but it’s slightly more complicated with multiple memory types!
Kevin Lyda kindly mailed me a script he had for auto-mounting his camera and copying the files off. It uses the usb hotplug program to do that but I couldn’t get it to work with my card reader so I wrote the following script. Bits of it are from Kevin’s scipt, so thanks!
I insert my camera media, and run “copyfromcamera.sh” and it find the Flash card and copies all files off it into a directory with today’s date!
Make sure you have your media mount points setup in /etc/fstab. Here’s what mine looks like:
----------/etc/fstab----------
/dev/sdb1 /mnt/cfcard vfat users,noauto,rw,uid=1000 0 0
/dev/sdd1 /mnt/sdcard vfat users,noauto,rw,uid=1000 0 0
----------/etc/fstab----------
Copy and paste this into a file and save it to /usr/local/bin/copyfromcamera.sh and make it executable (chmod 755 /usr/local/bin/copyfromcamera.sh)
----------/usr/local/bin/copyfromcamera.sh----------
#!/bin/shexport YEAR=`date +%Y`
export TODAY=`date +%Y-%m-%d`
export DIR=/home/donncha/Photos/$YEAR/$TODAY/
mount /mnt/cfcard/ 2> /dev/null
if [ -d /mnt/cfcard/dcim/ ]; then
mkdir -p $DIR
find /mnt/cfcard/dcim -type f -print0 | xargs -0i mv -vi '{}' $DIR
umount /mnt/cfcard/
df -h
fi
mount /mnt/sdcard/ 2> /dev/null
if [ -d /mnt/sdcard/dcim/ ]; then
mkdir -p $DIR
find /mnt/sdcard/dcim -type f -print0 | xargs -0i mv -vi '{}' $DIR
umount /mnt/sdcard/
df -h
fi
----------/usr/local/bin/copyfromcamera.sh----------
Spreadsheet Templates
Every now and again I need to dig into Open Office to create a document, be it a report, or a spreadsheet.
Thankfully Linux has been able to read Word and Excel files for some time as that’s what the world and it’s dog use!
Anyway, I needed an invoice template, and came across these Open Office extras listing lots of templates for Writer, Calc and Draw. Several very useful examples there too!
Here’s a few sample reports in PDF format. Obviously it’s harder to edit, but at least they’ll provide for inspiration when creating your own documents!
Firestarter – Linux firewall
I tried Firestarter a few minutes ago and I’m very impressed! It’s a firewall application that makes it easy to modify policies, keep track of who’s knocking and gives a nice summary.
Much easier than learning the ins and outs of IP Tables!
Simple MySQL Backup
If, like me, you have a database full of small tables, but all amounting to a large amount of data then dumping the data from it into a single file is handy, but not very useful when it comes to retrieving a backup of one single table.
Instead, wouldn’t it be easier to dump each individual table into it’s own file? What about keeping a week’s worth of backups? Here’s one way I backup my WordPress db with a little Bash script:
export d=`date +%u`
mkdir -p backup/$d
for i in `echo "show tables" | mysql -u username -ppassword database|grep -v Tables_in_`;
do
echo $i; mysqldump --add-drop-table --allow-keywords -q -a -c -u username -ppassword database $i > backup/$d/$i.sql
rm -f backup/$d/$i.sql.gz
gzip backup/$d/$i.sql
done
Struggling to Manage Your Ever-Growing Digital Photo Collection?
In this (what looks like a promo) article John Grand explains some of the issues with organizing your photos.
After reading this I went looking, and found Lodju (also available from Debian – apt-get lodju), and then looked into gThumb. It allows you to put photos into categories, and I spent an hour last night sorting some of my snaps! I backup to DVD almost once a month so hopefully my photos are reasonably safe! Now, if only gThumb would remember when I rotate my images! I don’t want to modify the originals, but having a rotated thumbnail would be great. Lodju does it!
Nikon on Linux
Nikon on Linux – useful guide to getting your Nikon D70 working with a Linux system, and the steps required to get them into a state the GIMP can edit.
He has some useful scripts I might modify for use by my Canon 20D and Panasonic FZ5! Not sure about the auto-rotating. I like to keep my images as clean as possible off the camera.
Debian package management Overview
In this email to the ILUG, Justin Mason posted a very good overview of Debian package management. It covers all the usual suspects such as apt-get, apt-cache and dpkg, but also a few others I didn’t know about.
A little light reading later perhaps?
(While you’re waiting, you might like to poke a penguin!)
