import bugfixes

This commit is contained in:
dave 2018-09-10 21:19:02 -07:00
parent 9823509909
commit c952471b33
3 changed files with 35 additions and 21 deletions

View File

@ -4,6 +4,7 @@ import logging
from photoapp.library import PhotoLibrary from photoapp.library import PhotoLibrary
from photoapp.types import Photo, PhotoSet, Tag, TagItem from photoapp.types import Photo, PhotoSet, Tag, TagItem
from jinja2 import Environment, FileSystemLoader, select_autoescape from jinja2 import Environment, FileSystemLoader, select_autoescape
from sqlalchemy import desc
from sqlalchemy.exc import IntegrityError from sqlalchemy.exc import IntegrityError
from sqlalchemy import func from sqlalchemy import func
import math import math
@ -64,9 +65,9 @@ class PhotosWeb(object):
images = s.query(func.count(PhotoSet.uuid), images = s.query(func.count(PhotoSet.uuid),
func.strftime('%Y', PhotoSet.date).label('year'), func.strftime('%Y', PhotoSet.date).label('year'),
func.strftime('%m', PhotoSet.date).label('month')). \ func.strftime('%m', PhotoSet.date).label('month')). \
group_by('year', 'month').order_by('year', 'month').all() group_by('year', 'month').order_by(desc('year'), desc('month')).all()
tsize = s.query(func.sum(Photo.size)).scalar()
yield self.render("monthly.html", images=images) yield self.render("monthly.html", images=images, tsize=tsize)
@cherrypy.expose @cherrypy.expose
def map(self, i=None, zoom=3): def map(self, i=None, zoom=3):

View File

@ -71,8 +71,12 @@ def get_exif_data(path):
datestr = exif[key] datestr = exif[key]
continue continue
if datestr is not None: if datestr:
dateinfo = datetime.strptime(datestr, "%Y:%m:%d %H:%M:%S") if not datestr.startswith("0000"): # Weed out some known bad cases
try:
dateinfo = datetime.strptime(datestr, "%Y:%m:%d %H:%M:%S")
except ValueError:
dateinfo = datetime.strptime(datestr, "%Y:%m:%d:%H:%M:%S")
orien = exif.get("Orientation") orien = exif.get("Orientation")
if orien: if orien:

View File

@ -3,23 +3,32 @@
{% include "page-top.html" %} {% include "page-top.html" %}
<table class="pure-table pure-table-bordered"> {% set locals = namespace() %}
<thead>
<tr> {% set locals.total_images = 0 %}
<th>year</th>
<th>month</th> <div>
<th>count</th> <table class="pure-table pure-table-bordered">
</tr> <thead>
</thead>
<tbody>
{% for row in images %}
<tr> <tr>
<td>{{row[1]}}</td> <th>year</th>
<td>{{row[2]}}</td> <th>month</th>
<td>{{row[0]}}</td> <th>count</th>
</tr> </tr>
{% endfor %} </thead>
</tbody> <tbody>
</table> {% for row in images %}
<tr>
<td>{{row[1]}}</td>
<td>{{row[2]}}</td>
<td>{{"{:,}".format(row[0])}}{% set locals.total_images = locals.total_images + row[0]|int %}</td>
</tr>
{% endfor %}
</tbody>
</table>
<p>{{ "{:,}".format(locals.total_images) }} Files - {{ tsize | filesizeformat }}</p>
</div>
{% include "page-bottom.html" %} {% include "page-bottom.html" %}