5 # Copyright (C) 2006-2011 matteo.nastasi@milug.org
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details. You should have received a
16 # copy of the GNU General Public License along with this program; if
17 # not, write to the Free Software Foundation, Inc, 59 Temple Place -
18 # Suite 330, Boston, MA 02111-1307, USA.
22 IMGPATHBASE="../brisk-img/"
28 # echo 'header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1'
29 # echo 'header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past'
33 function imglist_fla () {
40 for i in $(find "$pname" -maxdepth 1 -type f -name '*.jpg' -o -name '*.png' -o -name '*.gif' | grep -v '/src_' | sort); do
41 if [ "$rex" != "" ]; then
42 echo "$i" | grep -q "$rex"
44 if [ "$wrex" = "y" -a $rt -ne 0 ]; then
47 if [ "$wrex" = "n" -a $rt -eq 0 ]; then
51 echo "$i" | grep -q '.*\-[a-z][a-z]\....$'
53 # se file con suffisso di lingua
54 suff="$(echo "$i" | sed 's/\(.*\)\-\([a-z][a-z]\)\.\(...\)$/\2/g')"
56 if [ "$lang" = "$suff" ]; then
60 eni="$(echo "$i" | sed 's/\(.*\)\.\(...\)$/\1-en.\2/g')"
62 # esiste la versione _en
63 if [ "$lang" = "it" ]; then
64 # se lingua italiana le img mlang nn hanno estensione quindi va presa
68 # NON esiste la versione _en quindi e' una immagine NON mlang e va comunque presa
77 abspa="${IMGPATHBASE}${1}img"
78 if [ "$1" = "" ]; then
79 ls -S $( imglist_fla "$abspa" "$2" )
80 elif [ "$1" = "briskin5/" ]; then
81 rex='/[0-9][0-9][^/]*$'
82 ls -S $( imglist_fla "$abspa" "$2" "$rex" "y" )
83 ls -S $( imglist_fla "$abspa" "$2" "$rex" "n" )
88 if [ "$lang" = "it" ]; then
94 for dpath in "" briskin5/ ; do
95 OUTFILE="web/${dpath}"preload_img${fsuf}.js
96 echo "creating $OUTFILE ..."
98 IMGPATH="${IMGPATHBASE}${dpath}img"
100 echo "var g_preload_img_arr = new Array( "
103 ltri="`echo "$IMGPATH" | wc -c`"
104 for i in $(imglist "$dpath" "$lang"); do
105 if [ $first -ne 1 ]; then
107 if [ $((ct % 2)) -eq 0 ]; then
114 outna="img/`echo "$i" | cut -c $((ltri + 1))-`"
124 echo "var g_preload_imgsz_arr = new Array( "
129 ltri="`echo "$IMGPATH" | wc -c`"
130 for i in $(imglist "$dpath" "$lang"); do
131 outna="`echo "$i" | cut -c $((ltri + 1))-`"
132 sz="`stat -c '%s' $IMGPATH/$outna`"
136 for i in $(imglist "$dpath" "$lang"); do
137 outna="`echo "$i" | cut -c $((ltri + 1))-`"
138 if [ $first -ne 1 ]; then
140 if [ $((ct % 8)) -eq 0 ]; then
147 sz="`stat -c '%s' $IMGPATH/$outna`"
149 cur="`echo "100.0 * $sum / $tot" | bc -l | sed 's/\(\.[0-9]\)[0-9]*/\1/g'`"