Embedding Artwork in MP3 Files 
While MP3 files were not originally intended to store additional metadata within them, the release of the ID3 tag protocol in 1996 suddenly made this a possibility. However, it wasn’t until version 2 of the protocol became available that MP3 files could actually contain embedded album art.

To embed an album cover to a MP3, you will need following tools from MacPorts:
  • eyeD3 (sudo port install py26-eyed3)
  • id3v2 (sudo port install id3v2)
Following script should simplify your life:

#!/bin/bash

# ${0##*/}: Removes everything up to the first forward slash in
# the command name.
usage() {
echo "Usage: ${0##*/} <img> <mp3>" >&2
}
if [ $# -ne 2 ]
then
usage
exit 1
fi
IMG=$1
MP3=$2
COVER=cover.png
convert -quality 90 -geometry 300x300 "$IMG" $COVER
if [ -e $COVER ]
then
# eyeD3 --list-image-types for available image types for --add-image
eyeD3 --add-image=$COVER:FRONT_COVER "$MP3" >/dev/null 2>&1
rm -f $COVER
else
echo "Converting '$IMG' to '$COVER' failed."
exit 1
fi
# Check whether the APIC frame has been set (cover image has been added).
HAS_APIC=`id3v2 -l $MP3 | grep APIC`
if [ -n "$HAS_APIC" ]
then
echo "Cover image has been successfully added to '$MP3'."
else
echo "Adding cover image to '$MP3' failed."
fi


[ 3 comments ] ( 10 views )   |  permalink  |  related link  |   ( 2.8 / 77 )
How to add chapters to your podcast 


Recently I started to podcast some of my mixes (see DJ Ribose Podcast if you are interested). A podcast is actually just an audio file. But, like for a CD, I wanted to display the tracklist while the podcast is playing. I have already seen this and asked myself how they achieve that. The answer is Chapters. Here you can find a tutorial for adding chapters to your podcast. Unfortunately this only seems doable with GarageBand.

[ add comment ]   |  permalink  |   ( 3.1 / 76 )
Recursively copying a directory with hard links 
The GNU version of cp (called gcp) has an interesting option: -l.

Instead of copying files it will link them using hard links.

This is very handy if you want to recursively copy a given directories structure without duplicating all the files. gcp can be installed via MacPorts:

sudo port install coreutils.

[ add comment ]   |  permalink  |   ( 3 / 80 )
java.util.ServiceLoader 
There are a lot of dependency injection frameworks out there. What you may not know is that there is a very simple yet useful one built into the JDK. And it's type-safe.

JDK 6 introduces ServiceLoader. ServiceLoader loads things based on flat files in the directory META-INF/services from the Java classpath.

Without going down the OSGi rabbit hole this is a simple solution which probably provides 90% of what people currently want. The API has been around since JDK 1.3 but mostly by internal components, JDK 6 promotes the API and makes it extremely easy to use with a minimal set of requirements.

[ add comment ]   |  permalink  |  related link  |   ( 3 / 97 )
Fully accessing NTFS Windows partition from Mac OS X 
I recently bought an external hard drive. I wanted it being accessible from Windows and Mac OS X. The out-of-the-box possibility would have been to format my external disk as FAT32. I felt quite reluctant to do so and looked for a possibility to access it using NTFS.

Fortunately Amit Singh, a Google employee, releases a implementation called MacFUSE which makes possible to use any FUSE (File-system in USErspace) file systems in Mac. And the most useful FUSE is the NTFS-3G Read/Write Driver, which ables system to load NTFS with read and write capability.

Works like a charm.

[ add comment ]   |  permalink  |   ( 3.1 / 103 )

Back Next