cleaned up code around json, *locn -> transitioned to top, right, bottom, left to finally fix ORM replacing [ with { <- FIXES BUG-108

This commit is contained in:
2022-12-23 16:18:27 +11:00
parent 81fea4f6f3
commit 2a1e2d7d5d
8 changed files with 12 additions and 31 deletions

10
TODO
View File

@@ -1,6 +1,16 @@
## GENERAL ## GENERAL
* ignore face should ignore ALL matching faces (re: Cams mate) * ignore face should ignore ALL matching faces (re: Cams mate)
* should be using jsonify to return real json to my API calls, e.g:
response = make_response(
jsonify(
{"message": str(FLAMSG_ERR_SEC_ACCESS_DENIED), "severity": "danger"}
),
401,
)
response.headers["Content-Type"] = "application/json"
return response
* change the rotation code to use that jpeg util to reduce/remove compression loss? * change the rotation code to use that jpeg util to reduce/remove compression loss?
* About page -> find a way to push git commit/date through to f/e, so we can see what release we are running * About page -> find a way to push git commit/date through to f/e, so we can see what release we are running

1
ai.py
View File

@@ -12,7 +12,6 @@ from flask_login import login_required, current_user
from PIL import Image from PIL import Image
import io import io
import base64 import base64
import json
from job import Job, JobExtra, Joblog, NewJob from job import Job, JobExtra, Joblog, NewJob
from face import Face, FaceFileLink, FaceRefimgLink from face import Face, FaceFileLink, FaceRefimgLink

View File

@@ -3,13 +3,6 @@ from sqlalchemy import Sequence
from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.exc import SQLAlchemyError
from shared import PA from shared import PA
# DEL ME SOON
from flask_login import login_required
from flask import render_template
import json
# pylint: disable=no-member # pylint: disable=no-member
################################################################################ ################################################################################

View File

@@ -1,6 +1,6 @@
from wtforms import SubmitField, StringField, HiddenField, validators, Form from wtforms import SubmitField, StringField, HiddenField, validators, Form
from flask_wtf import FlaskForm from flask_wtf import FlaskForm
from flask import request, render_template, redirect, send_from_directory, url_for, jsonify from flask import request, render_template, redirect, send_from_directory, url_for
from path import MovePathDetails from path import MovePathDetails
from main import db, app, ma from main import db, app, ma
from sqlalchemy import Sequence from sqlalchemy import Sequence
@@ -17,7 +17,6 @@ import numpy
import cv2 import cv2
import time import time
import re import re
import json
from datetime import datetime from datetime import datetime
import pytz import pytz
from flask_login import login_required, current_user from flask_login import login_required, current_user

View File

@@ -1,4 +1,4 @@
from flask import Flask, render_template, request, redirect, jsonify, url_for, render_template_string from flask import Flask, render_template, request, redirect, url_for, render_template_string
from flask_compress import Compress from flask_compress import Compress
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.exc import SQLAlchemyError

View File

@@ -45,7 +45,6 @@ import face_recognition
import re import re
import re import re
import sys import sys
import json
import ffmpeg import ffmpeg
import uuid import uuid

View File

@@ -14,7 +14,6 @@ from path import Path, PathType
from job import JobExtra, NewJob from job import JobExtra, NewJob
import os import os
import json
import time import time
from PIL import Image from PIL import Image
import base64 import base64
@@ -68,14 +67,6 @@ class Person(PA,db.Model):
firstname = db.Column(db.String(48), unique=False, nullable=False) firstname = db.Column(db.String(48), unique=False, nullable=False)
refimg = db.relationship('Refimg', secondary=PersonRefimgLink.__table__, order_by=Refimg.id) refimg = db.relationship('Refimg', secondary=PersonRefimgLink.__table__, order_by=Refimg.id)
################################################################################
# Helper class that inherits a .dump() method to turn class Person into json / useful in jinja2
################################################################################
class PersonSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = Person
ordered = True
################################################################################ ################################################################################
# Helper class that defines a form for person, used to make html <form>, with field validation (via wtforms) # Helper class that defines a form for person, used to make html <form>, with field validation (via wtforms)
################################################################################ ################################################################################

View File

@@ -45,16 +45,6 @@ class Settings(db.Model):
def __repr__(self): def __repr__(self):
return f"<id: {self.id}, import_path: {self.import_path}, storage_path: {self.storage_path}, recycle_bin_path: {self.recycle_bin_path}, auto_rotate: {self.auto_rotate}, default_refimg_model: {self.default_refimg_model}, default_scan_model: {self.default_scan_model}, default_threshold: {self.default_threshold}, face_size_limit: {self.face_size_limit}, scheduled_import_scan:{self.scheduled_import_scan}, scheduled_storage_scan: {self.scheduled_storage_scan}, scheduled_bin_cleanup: {self.scheduled_bin_cleanup}, bin_cleanup_file_age: {self.bin_cleanup_file_age}, job_archive_age: {self.job_archive_age}>" return f"<id: {self.id}, import_path: {self.import_path}, storage_path: {self.storage_path}, recycle_bin_path: {self.recycle_bin_path}, auto_rotate: {self.auto_rotate}, default_refimg_model: {self.default_refimg_model}, default_scan_model: {self.default_scan_model}, default_threshold: {self.default_threshold}, face_size_limit: {self.face_size_limit}, scheduled_import_scan:{self.scheduled_import_scan}, scheduled_storage_scan: {self.scheduled_storage_scan}, scheduled_bin_cleanup: {self.scheduled_bin_cleanup}, bin_cleanup_file_age: {self.bin_cleanup_file_age}, job_archive_age: {self.job_archive_age}>"
################################################################################
# Helper class that inherits a .dump() method to turn class Settings into json / useful in jinja2
################################################################################
class SettingsSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = Settings
ordered = True
settings_schema = SettingsSchema(many=True)
################################################################################ ################################################################################
# Helper class that defines a form for Settings, used to make html <form> # Helper class that defines a form for Settings, used to make html <form>
# with field validation (via wtforms) # with field validation (via wtforms)