Regen files on key parameters' change

This commit is contained in:
Vincent Riquer 2013-06-27 21:08:30 +02:00
parent 2fbeba3295
commit 13734a0f1d
3 changed files with 73 additions and 1 deletions

2
atom
View File

@ -343,7 +343,7 @@ do
then then
echo "Resetting destination files timestamps on" \ echo "Resetting destination files timestamps on" \
"$forcedest ($forcedestid)..." "$forcedest ($forcedestid)..."
Update destination_files last_change 1 \ Update destination_files last_change 0 \
<<<"destination_id = $forcedestid" <<<"destination_id = $forcedestid"
else else
echo "Destination $forcedest does not exist!" >&2 echo "Destination $forcedest does not exist!" >&2

View File

@ -65,6 +65,11 @@ setupDestination() {
fi fi
} }
comeagain comeagain
if [ -n "${destinationquality["$destination"]}" ] \
&& (( value != ${destinationquality["$destination"]} ))
then
setupRegen quality
fi
destinationquality["$destination"]=$value destinationquality["$destination"]=$value
;; ;;
opus) opus)
@ -90,6 +95,11 @@ setupDestination() {
fi fi
} }
comeagain comeagain
if [ -n "${destinationquality["$destination"]}" ] \
&& (( value != ${destinationquality["$destination"]} ))
then
setupRegen bitrate
fi
destinationquality["$destination"]=$value destinationquality["$destination"]=$value
cat <<-EODesc cat <<-EODesc
@ -112,6 +122,11 @@ setupDestination() {
fi fi
} }
comeagain comeagain
if [ -n "${destinationloss["$destination"]}" ] \
&& (( value != ${destinationloss["$destination"]} ))
then
setupRegen loss
fi
destinationloss["$destination"]=$value destinationloss["$destination"]=$value
;; ;;
mp3) mp3)
@ -135,6 +150,11 @@ setupDestination() {
fi fi
} }
comeagain comeagain
if [ -n "${destinationquality["$destination"]}" ] \
&& (( value != ${destinationquality["$destination"]} ))
then
setupRegen bitrate
fi
destinationquality["$destination"]=$value destinationquality["$destination"]=$value
cat <<-EODesc cat <<-EODesc
@ -156,9 +176,13 @@ setupDestination() {
value value
case $value in case $value in
[yY]) [yY])
[[ $initialvalue == n ]]\
&& setupRegen noresample
destinationnoresample["$destination"]=1 destinationnoresample["$destination"]=1
;; ;;
''|[nN]) ''|[nN])
[[ $initialvalue == y ]]\
&& setupRegen noresample
destinationnoresample["$destination"]=0 destinationnoresample["$destination"]=0
;; ;;
*) *)
@ -193,9 +217,13 @@ setupDestination() {
value value
case $value in case $value in
[yY]) [yY])
[[ $initialvalue == n ]] \
&& setupRegen normalize
destinationnormalize["$destination"]=1 destinationnormalize["$destination"]=1
;; ;;
''|[nN]) ''|[nN])
[[ $initialvalue == y ]] \
&& setupRegen normalize
destinationnormalize["$destination"]=0 destinationnormalize["$destination"]=0
;; ;;
*) *)
@ -355,6 +383,11 @@ setupDestination() {
fi fi
} }
comeagain comeagain
if [ -n "${destinationchannels["$destination"]}" ] \
&& (( value != ${destinationchannels["$destination"]} ))
then
setupRegen channels
fi
destinationchannels["$destination"]=$value destinationchannels["$destination"]=$value
cat <<-EODesc cat <<-EODesc
@ -387,6 +420,11 @@ setupDestination() {
unset expr unset expr
} }
comeagain comeagain
if [ -n "${destinationfrequency["$destination"]}" ] \
&& (( value != ${destinationfrequency["$destination"]} ))
then
setupRegen frequency
fi
destinationfrequency["$destination"]=$value destinationfrequency["$destination"]=$value
cat <<-EODesc cat <<-EODesc
@ -413,5 +451,11 @@ setupDestination() {
fi fi
} }
comeagain comeagain
if [ -n "${destinationmaxbps["$destination"]}" ] \
&& (( value != ${destinationmaxbps["$destination"]} ))
then
setupRegen maxbps
fi
destinationmaxbps[$destination]="$value" destinationmaxbps[$destination]="$value"
unset regen
} }

28
lib/setup/regen Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
setupRegen() {
(( regen )) && return 0
echo "Parameter $1 for destination $destination changed."
read -p'Regenerate all files? [y/n] '
case $REPLY in
y)
regen=1
openDatabase
if forcedestid=$(Select destinations id <<<"name = $destination")
then
echo "Resetting destination files timestamps on" \
"$destination ($forcedestid)..."
Update destination_files last_change 0 \
<<<"destination_id = $forcedestid"
else
echo "Destination $destination does not exist!" >&2
fi
closeDatabase
;;
n)
;;
*)
setupRegen $1
;;
esac
}