From efe661615cf434112fe930f933c06194cdb0d566 Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Tue, 26 Feb 2013 02:55:19 +0100 Subject: [PATCH] populate destinations table --- atom | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/atom b/atom index 58475b5..01a8069 100755 --- a/atom +++ b/atom @@ -17,6 +17,7 @@ declare -A \ destinationcopymime \ destinationformat \ destinationfrequency \ + destinationid \ destinationpath \ destinationquality \ destinationrename \ @@ -458,6 +459,23 @@ InsertOrUpdate() { 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() { scantime=$(date +%s) # We probably have thousands of files, don't waste time on disk writes @@ -609,6 +627,8 @@ done openDatabase +createDestinations + getFiles closeDatabase