This commit is contained in:
Vincent Riquer 2013-04-08 11:28:26 +02:00
parent 37df18f45d
commit 3d4a757917
10 changed files with 57 additions and 7 deletions

View File

@ -26,6 +26,8 @@ Sections:
too quickly. Set this too high, and AtOM will not adapt quickly enough to
load increase. In both cases, your hard drive will suffer. In my
experience, 30 seconds is a good value.
* ionice <class> [niceness]: IO-hungry processes will be run with ionice class
<class> and niceness [niceness] (if applicable). See man ionice for details.
* temporary-directory <directory>: String. Name speaks for itself: this is
where FIFOs (for communicating with sqlite) and temporary WAVE files will
be created. Note that debug logs (if enabled) will go there too.

View File

@ -1,4 +1,5 @@
[general]
ionice 3
max-load 6
load-interval 30
temporary-directory %HOME%/.atom/tmp

View File

@ -23,6 +23,49 @@ getConfigGeneral() {
fi
unset expr
;;
'ionice')
read class niceness <<<"$value"
case $class in
1)
# real-time class, only root can do that
if (( UID ))
then
echo "IO class 'realtime' is"\
"not available to unprivileged"\
"users" >&2
exit $EIONICE
fi
if [ -n "$niceness" ] \
&& (( niceness >= 0 && niceness <= 7 ))
then
ionice="ionice -c1 -n$niceness "
else
echo "Invalid IO priority"\
"'$niceness'" >&2
exit $EIONICE
fi
;;
2)
if [ -n "$niceness" ] \
&& (( niceness >= 0 && niceness <= 7 ))
then
ionice="ionice -c2 -n$niceness "
else
echo "Invalid IO priority"\
"'$niceness'" >&2
exit $EIONICE
fi
;;
3)
ionice="ionice -c3 "
;;
*)
echo "Invalid ionice parameters $value"\
>&2
exit $EIONICE
;;
esac
;;
'temporary-directory')
tempdir="$value"
;;

View File

@ -1,8 +1,9 @@
#!/bin/bash
printConfig() {
{
echo "General|Config file|$cffile"
[ -n "$ionice" ] && echo "|IO Nice|$ionice"
cat <<-EOF
General|Config file|$cffile
|Load|$maxload
|Load Interval|$loadinterval
|Temp Dir|$tempdir

View File

@ -1,5 +1,6 @@
#!/bin/bash
decodeMpcdec() {
tmpfile="${fileid}mpcdec"
commandline=(mpcdec "$sourcepath/$filename" "$tempdir/$tmpfile.wav")
commandline=(${ionice}mpcdec)
commandline+=("$sourcepath/$filename" "$tempdir/$tmpfile.wav")
}

View File

@ -1,5 +1,6 @@
#!/bin/bash
decodeOpusdec() {
tmpfile="${fileid}opusdec"
commandline=(opusdec "$sourcepath/$filename" "$tempdir/$tmpfile.wav")
commandline=(${ionice}opusdec)
commandline+=("$sourcepath/$filename" "$tempdir/$tmpfile.wav")
}

View File

@ -1,6 +1,6 @@
#!/bin/bash
decodeSox() {
commandline=(sox --single-threaded --temp "$tempdir")
commandline=(${ionice}sox --single-threaded --temp "$tempdir")
soxoptions_in=''
soxoptions_out=''
if (( ${destinationnormalize["$destination"]} ))

View File

@ -1,6 +1,7 @@
#!/bin/bash
encodeFile::mp3() {
lameopts=(lame --quiet -v --abr ${destinationquality[$destination]})
lameopts=(${ionice}lame --quiet)
lameopts+=(-v --abr ${destinationquality[$destination]})
[ -n "$album" ] && lameopts+=(--tl "$album" )
[ -n "$artist" ] && lameopts+=(--ta "$artist")
[ -n "$genre" ] && lameopts+=(--tg "$genre")

View File

@ -1,6 +1,6 @@
#!/bin/bash
encodeFile::opus() {
opusencopts=(opusenc --music --quiet)
opusencopts=(${ionice}opusenc --music --quiet)
opusencopts+=(--bitrate ${destinationquality[$destination]})
[ -n "${destinationloss["$destination"]}" ] \
&& opusencopts+=(--expect-loss "${destinationloss["$destination"]}")

View File

@ -1,6 +1,6 @@
#!/bin/bash
encodeFile::vorbis() {
oggencopts=(oggenc -Q -q ${destinationquality[$destination]})
oggencopts=(${ionice}oggenc -Q -q ${destinationquality[$destination]})
[ -n "$albumartist" ] && oggencopts+=(-c "ALBUMARTIST=$albumartist")
[ -n "$album" ] && oggencopts+=(-l "$album")
[ -n "$artist" ] && oggencopts+=(-a "$artist")