Skip to content

Commit

Permalink
New dropbox interface
Browse files Browse the repository at this point in the history
  • Loading branch information
fsantini committed Aug 8, 2018
1 parent 88ef188 commit 0c79306
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/usr/local/kobocloud/getDropboxFiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ source `dirname $0`/config.sh
# get directory listing
echo "Getting $baseURL"
# get directory listing
$CURL -k -L --silent "$baseURL" | # get listing
grep -o '<a href="[^"]*"[^>]*class="thumb-link [^"]*">' | # find links
sed -e 's/.*href="\([^"]*\)".*/\1/' | # extract links and replace ampersands
$CURL -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36" -k -L --silent "$baseURL" | # get listing. Need to specify a user agent, otherwise it will download the directory
grep -Eo 'previews\.dropboxusercontent\.com.*' |
grep -Eo 'https?://www.dropbox.com/sh/[^\"]*' | # find links
while read linkLine
do
if [ "$linkLine" = "$baseURL" ]
then
continue
fi
#echo $linkLine
# process line
outFileName=`echo $linkLine | sed -e 's|.*/\(.*\)?dl=.*|\1|'`
#echo $outFileName
localFile="$outDir/$outFileName"
`dirname $0`/getRemoteFile.sh "$linkLine" "$localFile"
done
4 changes: 2 additions & 2 deletions src/usr/local/kobocloud/getRemoteFile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ source `dirname $0`/config.sh

echo "$linkLine -> $localFile"

remoteSize=`$CURL -k -L --silent --head "$linkLine" | sed -n 's/^Content-Length\: \([0-9]*\).*/\1/p'`
remoteSize=`$CURL -k -L --silent --head "$linkLine" | sed -n 's/^Content-Length\: \([0-9]*\).*/\1/ip'`
if [ -f $localFile ]; then
localSize=`stat -c%s "$localFile"`
else
Expand All @@ -22,4 +22,4 @@ else
echo "Error resuming: redownload file"
$CURL -k --silent -L -o "$localFile" "$linkLine" # restart download
fi
fi
fi

0 comments on commit 0c79306

Please sign in to comment.