Merge branch 'master' of 192.168.0.2:photoassistant
This commit is contained in:
18
photos.py
18
photos.py
@@ -23,9 +23,9 @@ class Photos(db.Model):
|
|||||||
id = db.Column(db.Integer, db.Sequence('photos_id_seq'), primary_key=True )
|
id = db.Column(db.Integer, db.Sequence('photos_id_seq'), primary_key=True )
|
||||||
name = db.Column(db.String, unique=True, nullable=False )
|
name = db.Column(db.String, unique=True, nullable=False )
|
||||||
type = db.Column(db.String, unique=False, 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 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):
|
def __repr__(self):
|
||||||
return "<id: {}, name: {}>".format(self.id, self.name )
|
return "<id: {}, name: {}>".format(self.id, self.name )
|
||||||
@@ -38,7 +38,6 @@ def photos():
|
|||||||
sets = Settings.query.filter(Settings.name=="import_path").all()
|
sets = Settings.query.filter(Settings.name=="import_path").all()
|
||||||
paths= sets[0].value.split("#")
|
paths= sets[0].value.split("#")
|
||||||
file_list=[]
|
file_list=[]
|
||||||
file_types = {}
|
|
||||||
view_path=""
|
view_path=""
|
||||||
for p in paths:
|
for p in paths:
|
||||||
if p.startswith('c:'):
|
if p.startswith('c:'):
|
||||||
@@ -48,14 +47,17 @@ def photos():
|
|||||||
file_list.append(glob.glob(view_path + '**', recursive=True))
|
file_list.append(glob.glob(view_path + '**', recursive=True))
|
||||||
for file in file_list[0]:
|
for file in file_list[0]:
|
||||||
if os.path.isdir(file):
|
if os.path.isdir(file):
|
||||||
file_types[file] = 'Directory'
|
ftype = 'Directory'
|
||||||
elif isImage(file):
|
elif isImage(file):
|
||||||
file_types[file] = 'Image'
|
ftype = 'Image'
|
||||||
elif isVideo(file):
|
elif isVideo(file):
|
||||||
file_types[file] = 'Video'
|
ftype = 'Video'
|
||||||
else:
|
else:
|
||||||
file_types[file] = 'File'
|
ftype = 'File'
|
||||||
print(file_types)
|
|
||||||
|
# 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() )
|
return render_template("photos.html", page_title='View Photos', view_path=view_path, alert=st.GetAlert(), message=st.GetMessage() )
|
||||||
return render_template("photos.html", page_title='View Photos', view_path=view_path, file_list=file_list, alert=st.GetAlert(), message=st.GetMessage() )
|
return render_template("photos.html", page_title='View Photos', view_path=view_path, file_list=file_list, alert=st.GetAlert(), message=st.GetMessage() )
|
||||||
|
|||||||
Reference in New Issue
Block a user