import from profile share
This commit is contained in:
parent
7482c81b31
commit
c688a46f74
175
image
175
image
@ -1,175 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source settings
|
|
||||||
for file in lib/*
|
|
||||||
do
|
|
||||||
source $file
|
|
||||||
done
|
|
||||||
|
|
||||||
declare -A values
|
|
||||||
|
|
||||||
#for indice in ${!uinames[@]}
|
|
||||||
#do
|
|
||||||
# uitods[$indice]="${uinames[$indice]}"
|
|
||||||
#done
|
|
||||||
|
|
||||||
tmpfile=$(mktemp --suffix=.png)
|
|
||||||
convert -contrast "$1" "$tmpfile"
|
|
||||||
readarray -t tactout < <(tesseract -l eng -psm 4 "$tmpfile" stdout)
|
|
||||||
rm "$tmpfile"
|
|
||||||
|
|
||||||
for line in "${tactout[@]}"
|
|
||||||
do
|
|
||||||
case "$line" in
|
|
||||||
#14,522,411 AP 144mm AP
|
|
||||||
*' AP'*)
|
|
||||||
read value junk <<<"$line"
|
|
||||||
values[AP]=${value//,/}
|
|
||||||
;;
|
|
||||||
#Unique Portals Visited 718
|
|
||||||
'Unique Portals Visited'*)
|
|
||||||
value="${line#Unique Portals Visited }"
|
|
||||||
read values[Explorer] junk <<<"${value//,}"
|
|
||||||
;;
|
|
||||||
#Portals Discovered 9
|
|
||||||
'Portals Discovered'*)
|
|
||||||
value="${line#Portals Discovered }"
|
|
||||||
read values[Seer] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#XM Collected 130,908,527 XM
|
|
||||||
'XM Collected'*)
|
|
||||||
value="${line#XM Collected}"
|
|
||||||
read values[XM] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Distance Walked 1,785 km
|
|
||||||
'Distance Walked'*)
|
|
||||||
value="${line#Distance Walked }"
|
|
||||||
read values[Walked] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Resonators Deployed 24,451
|
|
||||||
'Resonators Deployed'*)
|
|
||||||
value="${line#Resonators Deployed }"
|
|
||||||
read values[Builder] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Links Created 4,479
|
|
||||||
'Links Created'*)
|
|
||||||
value="${line#Links Created }"
|
|
||||||
read values[Connector] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Control Fields Created 2,340
|
|
||||||
'Control Fields Created'*)
|
|
||||||
value="${line#Control Fields Created }"
|
|
||||||
read values[Mind_Controller] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Mind Units Captured 155,815 MUs
|
|
||||||
'Mind Units Captured'*)
|
|
||||||
value="${line#Mind Units Captured }"
|
|
||||||
read values[MU] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Longest Link Ever Created 3 km
|
|
||||||
'Longest Link Ever Created'*)
|
|
||||||
value="${line#Longest Link Ever Created }"
|
|
||||||
read values[Longest_Link] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Largest Control Field 11,588 MUs
|
|
||||||
'Largest Control Field'*)
|
|
||||||
value="${line#Largest Control Field }"
|
|
||||||
read values[Largest_Field] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#XM Recharged 92,120,959 XM
|
|
||||||
'XM Recharged'*)
|
|
||||||
value="${line#XM Recharged }"
|
|
||||||
read values[Recharger] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Portals Captured 2,022
|
|
||||||
'Portals Captured'*)
|
|
||||||
value="${line#Portals Captured }"
|
|
||||||
read values[Liberator] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Unique Portals Captured 375
|
|
||||||
'Unique Portals Captured'*)
|
|
||||||
value="${line#Unique Portals Captured }"
|
|
||||||
read values[Pioneer] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Mods Deployed 995
|
|
||||||
'Mods Deployed'*)
|
|
||||||
value="${line#Mods Deployed }"
|
|
||||||
read values[Engineer] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Resonators Destroyed 15,855
|
|
||||||
'Resonators Destroyed'*)
|
|
||||||
value="${line#Resonators Destroyed }"
|
|
||||||
read values[Purifier] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Portals Neutralized 2,145
|
|
||||||
'Portals Neutralized'*)
|
|
||||||
value="${line#Portals Neutralized }"
|
|
||||||
read values[Neutralized] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Enemy Links Destroyed 2,725
|
|
||||||
'Enemy Links Destroyed'*)
|
|
||||||
value="${line#Enemy Links Destroyed }"
|
|
||||||
read values[Links_Destroyed] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Enemy Control Fields Destroyed 1,418
|
|
||||||
'Enemy Control Fields Destroyed'*)
|
|
||||||
value="${line#Enemy Control Fields Destroyed }"
|
|
||||||
read values[Fields_Destroyed] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Max Time Portal Held 105 days
|
|
||||||
'Max Time Portal Held'*)
|
|
||||||
value="${line#Max Time Portal Held }"
|
|
||||||
read values[Guardian] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Max Time Link Maintained 75 days
|
|
||||||
'Max Time Link Maintained'*)
|
|
||||||
value="${line#Max Time Link Maintained }"
|
|
||||||
read values[Link_Maintained] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Max Link Length x Days 89 km-days
|
|
||||||
'Max Link Length x Days'*)
|
|
||||||
value="${line#Max Link Length x Days }"
|
|
||||||
read values[Link_Length_x_Days] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Max Time Field Held 55 days
|
|
||||||
'Max Time Field Held'*)
|
|
||||||
value="${line#Max Time Field Held }"
|
|
||||||
read values[Field_Held] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Largest Field MUs x Days 58,959 MU-days
|
|
||||||
'Largest Field MUs x Days'*)
|
|
||||||
value="${line#Largest Field MUs x Days }"
|
|
||||||
read values[Field_x_Days] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Unique Missions Completed 1
|
|
||||||
'Unique Missions Completed'*)
|
|
||||||
value="${line#Unique Missions Completed }"
|
|
||||||
read values[Mercenary] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Hacks 25,741
|
|
||||||
'Hacks'*)
|
|
||||||
value="${line#Hacks }"
|
|
||||||
read values[Hacker] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Glyph Hack Points 1,022
|
|
||||||
'Glyph Hack Points'*)
|
|
||||||
value="${line#Glyph Hack Points }"
|
|
||||||
read values[Translator] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
#Agents Recruited 1
|
|
||||||
'Agents Recruited'*)
|
|
||||||
value="${line#Agents Recruited }"
|
|
||||||
read values[Recruiter] junk <<<"${value//,/}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
for indice in ${!uinames[@]}
|
|
||||||
do
|
|
||||||
if [[ -n "${values[$indice]}" ]]
|
|
||||||
then
|
|
||||||
echo "$indice: ${values[$indice]}"
|
|
||||||
else
|
|
||||||
echo "Missing $indice (${uinames[$indice]})"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
16
index
16
index
@ -22,26 +22,18 @@ for lib in lib/*
|
|||||||
do
|
do
|
||||||
source $lib
|
source $lib
|
||||||
done
|
done
|
||||||
if [ ! -w "$rrdfile" ]
|
import_images &
|
||||||
then
|
|
||||||
cat <<-EOHead
|
|
||||||
Content-type: text/plain
|
|
||||||
Last-Modified: $(LC_ALL=C TZ=GMT date +'%a, %d %b %Y %X %Z')
|
|
||||||
Expires: $(LC_ALL=C TZ=GMT date +'%a, %d %b %Y %X %Z')
|
|
||||||
refresh: 0,url=/cgi/$webuser/add.html
|
|
||||||
|
|
||||||
EOHead
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
read_query_string
|
read_query_string
|
||||||
(( start >= end)) && (( end = start + 604800 ))
|
(( start >= end)) && (( end = start + 604800 ))
|
||||||
|
|
||||||
if [ -z "$graph" ]
|
if [ -z "$graph" ]
|
||||||
then
|
then
|
||||||
|
refresh=300
|
||||||
|
[[ -r .importing ]] && refresh=5
|
||||||
send_headers <<-EOHead
|
send_headers <<-EOHead
|
||||||
content-type: application/xhtml+xml
|
content-type: application/xhtml+xml
|
||||||
refresh: 300
|
refresh: $refresh
|
||||||
EOHead
|
EOHead
|
||||||
|
|
||||||
readlast
|
readlast
|
||||||
|
|||||||
179
lib/image
Executable file
179
lib/image
Executable file
@ -0,0 +1,179 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# IngRRD (https://forge.riquer.fr/p/ingrrd/)
|
||||||
|
# Copyright (C) 2015 Vincent Riquer
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
image() {
|
||||||
|
exec 2>&1
|
||||||
|
local timestamp=$2
|
||||||
|
declare -A values
|
||||||
|
|
||||||
|
tmpfile=$(mktemp --suffix=.png)
|
||||||
|
convert -contrast "$1" "$tmpfile"
|
||||||
|
readarray -t tactout < <(tesseract -l eng -psm 4 "$tmpfile" stdout)
|
||||||
|
rm "$tmpfile"
|
||||||
|
|
||||||
|
for line in "${tactout[@]}"
|
||||||
|
do
|
||||||
|
case "$line" in
|
||||||
|
#14,522,411 AP 144mm AP
|
||||||
|
*' AP'*)
|
||||||
|
read value junk <<<"$line"
|
||||||
|
values[AP]=${value//,/}
|
||||||
|
;;
|
||||||
|
#Unique Portals Visited 718
|
||||||
|
'Unique Portals Visited'*)
|
||||||
|
value="${line#Unique Portals Visited }"
|
||||||
|
read values[Explorer] junk <<<"${value//,}"
|
||||||
|
;;
|
||||||
|
#Portals Discovered 9
|
||||||
|
'Portals Discovered'*)
|
||||||
|
value="${line#Portals Discovered }"
|
||||||
|
read values[Seer] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#XM Collected 130,908,527 XM
|
||||||
|
'XM Collected'*)
|
||||||
|
value="${line#XM Collected}"
|
||||||
|
read values[XM] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Distance Walked 1,785 km
|
||||||
|
'Distance Walked'*)
|
||||||
|
value="${line#Distance Walked }"
|
||||||
|
read values[Walked] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Resonators Deployed 24,451
|
||||||
|
'Resonators Deployed'*)
|
||||||
|
value="${line#Resonators Deployed }"
|
||||||
|
read values[Builder] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Links Created 4,479
|
||||||
|
'Links Created'*)
|
||||||
|
value="${line#Links Created }"
|
||||||
|
read values[Connector] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Control Fields Created 2,340
|
||||||
|
'Control Fields Created'*)
|
||||||
|
value="${line#Control Fields Created }"
|
||||||
|
read values[Mind_Controller] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Mind Units Captured 155,815 MUs
|
||||||
|
'Mind Units Captured'*)
|
||||||
|
value="${line#Mind Units Captured }"
|
||||||
|
read values[MU] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Longest Link Ever Created 3 km
|
||||||
|
'Longest Link Ever Created'*)
|
||||||
|
value="${line#Longest Link Ever Created }"
|
||||||
|
read values[Longest_Link] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Largest Control Field 11,588 MUs
|
||||||
|
'Largest Control Field'*)
|
||||||
|
value="${line#Largest Control Field }"
|
||||||
|
read values[Largest_Field] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#XM Recharged 92,120,959 XM
|
||||||
|
'XM Recharged'*)
|
||||||
|
value="${line#XM Recharged }"
|
||||||
|
read values[Recharger] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Portals Captured 2,022
|
||||||
|
'Portals Captured'*)
|
||||||
|
value="${line#Portals Captured }"
|
||||||
|
read values[Liberator] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Unique Portals Captured 375
|
||||||
|
'Unique Portals Captured'*)
|
||||||
|
value="${line#Unique Portals Captured }"
|
||||||
|
read values[Pioneer] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Mods Deployed 995
|
||||||
|
'Mods Deployed'*)
|
||||||
|
value="${line#Mods Deployed }"
|
||||||
|
read values[Engineer] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Resonators Destroyed 15,855
|
||||||
|
'Resonators Destroyed'*)
|
||||||
|
value="${line#Resonators Destroyed }"
|
||||||
|
read values[Purifier] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Portals Neutralized 2,145
|
||||||
|
'Portals Neutralized'*)
|
||||||
|
value="${line#Portals Neutralized }"
|
||||||
|
read values[Neutralized] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Enemy Links Destroyed 2,725
|
||||||
|
'Enemy Links Destroyed'*)
|
||||||
|
value="${line#Enemy Links Destroyed }"
|
||||||
|
read values[Links_Destroyed] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Enemy Control Fields Destroyed 1,418
|
||||||
|
'Enemy Control Fields Destroyed'*)
|
||||||
|
value="${line#Enemy Control Fields Destroyed }"
|
||||||
|
read values[Fields_Destroyed] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Max Time Portal Held 105 days
|
||||||
|
'Max Time Portal Held'*)
|
||||||
|
value="${line#Max Time Portal Held }"
|
||||||
|
read values[Guardian] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Max Time Link Maintained 75 days
|
||||||
|
'Max Time Link Maintained'*)
|
||||||
|
value="${line#Max Time Link Maintained }"
|
||||||
|
read values[Link_Maintained] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Max Link Length x Days 89 km-days
|
||||||
|
'Max Link Length x Days'*)
|
||||||
|
value="${line#Max Link Length x Days }"
|
||||||
|
read values[Link_Length_x_Days] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Max Time Field Held 55 days
|
||||||
|
'Max Time Field Held'*)
|
||||||
|
value="${line#Max Time Field Held }"
|
||||||
|
read values[Field_Held] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Largest Field MUs x Days 58,959 MU-days
|
||||||
|
'Largest Field MUs x Days'*)
|
||||||
|
value="${line#Largest Field MUs x Days }"
|
||||||
|
read values[Field_x_Days] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Unique Missions Completed 1
|
||||||
|
'Unique Missions Completed'*)
|
||||||
|
value="${line#Unique Missions Completed }"
|
||||||
|
read values[Mercenary] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Hacks 25,741
|
||||||
|
'Hacks'*)
|
||||||
|
value="${line#Hacks }"
|
||||||
|
read values[Hacker] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Glyph Hack Points 1,022
|
||||||
|
'Glyph Hack Points'*)
|
||||||
|
value="${line#Glyph Hack Points }"
|
||||||
|
read values[Translator] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
#Agents Recruited 1
|
||||||
|
'Agents Recruited'*)
|
||||||
|
value="${line#Agents Recruited }"
|
||||||
|
read values[Recruiter] junk <<<"${value//,/}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
template="${!values[@]}"
|
||||||
|
updatevalues="${values[@]}"
|
||||||
|
|
||||||
|
rrdtool update "$rrdfile" -t "${template// /:}" "$timestamp:${updatevalues// /:}"
|
||||||
|
}
|
||||||
29
lib/import_images
Normal file
29
lib/import_images
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
import_images() {
|
||||||
|
local starttime=$(date +%s) imagetime timestamp elapsed
|
||||||
|
exec >> images.log
|
||||||
|
exec 2>> images.log
|
||||||
|
declare -r oldIFS="$IFS"
|
||||||
|
[[ -r .importing ]] && return 2
|
||||||
|
touch .importing
|
||||||
|
[[ -w "$rrdfile" ]] || rrdcreate
|
||||||
|
readlast
|
||||||
|
for file in dav/*
|
||||||
|
do
|
||||||
|
[[ -r "$file" ]] || continue
|
||||||
|
IFS=_.
|
||||||
|
read junk date time junk <<<"$file"
|
||||||
|
IFS="$oldIFS"
|
||||||
|
if (( $(date '+%Y%m%d%H%M%S' -d @${last[time]}) < $date$time ))
|
||||||
|
then
|
||||||
|
imagetime="${date:0:4}/${date:4:2}/${date:6:2} ${time:0:2}:${time:2:2}:${time:4:2}"
|
||||||
|
echo "$(date +"%Y/%m/%d:%H:%M:%S") - $file: $imagetime"
|
||||||
|
timestamp=$(date +%s -d "$imagetime")
|
||||||
|
image "$file" $timestamp
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
elapsed=$(( $(date +%s) - starttime ))
|
||||||
|
echo "$(date +"%Y/%m/%d:%H:%M:%S"): Spent $elapsed seconds"
|
||||||
|
rm .importing
|
||||||
|
}
|
||||||
@ -7,6 +7,7 @@ readlast() {
|
|||||||
lastupdatelines \
|
lastupdatelines \
|
||||||
values \
|
values \
|
||||||
|
|
||||||
|
last["time"]=0
|
||||||
readarray -t lastupdatelines < <(
|
readarray -t lastupdatelines < <(
|
||||||
rrdtool lastupdate $rrdfile
|
rrdtool lastupdate $rrdfile
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user