diff --git a/rc b/rc
index 437a251..84b7051 100755
--- a/rc
+++ b/rc
@@ -10,18 +10,27 @@ PATH=$( echo $PATH | awk -F: '{for (i=1;i<=NF;i++) { if ( !x[$i]++ ) printf("%s:
export PATH
. "$TOOLSPATH"/qcd_function
+[[ -f "$TOOLSPATH"/tsv/tsvkit.sh ]] && . "$TOOLSPATH"/tsv/tsvkit.sh
function _self_update() {
touch "$TOOLSPATH"/.lastupdate
pushd "$TOOLSPATH" > /dev/null
[[ "$1" = "-u" ]] && {
hg pull -u https://bitbucket.org/MoonQ/tools
+ _update_tsvkit
} || {
timeout 5 hg pull -u hg pull https://bitbucket.org/MoonQ/tools > /dev/null 2>&1
}
popd > /dev/null
}
+function _update_tsvkit() {
+ mkdir -p "$TOOLSPATH"/tsv/lib
+ wget -qO "$TOOLSPATH"/tsv/tsvkit.sh https://bitbucket.org/anduril-dev/anduril/raw/anduril2/lang/bash/tsvkit.sh
+ wget -qO "$TOOLSPATH"/tsv/lib/tsvhead https://bitbucket.org/anduril-dev/anduril/raw/anduril2/lang/bash/lib/tsvhead
+ wget -qO "$TOOLSPATH"/tsv/lib/tsvtail https://bitbucket.org/anduril-dev/anduril/raw/anduril2/lang/bash/lib/tsvtail
+}
+
function _change_hg_repo() {
[[ -w "$TOOLSPATH"/.hg ]] || return
[[ -w "$TOOLSPATH"/.hg/hgrc ]] || return
@@ -58,6 +67,6 @@ unset -f _change_hg_repo
TOOLS_LASTUPDATE=$(( $( date +%s ) - $( stat -c %Y "$TOOLSPATH"/.lastupdate ) ))
[[ "$TOOLS_LASTUPDATE" -gt 604800 ]] && _self_update
unset TOOLS_LASTUPDATE
-unset -f _self_update
+unset -f _self_update _update_tsvkit
diff --git a/web/SimpleWebPage.py b/web/SimpleWebPage.py
index 408837d..ee67edf 100755
--- a/web/SimpleWebPage.py
+++ b/web/SimpleWebPage.py
@@ -6,6 +6,7 @@
import os,sys,time
import urllib
VERSION="20160116"
+IMAGE_EXTENSIONS=['png','gif','jpg','jpeg','tif','tiff']
def setup():
''' Setup the command line options '''
@@ -21,6 +22,8 @@ def setup():
help="Output filename (Default: index.html)")
parser.add_argument("-p",action="store_false",dest="parent",default=True,
help="Do no print .. link for parent folder.")
+ parser.add_argument("--images",action="store_true",dest="images",default=False,
+ help="Show images with tags")
parser.add_argument("--version",action='version', version=VERSION)
parser.add_argument("path",type=str,action="store",default=os.path.abspath('.'),nargs='?',
help="Root path of the index")
@@ -34,7 +37,8 @@ def setup2HTML(opts):
return ''%";".join([
'hidden=%s'%opts.hidden,
'parent=%s'%opts.parent,
- 'title=%s'%urllib.quote(opts.title)
+ 'title=%s'%urllib.quote(opts.title),
+ 'images=%s'%opts.images
])
def HTML2setup(opts):
@@ -48,6 +52,7 @@ def HTML2setup(opts):
if k=='hidden': opts.hidden=v=="True"
if k=='parent': opts.parent=v=="True"
if k=='title': opts.title=urllib.unquote(v)
+ if k=='images': opts.images=v=="True"
print("Reading options from existing "+opts.filename)
break
except:
@@ -74,18 +79,25 @@ def generate_index(opts):
for di in dirs:
f.write(get_pathlink(path,di))
for fi in files:
- f.write(get_filelink(path,fi))
+ f.write(get_filelink(path,fi,opts.images))
f.write(get_footer())
f.close()
return
-def get_filelink(path,fname):
+def get_filelink(path,fname,images=False):
fsize=os.path.getsize(os.path.join(path,fname))
fsstr=sizeof(fsize)
fsstrb=str(fsize)
fdate=time.localtime(os.path.getmtime(os.path.join(path,fname)))
fdstr=time.strftime("%Y/%m/%d %H:%M:%S",fdate)
- return '