From 3d88a74aea2bedd27a63d0826d034122d0435a62 Mon Sep 17 00:00:00 2001 From: Chaitanya Ahuja Date: Tue, 8 May 2018 18:02:47 -0400 Subject: [PATCH] debugged reading all lines from downloadLocations.txt for some reason, only the first line was being read by this script, which is rectified in this commit --- downloadTCDTIMIT/getTCD-TIMIT.sh | 64 ++++++++++++++++---------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/downloadTCDTIMIT/getTCD-TIMIT.sh b/downloadTCDTIMIT/getTCD-TIMIT.sh index 4f9e973..5912cbd 100755 --- a/downloadTCDTIMIT/getTCD-TIMIT.sh +++ b/downloadTCDTIMIT/getTCD-TIMIT.sh @@ -25,37 +25,37 @@ echo "########################################################################## mkdir -p lipspeakers mkdir -p volunteers - -IFS=' ' read -ra line <<< `cat $1` - -for i in "${line[@]}"; do - if [[ $i =~ .*https* ]]; then # for the URL, you should be cd'ed into the right place. Now download the file. - echo "URL: $i" - if [[ -f "straightcam.zip" ]] || [[ -d "straightcam" ]]; then - echo "File exists. Skipping..." - else - echo "File does not exist yet. Downloading..." - # This command comes from the firefox plugin 'cliget' that told me the curl command when downloading from. I removed all unnecessary headers for clarity - curl --header "$cookieHeader" "$i" -O -J -L - fi - cd "$topDir" - echo "$i downloaded" - echo "------------------------------------------" - - else # for the directory, create dir structure and cd into it. Next loop iteration, you'll encounter the URL and download the file over there - - i=`echo "$i" | sed 's/\://g'` #remove colon from dirname - echo "Folder name: $i" - - # make the directories and go in there to then be able to download the file - if [[ $i =~ .*Lipspkr* ]]; then # if lipspeaker, go to the lipspeaker top-level folder, otherwise to the volunteer folder - mkdir -p "$topDir/lipspeakers/$i/Clips" - cd "$topDir/lipspeakers/$i/Clips" - else - mkdir -p "$topDir/volunteers/$i/Clips" - cd "$topDir/volunteers/$i/Clips" +filename="$1" +while read -ra line + do + for i in "${line[@]}"; do + if [[ $i =~ .*https* ]]; then # for the URL, you should be cd'ed into the right place. Now download the file. + echo "URL: $i" + if [[ -f "straightcam.zip" ]] || [[ -d "straightcam" ]]; then + echo "File exists. Skipping..." + else + echo "File does not exist yet. Downloading..." + # This command comes from the firefox plugin 'cliget' that told me the curl command when downloading from. I removed all unnecessary headers for clarity + curl --header "$cookieHeader" "$i" -O -J -L + fi + cd "$topDir" + echo "$i downloaded" + echo "------------------------------------------" + + else # for the directory, create dir structure and cd into it. Next loop iteration, you'll encounter the URL and download the file over there + + i=`echo "$i" | sed 's/\://g'` #remove colon from dirname + echo "Folder name: $i" + + # make the directories and go in there to then be able to download the file + if [[ $i =~ .*Lipspkr* ]]; then # if lipspeaker, go to the lipspeaker top-level folder, otherwise to the volunteer folder + mkdir -p "$topDir/lipspeakers/$i/Clips" + cd "$topDir/lipspeakers/$i/Clips" + else + mkdir -p "$topDir/volunteers/$i/Clips" + cd "$topDir/volunteers/$i/Clips" + fi fi - fi -done - + done +done < "$filename" curl --header --header 'DNT: 1' 'https://sigmedia.tcd.ie/TCDTIMIT/filebrowser/download/588' -O -J -L