Nautilus + mp3gain + scripts = :)
Un código vale más que mil palabras
#!/bin/bash
# This is a Nautilus script. It should be installed under
#+ ~/.gnome2/nautilus-scripts. It depends on zenity and mp3gain.
#+ For more information go to http://g-scripts.sourceforge.net/
#+ Copyright 2006 CruX – Sebastian Cruz – crux(at)lugmen.org.ar
#+ This is free software; you can redistribute it and/or modify
#+ it under the terms of the GNU General Public License version 2
#+ as published by the Free Software Foundation.NAME=”mp3gain”
# Temporary file to store the log
TMP=”$HOME/.gnome2/nautilus-scripts/$NAME.tmp”# Quote arguments to prevent problems with files with spaces
FILES=$(echo -e “$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS” | \
awk ‘BEGIN {FS = “\n” } { printf “\”%s\” “, $1 }’ | \
sed -e s#\”\”##)# Find only MP3s
#+ To be really sure it’d have to be checked with file, but I’m too lazy
#+ to do it![]()
MP3S=”`eval find $FILES -iname *.mp3`”# Again, quote the arguments to avoid problems
MP3Sq=$(echo -e “$MP3S” | \
awk ‘BEGIN {FS = “\n” } { printf “\”%s\” “, $1 }’ | \
sed -e s#\”\”##)if [ -z "$MP3S" ]
then
zenity –error \
–text=”You didn’t select any MP3 to process!!! \
Mind your clicking!!!”
exit 0
fi(
echo “# Applying mp3gain… Please wait”# mp3gain options
#+ -r apply Track gain automatically (all files set to equal loud-ness) [6dB]
#+ -T modifies bytes in original file instead of writing to temp file
#+ -c ignore clipping warning when applying gain [No problem noticed yet]
#+ -s r force re-calculation (do not read tag info) [Slower, but ensures
#+ this settings to be applied]# Just do it!
eval mp3gain -r -T -c -s r “$MP3Sq” >> $TMPecho “# Done! Clik OK to see the log.”
echo “100″
) |# Show progress. If I could have the target MP3s arranged in an array it’d
#+ be very easy to have a progress bar with percentage indication instead of
#+ the pulsating one. TODO
zenity –progress \
–title=”$NAME” \
–text=”" \
–width=300 \
–pulsate \
–percentage=0# Paranoid mode on!! AFAIK this has worked flawlessly, but you never know…
zenity –text-info \
–title=”$NAME log” \
–width=600 \
–height=300 \
–filename=”$TMP”rm -f $TMP
exit 0

