From 0fe9a595b33272b6a2539d1855e4fae9a3e8858d Mon Sep 17 00:00:00 2001 From: Cam Date: Sun, 10 Jan 2021 17:12:22 +1100 Subject: [PATCH] tryin first-pass of file metdata into Photos class --- photos.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/photos.py b/photos.py index 6747419..e0c13ef 100644 --- a/photos.py +++ b/photos.py @@ -23,9 +23,9 @@ class Photos(db.Model): id = db.Column(db.Integer, db.Sequence('photos_id_seq'), primary_key=True ) name = db.Column(db.String, unique=True, nullable=False ) type = db.Column(db.String, unique=False, nullable=False) - size = db.Column(db.Integer, unique=False, nullable=False) + # size = db.Column(db.Integer, unique=False, nullable=False) # hash might not be unique, this could be the source of dupe problems - hash = db.Column(db.Integer, unique=True, nullable=False) + #hash = db.Column(db.Integer, unique=True, nullable=False) def __repr__(self): return "".format(self.id, self.name ) @@ -38,7 +38,6 @@ def photos(): sets = Settings.query.filter(Settings.name=="import_path").all() paths= sets[0].value.split("#") file_list=[] - file_types = {} view_path="" for p in paths: if p.startswith('c:'): @@ -48,14 +47,17 @@ def photos(): file_list.append(glob.glob(view_path + '**', recursive=True)) for file in file_list[0]: if os.path.isdir(file): - file_types[file] = 'Directory' + ftype = 'Directory' elif isImage(file): - file_types[file] = 'Image' + ftype = 'Image' elif isVideo(file): - file_types[file] = 'Video' + ftype = 'Video' else: - file_types[file] = 'File' - print(file_types) + ftype = 'File' + +# fhash=... (file) +# fsize = ... (file) + file_list.append( Photos( name=file, type=ftype )) return render_template("photos.html", page_title='View Photos', view_path=view_path, alert=st.GetAlert(), message=st.GetMessage() )