populate destinations table

This commit is contained in:
Vincent Riquer 2013-02-26 02:55:19 +01:00
parent c6e84b1056
commit efe661615c

20
atom
View File

@ -17,6 +17,7 @@ declare -A \
destinationcopymime \ destinationcopymime \
destinationformat \ destinationformat \
destinationfrequency \ destinationfrequency \
destinationid \
destinationpath \ destinationpath \
destinationquality \ destinationquality \
destinationrename \ destinationrename \
@ -458,6 +459,23 @@ InsertOrUpdate() {
echo "$results" echo "$results"
} }
createDestinations() {
for destination in ${!destinationpath[@]}
do
if ! [ -d "${destinationpath["$destination"]}" ]
then
if ! mkdir -p "${destinationpath["$destination"]}"
then
echo "$destination: Could not create ${destinationpath["$destination"]}!"
exit $EINVDEST
fi
fi
destinationid["$destination"]=$(
InsertIfUnset destinations <<<"name $destination"
)
done
}
getFiles() { getFiles() {
scantime=$(date +%s) scantime=$(date +%s)
# We probably have thousands of files, don't waste time on disk writes # We probably have thousands of files, don't waste time on disk writes
@ -609,6 +627,8 @@ done
openDatabase openDatabase
createDestinations
getFiles getFiles
closeDatabase closeDatabase