Package: abcde
Version: 2.3.99.5-1
Severity: minor
Tags: patch

[I sent this once but my return address was invalid. It looks like it
won't turn up in the bug database, but if it does then close on sight.]

The included patch does the following, which I think is a good idea:

1) Run replaygain under ENCNICE nice level

   replaygain takes quite a while to finish and should be niceable, 
   and I think it is natural to reuse ENCNICE rather than introduce 
   another nice level

2) Ditto for tagging

   Actually, it is only with -M -1 (flac w/cuesheet) that the tagging
   operation takes noticeable time, but that one is about a minute on
   this computer (100% CPU). The same is done for the other tagging 
   operations, but that is just for consistency.
   
3) When USEPIPES, use the READNICE nice level for the encoding also

   I noticed that when using USEPIPES=y, READNICE=0, ENCNICE=20, 
   running another CPU intensive task effectively stops the reading 
   process because it is throttled by the low-priority encoding 
   process (priority inversion). A simple fix is to use READNICE 
   instead of ENCNICE for the encoding process when using pipes.
   
The patch is trivial, but I've only tested my own usage
(flac+pipes).

-j.



-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15.4
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages abcde depends on:
ii  cd-discid       0.9-1                    CDDB DiscID utility
ii  cdparanoia      3a9.8-13                 An audio extraction tool for sampl
ii  flac            1.1.2+cvs20051109.05-0.0 Free Lossless Audio Codec - comman
ii  speex           1.1.12-1                 The Speex Speech Codec
ii  vorbis-tools    1.1.1-3                  several Ogg Vorbis tools
ii  wget            1.10.2-1                 retrieves files from the web

abcde recommends no packages.

-- no debconf information
--- abcde.old   2006-03-26 14:43:17.000000000 +0200
+++ abcde       2006-03-26 22:42:31.000000000 +0200
@@ -462,16 +462,16 @@
                        done
                        case "$OUTPUT" in
                                flac)
-                                       run_command replaygain-flac $METAFLAC 
--add-replay-gain "[EMAIL PROTECTED]"
+                                       run_command replaygain-flac nice 
$ENCNICE $METAFLAC --add-replay-gain "[EMAIL PROTECTED]"
                                        ;;
                                vorbis|ogg)
-                                       run_command replaygain-vorbis 
$VORBISGAIN --album "[EMAIL PROTECTED]"
+                                       run_command replaygain-vorbis nice 
$ENCNICE $VORBISGAIN --album "[EMAIL PROTECTED]"
                                        ;;
                                mp3)
-                                       run_command replaygain-mp3 $MP3GAIN -a 
"[EMAIL PROTECTED]"
+                                       run_command replaygain-mp3 nice 
$ENCNICE $MP3GAIN -a "[EMAIL PROTECTED]"
                                        ;;
                                mpc)
-                                       run_command replaygain-mpc $MPPGAIN 
--auto "[EMAIL PROTECTED]"
+                                       run_command replaygain-mpc nice 
$ENCNICE $MPPGAIN --auto "[EMAIL PROTECTED]"
                                        ;;
                                *);;
                        esac
@@ -722,7 +722,7 @@
                                eyed3)
                                        # FIXME # track numbers in mp3 come 
with 1/10, so we cannot
                                        # happily substitute them with $TRACKNUM
-                                       run_command tagtrack-$OUTPUT-$1 $TAGGER 
$TAGGEROPTS \
+                                       run_command tagtrack-$OUTPUT-$1 nice 
$ENCNICE $TAGGER $TAGGEROPTS \
                                                --comment=::"$COMMENTOUTPUT" -A 
"$DALBUM" \
                                                -a "$TRACKARTIST" -t 
"$TRACKNAME" -Y "$CDYEAR" \
                                                -G "$GENREID" -n 
"${TRACKNUM:-$1}" "${TRACKNUM:+-N $TRACKS}" \
@@ -731,7 +731,7 @@
                                        ;;
                                # FIXME # Still not activated...
                                id3ed)
-                                       run_command tagtrack-$OUTPUT-$1 $TAGGER 
$TAGGEROPTS -c "$COMMENTOUTPUT" \
+                                       run_command tagtrack-$OUTPUT-$1 nice 
$ENCNICE $TAGGER $TAGGEROPTS -c "$COMMENTOUTPUT" \
                                                -a "$DALBUM" -n "$TRACKARTIST" 
-s "$TRACKNAME" -y "$CDYEAR" \
                                                -g "$GENREID" -k 
"${TRACKNUM:-$1}" \
                                                "$ABCDETEMPDIR/track$1.$OUTPUT"
@@ -739,7 +739,7 @@
                                *)
                                        # FIXME # track numbers in mp3 come 
with 1/10, so we cannot
                                        # happily substitute them with $TRACKNUM
-                                       run_command tagtrack-$OUTPUT-$1 $TAGGER 
$TAGGEROPTS -c "$COMMENTOUTPUT" \
+                                       run_command tagtrack-$OUTPUT-$1 nice 
$ENCNICE $TAGGER $TAGGEROPTS -c "$COMMENTOUTPUT" \
                                                -A "$DALBUM" -a "$TRACKARTIST" 
-t "$TRACKNAME" -y "$CDYEAR" \
                                                -g "$GENREID" -T 
"${TRACKNUM:-$1/$TRACKS}" \
                                                "$ABCDETEMPDIR/track$1.$OUTPUT"
@@ -772,7 +772,7 @@
                                                        *)   echo 
COMMENT="$COMMENTOUTPUT";;
                                                esac    
                                        fi
-                                       ) | run_command tagtrack-$OUTPUT-$1 
$VORBISCOMMENT $VORBISCOMMENTOPTS -w \
+                                       ) | run_command tagtrack-$OUTPUT-$1 
nice $ENCNICE $VORBISCOMMENT $VORBISCOMMENTOPTS -w \
                                                
"$ABCDETEMPDIR/track$1.uncommented.$OGGOUTPUTCONTAINER" 
"$ABCDETEMPDIR/track$1.$OGGOUTPUTCONTAINER"
                                        # Doublecheck that the commented file 
was created successfully before wiping the original
                                        if [ -f 
"$ABCDETEMPDIR/track$1.$OGGOUTPUTCONTAINER" ]; then
@@ -802,7 +802,7 @@
                                        *)   echo COMMENT="$COMMENTOUTPUT";;
                                esac    
                        fi
-                       ) | run_command tagtrack-$OUTPUT-$1 $METAFLAC 
$METAFLACOPTS 
${IMPORTCUESHEET:+--import-cuesheet-from="$ABCDETEMPDIR/$CUEFILE"} 
--import-tags-from=- "$ABCDETEMPDIR/track$1.$FLACOUTPUTCONTAINER"
+                       ) | run_command tagtrack-$OUTPUT-$1 nice $ENCNICE 
$METAFLAC $METAFLACOPTS 
${IMPORTCUESHEET:+--import-cuesheet-from="$ABCDETEMPDIR/$CUEFILE"} 
--import-tags-from=- "$ABCDETEMPDIR/track$1.$FLACOUTPUTCONTAINER"
                        ;;
                spx)
                        run_command tagtrack-$OUTPUT-$1 true
@@ -943,20 +943,23 @@
                                RUN_COMMAND=""
                                # We need a way to store the creation of the 
files when using PIPES
                                RUN_COMMAND_PIPES="run_command 
encodetrack-$OUTPUT-$1 true"
+                               # Since read blocks on encode with pipes, set 
the effective nice value to READNICE
+                               EFF_ENCNICE=$READNICE
                        else
                                run_command '' echo "Encoding track $1 of 
$TRACKS: $TRACKNAME..."
                                RUN_COMMAND="run_command encodetrack-$OUTPUT-$1"
+                               EFF_ENCNICE=$ENCNICE
                        fi
                        case "$OUTPUT" in
                        mp3)
                                case "$2" in
                                %local*%)
                                        case "$MP3ENCODERSYNTAX" in
-                                       lame|gogo) $RUN_COMMAND nice $ENCNICE 
$MP3ENCODER $MP3ENCODEROPTS "$IN" "$OUT" ;;
-                                       bladeenc) $RUN_COMMAND nice $ENCNICE 
$MP3ENCODER $MP3ENCODEROPTS -quit "$IN" ;;
-                                       l3enc|xingmp3enc) $RUN_COMMAND nice 
$ENCNICE $MP3ENCODER "$IN" "$OUT" $MP3ENCODEROPTS ;;
+                                       lame|gogo) $RUN_COMMAND nice 
$EFF_ENCNICE $MP3ENCODER $MP3ENCODEROPTS "$IN" "$OUT" ;;
+                                       bladeenc) $RUN_COMMAND nice 
$EFF_ENCNICE $MP3ENCODER $MP3ENCODEROPTS -quit "$IN" ;;
+                                       l3enc|xingmp3enc) $RUN_COMMAND nice 
$EFF_ENCNICE $MP3ENCODER "$IN" "$OUT" $MP3ENCODEROPTS ;;
                                        # FIXME # Relates to the previous FIXME 
since it might need the "-if" removed.
-                                       mp3enc) $RUN_COMMAND nice $ENCNICE 
$MP3ENCODER -if "$IN" -of "$OUT" $MP3ENCODEROPTS ;;
+                                       mp3enc) $RUN_COMMAND nice $EFF_ENCNICE 
$MP3ENCODER -if "$IN" -of "$OUT" $MP3ENCODEROPTS ;;
                                        esac
                                        ;;
                                *)
@@ -968,8 +971,8 @@
                                case "$2" in
                                %local*%)
                                        case "$OGGENCODERSYNTAX" in
-                                       vorbize) $RUN_COMMAND nice $ENCNICE 
$OGGENCODER $OGGENCODEROPTS -w "$OUT" "$IN" ;;
-                                       oggenc) $RUN_COMMAND nice $ENCNICE 
$OGGENCODER $OGGENCODEROPTS -o "$OUT" "$IN" ;;
+                                       vorbize) $RUN_COMMAND nice $EFF_ENCNICE 
$OGGENCODER $OGGENCODEROPTS -w "$OUT" "$IN" ;;
+                                       oggenc) $RUN_COMMAND nice $EFF_ENCNICE 
$OGGENCODER $OGGENCODEROPTS -o "$OUT" "$IN" ;;
                                        esac
                                        ;;
                                *)
@@ -981,7 +984,7 @@
                                case "$2" in
                                %local*%)
                                        case "$FLACENCODERSYNTAX" in
-                                       flac) $RUN_COMMAND nice $ENCNICE 
$FLACENCODER -f $FLACENCODEROPTS -o "$OUT" "$IN" ;; 
+                                       flac) $RUN_COMMAND nice $EFF_ENCNICE 
$FLACENCODER -f $FLACENCODEROPTS -o "$OUT" "$IN" ;; 
                                        esac
                                                ;;
                                        *)
@@ -1001,9 +1004,9 @@
                                fi
                                # Quick hack to avoid tagging Ogg/Speex, since 
there is no other way to tag than inline tagging
                                if [ ! "$DOTAG" = "y" ]; then
-                                       $RUN_COMMAND nice $ENCNICE 
$SPEEXENCODER $SPEEXENCODEROPTS --author "$TRACKARTIST" --title "$TRACKNAME" 
"$COMMENT" "$IN" "$OUT"
+                                       $RUN_COMMAND nice $EFF_ENCNICE 
$SPEEXENCODER $SPEEXENCODEROPTS --author "$TRACKARTIST" --title "$TRACKNAME" 
"$COMMENT" "$IN" "$OUT"
                                else
-                                       $RUN_COMMAND nice $ENCNICE 
$SPEEXENCODER $SPEEXENCODEROPTS "$IN" "$OUT"
+                                       $RUN_COMMAND nice $EFF_ENCNICE 
$SPEEXENCODER $SPEEXENCODEROPTS "$IN" "$OUT"
                                fi
                                ;;
                        mpc)    
@@ -1013,15 +1016,15 @@
                                # errors, so I have not tried it myself.
                                ## FIXME ## Needs some cleanup to determine if 
an empty tag sent
                                ## FIXME ## to the encoder ends up empty.
-                               $RUN_COMMAND nice $ENCNICE $MPPENCODER 
$MPPENCODEROPTS --artist "$TRACKARTIST" --album "$DALBUM" --title "$TRACKNAME" 
--track "$1" --genre "$CDGENRE" --year "$CDYEAR" --comment "$COMMENT" "$IN" 
"$OUT"
+                               $RUN_COMMAND nice $EFF_ENCNICE $MPPENCODER 
$MPPENCODEROPTS --artist "$TRACKARTIST" --album "$DALBUM" --title "$TRACKNAME" 
--track "$1" --genre "$CDGENRE" --year "$CDYEAR" --comment "$COMMENT" "$IN" 
"$OUT"
                                ;;
                        m4a)
                                # Quick hack to avoid tagging Ogg/Speex, since 
there is no other way to tag than inline tagging
                                if [ ! "$DOTAG" = "y" ]; then
-                                       $RUN_COMMAND nice $ENCNICE $AACENCODER 
$AACENCODEROPTS --artist "$TRACKARTIST" --album "$DALBUM" --title "$TRACKNAME" 
--track "$1" --genre "$CDGENRE" --year "$CDYEAR" --comment "$COMMENT" -o "$OUT" 
"$IN"
+                                       $RUN_COMMAND nice $EFF_ENCNICE 
$AACENCODER $AACENCODEROPTS --artist "$TRACKARTIST" --album "$DALBUM" --title 
"$TRACKNAME" --track "$1" --genre "$CDGENRE" --year "$CDYEAR" --comment 
"$COMMENT" -o "$OUT" "$IN"
                                        
                                else
-                                       $RUN_COMMAND nice $ENCNICE $AACENCODER 
$AACENCODEROPTS -o "$OUT" "$IN"
+                                       $RUN_COMMAND nice $EFF_ENCNICE 
$AACENCODER $AACENCODEROPTS -o "$OUT" "$IN"
                                fi
                                ;;
                        wav)

Reply via email to