made basic newest/oldest week/month/year part of gui actually retreive what we want, and have a title per grouping, but the grouping title is hard-coded for now, will need more data to do a better test, also hacky submit button for now until I decide how to enact the gui change requested
This commit is contained in:
45
files.py
45
files.py
@@ -70,7 +70,6 @@ class File(db.Model):
|
|||||||
__tablename__ = "file"
|
__tablename__ = "file"
|
||||||
eid = db.Column(db.Integer, db.ForeignKey("entry.id"), primary_key=True )
|
eid = db.Column(db.Integer, db.ForeignKey("entry.id"), primary_key=True )
|
||||||
size_mb = db.Column(db.Integer, unique=False, nullable=False)
|
size_mb = db.Column(db.Integer, unique=False, nullable=False)
|
||||||
hash = db.Column(db.Integer, unique=True, nullable=True)
|
|
||||||
thumbnail = db.Column(db.String, unique=False, nullable=True)
|
thumbnail = db.Column(db.String, unique=False, nullable=True)
|
||||||
hash = db.Column(db.Integer)
|
hash = db.Column(db.Integer)
|
||||||
year = db.Column(db.Integer)
|
year = db.Column(db.Integer)
|
||||||
@@ -79,7 +78,7 @@ class File(db.Model):
|
|||||||
woy = db.Column(db.Integer)
|
woy = db.Column(db.Integer)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<eid: {}, size_mb={}, hash={}>".format(self.eid, self.size_mb, self.hash )
|
return f"<eid: {self.eid}, size_mb={self.size_mb}, hash={self.hash}, year={self.year}, month={self.month}, day={self.day}, woy={self.woy}>"
|
||||||
|
|
||||||
class FileType(db.Model):
|
class FileType(db.Model):
|
||||||
__tablename__ = "file_type"
|
__tablename__ = "file_type"
|
||||||
@@ -100,19 +99,41 @@ def file_list():
|
|||||||
################################################################################
|
################################################################################
|
||||||
# /files -> show thumbnail view of files from import_path(s)
|
# /files -> show thumbnail view of files from import_path(s)
|
||||||
################################################################################
|
################################################################################
|
||||||
@app.route("/files", methods=["GET"])
|
@app.route("/files", methods=["GET", "POST"])
|
||||||
def files():
|
def files():
|
||||||
order_by="asc"
|
noo="Oldest"
|
||||||
grouping="day"
|
grouping="Day"
|
||||||
which="week"
|
which="Week"
|
||||||
if which == "week":
|
|
||||||
|
if request.method=="POST":
|
||||||
|
noo=request.form['noo']
|
||||||
|
which=request.form['which']
|
||||||
|
grouping=request.form['grouping']
|
||||||
|
|
||||||
|
print( f"noo={noo}, which={which}, grouping={grouping}")
|
||||||
|
|
||||||
|
entries=[]
|
||||||
|
if noo == "Oldest":
|
||||||
year=File.query.order_by(File.year).first()
|
year=File.query.order_by(File.year).first()
|
||||||
|
month=File.query.filter(File.year==year.year).order_by(File.month).first()
|
||||||
woy=File.query.filter(File.year==year.year).order_by(File.woy).first()
|
woy=File.query.filter(File.year==year.year).order_by(File.woy).first()
|
||||||
if order_by == "desc":
|
if which == "Week":
|
||||||
entries=Entry.query.join(File).filter(File.year==year.year).filter(File.woy==woy.woy).order_by(Entry.name.desc()).all()
|
entries=Entry.query.join(File).filter(File.year==year.year).filter(File.woy==woy.woy).order_by(Entry.name).all()
|
||||||
else:
|
elif which == "month":
|
||||||
entries=Entry.query.join(File).filter(File.year==year.year).filter(File.woy==woy.woy).order_by(Entry.name.desc()).all()
|
entries=Entry.query.join(File).filter(File.year==year.year).filter(File.month==month.month).order_by(Entry.name).all()
|
||||||
return render_template("files.html", page_title='View Files', entry_data=entries )
|
elif which == "Year":
|
||||||
|
entries=Entry.query.join(File).filter(File.year==year.year).order_by(Entry.name).all()
|
||||||
|
else:
|
||||||
|
year=File.query.order_by(File.year.desc()).first()
|
||||||
|
month=File.query.filter(File.year==year.year).order_by(File.month.desc()).first()
|
||||||
|
woy=File.query.filter(File.year==year.year).order_by(File.woy.desc()).first()
|
||||||
|
if which == "Week":
|
||||||
|
entries=Entry.query.join(File).filter(File.year==year.year).filter(File.woy==woy.woy).order_by(Entry.name).all()
|
||||||
|
elif which == "Month":
|
||||||
|
entries=Entry.query.join(File).filter(File.year==year.year).filter(File.month==month.month).order_by(Entry.name).all()
|
||||||
|
elif which == "Year":
|
||||||
|
entries=Entry.query.join(File).filter(File.year==year.year).order_by(Entry.name).all()
|
||||||
|
return render_template("files.html", page_title='View Files', entry_data=entries, grouping=grouping, which=which )
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# /search -> show thumbnail view of files from import_path(s)
|
# /search -> show thumbnail view of files from import_path(s)
|
||||||
|
|||||||
@@ -260,9 +260,9 @@ def ProcessImportDirs(parent_job=None):
|
|||||||
job2.extra.append(jex2)
|
job2.extra.append(jex2)
|
||||||
session.add(job2)
|
session.add(job2)
|
||||||
session.commit()
|
session.commit()
|
||||||
"""
|
|
||||||
if parent_job:
|
if parent_job:
|
||||||
AddLogForJob(parent_job, "adding <a href='/job/{}'>job id={} {}</a> (wait for: {})".format( job2.id, job2.id, job2.name, job2.wait_for ) )
|
AddLogForJob(parent_job, "adding <a href='/job/{}'>job id={} {}</a> (wait for: {})".format( job2.id, job2.id, job2.name, job2.wait_for ) )
|
||||||
|
"""
|
||||||
jex3=JobExtra( name="path", value=path )
|
jex3=JobExtra( name="path", value=path )
|
||||||
job3=Job(start_time=now, last_update=now, name="processai", state="New", wait_for=job2.id, pa_job_state="New", current_file_num=0 )
|
job3=Job(start_time=now, last_update=now, name="processai", state="New", wait_for=job2.id, pa_job_state="New", current_file_num=0 )
|
||||||
job3.extra.append(jex3)
|
job3.extra.append(jex3)
|
||||||
|
|||||||
@@ -2,16 +2,18 @@
|
|||||||
{% block main_content %}
|
{% block main_content %}
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<br>
|
<br>
|
||||||
|
<form method="POST">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="input-group col px-0">
|
<div class="input-group col px-0">
|
||||||
|
<input type="submit">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<button class="btn btn-outline-info disabled" disabled="">Viewing:</button>
|
<button class="btn btn-outline-info disabled" disabled="">Viewing:</button>
|
||||||
</div>
|
</div>
|
||||||
<select style="color:#5bc0de;border:1px solid #5bc0de;" class="form-control form-conrol-info">
|
<select name="noo" style="color:#5bc0de;border:1px solid #5bc0de;" class="form-control form-conrol-info">
|
||||||
<option>Oldest</option>
|
<option>Oldest</option>
|
||||||
<option>Newest</option>
|
<option>Newest</option>
|
||||||
</select>
|
</select>
|
||||||
<select style="color:#5bc0de;border:1px solid #5bc0de;" class="form-control">
|
<select name="which" style="color:#5bc0de;border:1px solid #5bc0de;" class="form-control">
|
||||||
<option>Week</option>
|
<option>Week</option>
|
||||||
<option>Month</option>
|
<option>Month</option>
|
||||||
<option>Year</option>
|
<option>Year</option>
|
||||||
@@ -19,7 +21,7 @@
|
|||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button class="btn btn-outline-info disabled" disabled="">of images, grouped by:</button>
|
<button class="btn btn-outline-info disabled" disabled="">of images, grouped by:</button>
|
||||||
</div>
|
</div>
|
||||||
<select style="color:#5bc0de;border:1px solid #5bc0de;" class="form-control">
|
<select name="grouping" style="color:#5bc0de;border:1px solid #5bc0de;" class="form-control">
|
||||||
<option>Day</option>
|
<option>Day</option>
|
||||||
<option>Week</option>
|
<option>Week</option>
|
||||||
<option>Month</option>
|
<option>Month</option>
|
||||||
@@ -46,9 +48,27 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
<br>
|
<br>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
{% set last = namespace(printed=0) %}
|
||||||
{% for obj in entry_data %}
|
{% for obj in entry_data %}
|
||||||
|
{% if which == "Week" %}
|
||||||
|
{% if last.printed != obj.file_details[0].day %}
|
||||||
|
</div><h6>Day: {{obj.file_details[0].day}} of {{obj.file_details[0].month}}/{{obj.file_details[0].year}}</h6></div><div class="row">
|
||||||
|
{% set last.printed = obj.file_details[0].day %}
|
||||||
|
{% endif %}
|
||||||
|
{% elif which == "Month" %}
|
||||||
|
{% if last.printed != obj.file_details[0].woy %}
|
||||||
|
<h6>Week #: {{obj.file_details[0].woy}} of {{obj.file_details[0].year}}</h6></div><div class="row">
|
||||||
|
{% set last.printed = obj.file_details[0].woy %}
|
||||||
|
{% endif %}
|
||||||
|
{% elif which == "Year" %}
|
||||||
|
{% if last.printed != obj.file_details[0].month %}
|
||||||
|
<h6>Month: {{obj.file_details[0].month}} of {{obj.file_details[0].year}}</h6></div><div class="row">
|
||||||
|
{% set last.printed = obj.file_details[0].month %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
{% if obj.type.name != "Directory" %}
|
{% if obj.type.name != "Directory" %}
|
||||||
<center>
|
<center>
|
||||||
<figure class="figure px-2" font-size: 24px;>
|
<figure class="figure px-2" font-size: 24px;>
|
||||||
|
|||||||
Reference in New Issue
Block a user