scripts

shell scripts
git clone git://git.bitsmanent.org/scripts
Log | Files | Refs | README

commit 73137047be53bb361b42ad5cc256e472c1479968
parent 1101c73b5d17324bb19f9bd0573e0e4ab13b74f7
Author: clamiax <smoppy@gmail.com>
Date:   Sun,  5 Jan 2014 23:38:09 +0000

Change the way preload() loops.

Diffstat:
Mscrapthumb | 17++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/scrapthumb b/scrapthumb @@ -23,18 +23,13 @@ SOURCES=( IMGS=() preload() { - i=0 - mod=$(echo $MAXIMGS % ${#SOURCES[*]} |bc) - tot=$(echo $MAXIMGS / ${#SOURCES[*]} |bc) - - for src in ${SOURCES[*]} + s=0 + for i in $(seq 0 $(echo $MAXIMGS - 1|bc)) do - [ $i -eq 0 -a $mod -ne 0 ] && t=$(echo $tot + 1 | bc) || t=$tot - for n in $(seq 1 $t) - do - IMGS[$i]="$($GETTER "$src/random" |grep -o 'property="og:image" content=".*"' |cut -b 29- |tr -d \")" - i=$(echo $i+1|bc) - done + src=${SOURCES[$s]} + s=$(echo $s+1|bc) + [ $s -ge ${#SOURCES[*]} ] && s=0 + IMGS[$i]="$($GETTER "$src/random" |grep -o 'property="og:image" content=".*"' |cut -b 29- |tr -d \")" done }