old photo publish date for phots that were published somewhere in the past but I don't have an exact date for them

This commit is contained in:
Peter Molnar 2019-03-24 15:26:55 +00:00
parent 5a5723aecc
commit 5c39f7e57a
2 changed files with 19 additions and 1 deletions

19
nasg.py
View file

@ -607,7 +607,15 @@ class Singular(MarkdownDoc):
@property
def published(self):
return arrow.get(self.meta.get('published'))
# ok, so here's a hack: because I have no idea when my older photos
# were actually published, any photo from before 2014 will have
# the EXIF createdate as publish date
pub = arrow.get(self.meta.get('published'))
if self.is_photo:
maybe = arrow.get(self.photo.exif.get('CreateDate'))
if maybe.year < settings.photo.earlyyears:
pub = maybe
return pub
@property
def is_reply(self):
@ -1399,6 +1407,15 @@ class WebImage(object):
logger.info("writing %s", self.fpath)
thumb.save(file=f)
# n, e = os.path.splitext(os.path.basename(self.fpath))
# webppath = self.fpath.replace(e, '.webp')
# with open(webppath, 'wb') as f:
# logger.info("writing %s", webppath)
# thumb.format = 'webp'
# thumb.compression_quality = 88
# thumb.save(file=f)
class PHPFile(object):
@property

View file

@ -169,6 +169,7 @@ photo = struct({
720: '',
1280: '_b',
},
'earlyyears': 2014
})
tmpdir = os.path.join(gettempdir(),'nasg')