Skip to content

Commit

Permalink
folder add
Browse files Browse the repository at this point in the history
  • Loading branch information
swoellauer committed Aug 18, 2023
1 parent aea2aae commit 3ea54e7
Show file tree
Hide file tree
Showing 15 changed files with 297 additions and 0 deletions.
35 changes: 35 additions & 0 deletions add/clear_cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

GREEN='\033[0;32m'
RED='\033[0;31m'
WHITE='\033[0;97m'
NC='\033[0m' # No Color
echo -e ""
echo -e "${WHITE}--------------------------------------------------------------------------------------------------${NC}"
echo -e "${RED}!! only proceed if you stopped a running PhotoDB instance !!${NC}"
echo -e "${GREEN}Do you want to remove all database cache files?${NC}"
echo -e "${WHITE}This may be needed after update to a newer PhotoDB Version.${NC}"
echo -e "${WHITE}At next start of PhotoDB the database cache will be regenerated.${NC}"
echo -e "${WHITE}--------------------------------------------------------------------------------------------------${NC}"
select yn in "Yes" "No" "Cancel"; do
case $yn in
Yes ) break;;
No ) exit;;
Cancel ) exit;;
esac
done

unlink label_store.mv.db
unlink label_store.trace.db
unlink label_store.trace.db.old
unlink photo_cache.mv.db
unlink photo_cache.trace.db
unlink photo_cache.trace.db.old
unlink sample_cache.mv.db
unlink sample_cache.trace.db
unlink sample_cache.trace.db.old
unlink thumb_cache.mv.db
unlink thumb_cache.trace.db
unlink sample_cache.trace.db.old

echo -e "${GREEN}Done. Now you may start PhotoDB. It may take some time to regenerate database caches.${NC}"
11 changes: 11 additions & 0 deletions add/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
http_port: 8080
login: false

photo:
projects:

- project: myproject
root_path: 'photo_meta'
root_data_path: 'photo_data'
classification_definition_csv: photo_classification_definitions.csv
review_list_path: 'photo_review_lists'
173 changes: 173 additions & 0 deletions add/github_update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
#!/bin/bash

update_folders=(
lib
mustache
webcontent
)

update_files=(
photodb.jar
)

GREEN='\033[0;32m'
RED='\033[0;31m'
WHITE='\033[0;97m'
NC='\033[0m' # No Color
echo -e ""
echo -e "${WHITE}--------------------------------------------------------------------------------------------------${NC}"
echo -e "${RED}!! only proceed if you stopped a running PhotoDB instance !!${NC}"
echo -e "${GREEN}Do you want to download the latest PhotoDB release package, backup changed files and performe update?${NC}"
echo -e "${WHITE}After update it may be needed to run the ./clear_cache.sh script for PhotoDB to work properly.${NC}"
echo -e "${WHITE}--------------------------------------------------------------------------------------------------${NC}"
select yn in "Yes" "No" "Cancel"; do
case $yn in
Yes ) break;;
No ) exit;;
Cancel ) exit;;
esac
done

timestamp=$(date +%Y_%m_%d__%H_%M_%S)
echo $timestamp

echo -e "${GREEN}delete folder 'update'${NC}"
rm -rf ./update
if [ -d ./update ]
then
echo -e "${RED}folder 'update' still exists, abort. (no changes performed)${NC}"
exit 1
fi

echo -e "${GREEN}download latest 'package.zip'${NC}"
wget --directory-prefix=./update https://github.com/Nature40/photodb/releases/latest/download/package.zip

if [ ! -f ./update/package.zip ]
then
echo -e "${RED}could not find 'update/package.zip', abort. (no changes performed)${NC}"
exit 2
fi

echo -e "extract 'package.zip'"
unzip ./update/package.zip -d ./update
echo -e "${GREEN}download update done.${NC}"

for i in "${update_folders[@]}"; do
#echo "$i"
if [ ! -d ./update/$i ]
then
echo -e "${RED}folder '$i' is missing in update, abort. (no changes performed)${NC}"
exit 3
fi
done

for i in "${update_files[@]}"; do
#echo "$i"
if [ ! -f ./update/$i ]
then
echo -e "${RED}file '$i' is missing in update, abort. (no changes performed)${NC}"
exit 4
fi
done

if [ ! -d ./backup ]
then
mkdir ./backup
fi

if [ ! -d ./backup ]
then
echo -e "${RED}could not create 'backup' folder, abort. (no changes performed)${NC}"
exit 5
fi

backup=./backup/$timestamp

if [ -d $backup ]
then
echo -e "${RED}backup folder '$backup' already exists, abort. (no changes performed)${NC}"
exit 6
fi

mkdir $backup
if [ ! -d $backup ]
then
echo -e "${RED}could not create backup folder '$backup', abort. (no changes performed)${NC}"
exit 7
fi

for i in "${update_folders[@]}"; do
#echo "$i"
if [ -d ./$i ]
then
mv ./$i $backup
else
echo -e "missing folder for backup '$i'. continue."
fi
done

for i in "${update_files[@]}"; do
#echo "$i"
if [ -f ./$i ]
then
mv ./$i $backup
else
echo -e "missing file for backup '$i'. continue."
fi
done

for i in "${update_folders[@]}"; do
#echo "$i"
if [ -d ./$i ]
then
echo -e "${RED}folder '$i' still exists after backup, abort. (some folders/files may be moved to backup already)${NC}"
exit 8
fi
done

for i in "${update_files[@]}"; do
#echo "$i"
if [ -f ./$i ]
then
echo -e "${RED}file '$i' still exists after backup, abort. (some folders/files may be moved to backup already)${NC}"
exit 9
fi
done
echo -e "${GREEN}backup done. ('$backup')${NC}"

for i in "${update_folders[@]}"; do
#echo "$i"
mv ./update/$i ./
done

for i in "${update_files[@]}"; do
#echo "$i"
mv ./update/$i ./
done

for i in "${update_folders[@]}"; do
#echo "$i"
if [ -d ./$i ]
then
echo -e "updated folder: ${WHITE}$i${NC}"
else
echo -e "${RED}folder '$i' has not beend updated (missing), abort. (some updates may have been performed, your should revert to a backup))${NC}"
exit 10
fi
done

for i in "${update_files[@]}"; do
#echo "$i"
if [ -f ./$i ]
then
echo -e "updated file: ${WHITE}$i${NC}"
else
echo -e "${RED}file '$i' has not beend updated (missing), abort. (some updates may have been performed, your should revert to a backup))${NC}"
exit 11
fi
done
echo -e ""
echo -e "${GREEN}update done. backup in '$backup'${NC}"
echo -e ""
exit 0

6 changes: 6 additions & 0 deletions add/lib/3rdparty_license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This software contains unmodified binary redistributions for
H2 database engine (https://h2database.com/),
which is dual licensed and available under the MPL 2.0
(Mozilla Public License) or under the EPL 1.0 (Eclipse Public License).
An original copy of the license agreement can be found at:
https://h2database.com/html/license.html
13 changes: 13 additions & 0 deletions add/photo_classification_definitions.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#comment
name,description
incorrect box, Box does not mark (correctly) an object.
person, Photo will be locked. (DSGVO)
animal, unspecified animal
Kleintier, unbestimmt
Großtier, unbestimmt
Katze, generisch
Hauskatze, Felis catus
Wildkatze, Felis silvestris silvestris
Hirsch, generisch
Wildschwein, Sus scrofa
Waschbär, Procyon lotor
Binary file added add/photo_data/photo1_20220101_010101.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added add/photo_data/photo2_20220101_020101.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added add/photo_data/photo3_20220101_030101.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added add/photo_data/photo4_20220101_040101.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions add/photo_meta/photo1_20220101_010101.jpg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PhotoSens: v1.0
file: photo1_20220101_010101.jpg
log:
- {action: create yaml, date: '2022-02-22T17:03:23'}
- {action: generate jpg metadata, date: '2022-02-22T17:03:46'}
location: photo_data
date: '2022-01-01T01:01:01'
width: 33
height: 28
detections:
- bbox: [0.42424244, 0.4642857, 0.18181819, 0.25]
classifications:
- {classification: Hauskatze, classificator: Expert, identity: anonymous, date: '2022-02-28T11:28:46'}
13 changes: 13 additions & 0 deletions add/photo_meta/photo2_20220101_020101.jpg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PhotoSens: v1.0
file: photo2_20220101_020101.jpg
log:
- {action: create yaml, date: '2022-02-22T17:03:23'}
- {action: generate jpg metadata, date: '2022-02-22T17:03:46'}
location: photo_data
date: '2022-01-01T02:01:01'
width: 40
height: 30
detections:
- bbox: [0.525, 0.46666667, 0.175, 0.3]
classifications:
- {classification: Wildschwein, classificator: Expert, identity: anonymous, date: '2022-02-28T11:28:58'}
13 changes: 13 additions & 0 deletions add/photo_meta/photo3_20220101_030101.jpg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PhotoSens: v1.0
file: photo3_20220101_030101.jpg
log:
- {action: create yaml, date: '2022-02-22T17:03:23'}
- {action: generate jpg metadata, date: '2022-02-22T17:03:47'}
location: photo_data
date: '2022-01-01T03:01:01'
width: 36
height: 19
detections:
- bbox: [0.44444445, 0.10526316, 0.2777778, 0.42105263]
classifications:
- {classification: Waschbär, classificator: Expert, identity: anonymous, date: '2022-02-28T11:29:06'}
16 changes: 16 additions & 0 deletions add/photo_meta/photo4_20220101_040101.jpg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
PhotoSens: v1.0
file: photo4_20220101_040101.jpg
log:
- {action: create yaml, date: '2022-02-22T17:03:23'}
- {action: generate jpg metadata, date: '2022-02-22T17:03:47'}
location: photo_data
date: '2022-01-01T04:01:01'
width: 35
height: 26
detections:
- bbox: [0.37142858, 0.115384616, 0.2, 0.34615386]
classifications:
- {classification: Hirsch, classificator: Expert, identity: anonymous, date: '2022-02-28T11:29:19'}
- bbox: [0.4857143, 0.5769231, 0.22857143, 0.30769232]
classifications:
- {classification: Wildkatze, classificator: Expert, identity: anonymous, date: '2022-02-28T11:29:41'}
1 change: 1 addition & 0 deletions add/photodb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exec java -Djava.awt.headless=true -XX:-UsePerfData -Djava.io.tmpdir=/var/tmp -Xmx2g -classpath 'photodb.jar:lib/*' photodb.Terminal "$@"
3 changes: 3 additions & 0 deletions add/win_photodb.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
java -Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl -Djava.awt.headless=true -XX:-UsePerfData -Xmx3g -classpath photodb.jar;lib/* photodb.Terminal %*

pause

0 comments on commit 3ea54e7

Please sign in to comment.