big change to get metadata working fully in DB and on Filesystem, and recover from most common scenarios, improved GUI as well for allowing an immediate search after adding refimg as well
This commit is contained in:
18
settings.py
18
settings.py
@@ -30,6 +30,7 @@ class Settings(db.Model):
|
||||
import_path = db.Column(db.String)
|
||||
storage_path = db.Column(db.String)
|
||||
recycle_bin_path = db.Column(db.String)
|
||||
metadata_path = db.Column(db.String)
|
||||
auto_rotate = db.Column(db.Boolean)
|
||||
default_refimg_model = db.Column(db.Integer,db.ForeignKey('ai_model.id'), unique=True, nullable=False)
|
||||
default_scan_model = db.Column(db.Integer,db.ForeignKey('ai_model.id'), unique=True, nullable=False)
|
||||
@@ -64,6 +65,7 @@ class SettingsForm(FlaskForm):
|
||||
import_path = StringField('Path(s) to import from:', [validators.DataRequired()])
|
||||
storage_path = StringField('Path to store sorted images to:', [validators.DataRequired()])
|
||||
recycle_bin_path = StringField('Path to temporarily store deleted images in:', [validators.DataRequired()])
|
||||
metadata_path = StringField('Path to store metadata to:', [validators.DataRequired()])
|
||||
auto_rotate = BooleanField('Automatically rotate jpegs based on exif', [validators.AnyOf([True, False])])
|
||||
default_refimg_model = SelectField( 'Default model to use for reference images', choices=[(c.id, c.name) for c in AIModel.query.order_by('id')] )
|
||||
default_scan_model = SelectField( 'Default model to use for all scanned images', choices=[(c.id, c.name) for c in AIModel.query.order_by('id')] )
|
||||
@@ -89,6 +91,7 @@ def settings():
|
||||
HELP['import_path']="Path(s) to import files from. If starting with /, then used literally, otherwise base path is prepended"
|
||||
HELP['storage_path']="Path(s) to store sorted files to. If starting with /, then used literally, otherwise base path is prepended"
|
||||
HELP['recycle_bin_path']="Path where deleted files are moved to. If starting with /, then used literally, otherwise base path is prepended"
|
||||
HELP['metadata_path']="Path where metadata (overrides) are stored. If starting with /, then used literally, otherwise base path is prepended"
|
||||
HELP['auto_rotate']="Automatically rotate jpegs based on exif to orient them so that AI matching will work. NOTE: this actually changes/rewrites the file - as it is a simple rotate, it is down without losing quality/content"
|
||||
HELP['default_refimg_model']="Default face recognition model used for reference images - cnn is slower/more accurate, hog is faster/less accurate - we scan (small) refimg once, so cnn is okay"
|
||||
HELP['default_scan_model']="Default face recognition model used for scanned images - cnn is slower/more accurate, hog is faster/less accurate - we scan (large) scanned images lots, so cnn NEEDS gpu/mem"
|
||||
@@ -109,6 +112,7 @@ def settings():
|
||||
s.import_path = request.form['import_path']
|
||||
s.storage_path = request.form['storage_path']
|
||||
s.recycle_bin_path = request.form['recycle_bin_path']
|
||||
s.metadata_path = request.form['metadata_path']
|
||||
if 'auto_rotate' in request.form:
|
||||
s.auto_rotate = True
|
||||
else:
|
||||
@@ -180,3 +184,17 @@ def SettingsIPath():
|
||||
else:
|
||||
paths.append(settings.base_path+p)
|
||||
return paths
|
||||
|
||||
##############################################################################
|
||||
# SettingsMPath(): return path to actual metadata path from settings
|
||||
##############################################################################
|
||||
def SettingsMPath():
|
||||
settings = Settings.query.first()
|
||||
if not settings or settings.metadata_path == "":
|
||||
print ("WARNING: no Settings for metadata path")
|
||||
return
|
||||
p=settings.metadata_path
|
||||
if p[0] == '/':
|
||||
return p
|
||||
else:
|
||||
return settings.base_path+p
|
||||
|
||||
Reference in New Issue
Block a user