Merge branch 'master' of 192.168.0.2:photoassistant

This commit is contained in:
Damien De Paoli
2021-07-12 19:24:09 +10:00
25 changed files with 856 additions and 394 deletions

37
README
View File

@@ -1,5 +1,10 @@
In here we can put instructions on how to run this / any general info
to edit src:
git....
CAM: fill this in pls
ubuntu packages:
sudo apt-get install -y mediainfo cmake python3-flask
@@ -21,10 +26,16 @@ pip packages:
upstream packages...
mkdir static/upstream
cd static/upstream
mkdir bootstrap-4.6.0-dist
cd bootstrap-4.6.0-dist
mkdir css
# for boostrap:
wget https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css
wget https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js
mkdir js
# to note we might need bootstrap.bundle.min.js if we use new features?
wget https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.min.js
# for jquery
https://code.jquery.com/jquery-3.6.0.min.js
@@ -50,7 +61,7 @@ to run prod version of web server:
gunicorn --bind="192.168.0.2:5000" --threads=2 --workers=2 main:app
Also have to run the job manager for jobs to work:
python3 pa_job_manager.py
FLASK_ENV="development" python3 pa_job_manager.py
To rebuild DB from scratch/empty data:
@@ -79,3 +90,25 @@ To get back a 'working' but scanned set of data:
# gunzip -c /home/ddp/src/photoassistant/DB_BACKUP/20200126-all-imported-no-duplicates.sql.gz > /srv/docker/container/padb/docker-entrypoint-initdb.d/tables.sql
( cd /srv/docker/config/ ; sudo docker-compose stop padb ; yes | sudo docker-compose rm padb ; sudo rm -rf /srv/docker/container/padb/data/ ; sudo docker-compose up padb )
HANDY SQLs/commands:
# long-running AI job (in this case #46), which is not committing joblog per file, and isnt tracking counts properly (temporary bug)
sudo docker exec -it padb bash
echo 'select * from joblog where job_id = 46;' | psql --user=pa pa | grep 'ooking for' | awk '{ print $15 } ' | sort -u | wc -l
# how many entries are in a path
sudo docker exec -it padb bash
psql --user=pa pa
select count(entry_id) from entry_dir_link where dir_eid in ( select distinct dir_eid from path_dir_link where path_id = 2 );
# how many Images are in a path
sudo docker exec -it padb bash
psql --user=pa pa
select count(distinct e.id) from entry e, entry_dir_link edl where e.type_id = 1 and e.id = edl.entry_id and edl.dir_eid in ( select distinct dir_eid from path_dir_link where path_id = 2 );
# get abs filenames of matching files (for liz person.tag, but could easily add
# d.rel_path like 'liz' too :
select '"'||replace(replace(p.path_prefix,'static/Storage/',''),'static/Import/', '')||'/'||d.rel_path||'/'||e.name||'"' from entry e, entry_dir_link edl, path_dir_link pdl, path p, dir d where e.id = edl.entry_id and edl.dir_eid = pdl.dir_eid and pdl.path_id = p.id and d.eid = edl.dir_eid and e.id in ( select e.id from entry e, face_file_link ffl, face_refimg_link frl, person_refimg_link prl, person p where e.id = ffl.file_eid and ffl.face_id = frl.face_id and frl.refimg_id = prl.refimg_id and prl.person_id = p.id and p.tag = 'liz' );