import bugfixes
This commit is contained in:
parent
9823509909
commit
c952471b33
@ -4,6 +4,7 @@ import logging
|
||||
from photoapp.library import PhotoLibrary
|
||||
from photoapp.types import Photo, PhotoSet, Tag, TagItem
|
||||
from jinja2 import Environment, FileSystemLoader, select_autoescape
|
||||
from sqlalchemy import desc
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy import func
|
||||
import math
|
||||
@ -64,9 +65,9 @@ class PhotosWeb(object):
|
||||
images = s.query(func.count(PhotoSet.uuid),
|
||||
func.strftime('%Y', PhotoSet.date).label('year'),
|
||||
func.strftime('%m', PhotoSet.date).label('month')). \
|
||||
group_by('year', 'month').order_by('year', 'month').all()
|
||||
|
||||
yield self.render("monthly.html", images=images)
|
||||
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, tsize=tsize)
|
||||
|
||||
@cherrypy.expose
|
||||
def map(self, i=None, zoom=3):
|
||||
|
@ -71,8 +71,12 @@ def get_exif_data(path):
|
||||
datestr = exif[key]
|
||||
continue
|
||||
|
||||
if datestr is not None:
|
||||
dateinfo = datetime.strptime(datestr, "%Y:%m:%d %H:%M:%S")
|
||||
if datestr:
|
||||
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")
|
||||
if orien:
|
||||
|
@ -3,23 +3,32 @@
|
||||
|
||||
{% include "page-top.html" %}
|
||||
|
||||
<table class="pure-table pure-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>year</th>
|
||||
<th>month</th>
|
||||
<th>count</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for row in images %}
|
||||
{% set locals = namespace() %}
|
||||
|
||||
{% set locals.total_images = 0 %}
|
||||
|
||||
<div>
|
||||
<table class="pure-table pure-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>{{row[1]}}</td>
|
||||
<td>{{row[2]}}</td>
|
||||
<td>{{row[0]}}</td>
|
||||
<th>year</th>
|
||||
<th>month</th>
|
||||
<th>count</th>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% 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" %}
|
||||
|
Loading…
Reference in New Issue
Block a user