Skip to content

Commit

Permalink
Updated .RAW image link on main page with .JPG
Browse files Browse the repository at this point in the history
(Assuming one exists. This is if you're shooting in raw+JPG mode)
Partly addresses Issue #77
  • Loading branch information
greiginsydney committed Jun 17, 2021
1 parent ad2a09f commit 1cd7e21
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Raspberry Pi/www/intvlm8r.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,21 @@ def main():
if PI_PHOTO_COUNT >= 1:
FileList.sort(key=lambda x: os.path.getmtime(x))
piLastImage = datetime.utcfromtimestamp(os.path.getmtime(FileList[-1])).replace(microsecond=0)
piLastImageFile = str(FileList[-1]).replace((PI_PHOTO_DIR + "/"), "")
piLastImageFile = str(FileList[-1])
#This code replaces a RAW image on the main page with its .JPG twin - if one exists. (You're shooting in RAW+JPG mode)
if (piLastImageFile.endswith('.CR2') or piLastImageFile.endswith('.NEF')):
piLastImageFileAsJpg = piLastImageFile.replace(".CR2", ".JPG")
piLastImageFileAsJpg = piLastImageFileAsJpg.replace(".NEF", ".JPG")
if os.path.exists(piLastImageFileAsJpg):
piLastImageFile = piLastImageFileAsJpg
else:
pass
#This is where the code to show the thumbnail will go. TODO.
piLastImageFile = piLastImageFile.replace((PI_PHOTO_DIR + "/"), "")
except:
flash('Error talking to the Pi')
PI_PHOTO_COUNT = 0
templateData['piLastImageFile'] = piLastImageFile
templateData['piImageCount'] = PI_PHOTO_COUNT
templateData['piLastImage'] = piLastImage
templateData['piSpaceFree'],piBytesFree = getDiskSpace()
Expand All @@ -391,7 +402,6 @@ def main():
templateData['daysFreeWarn'] = int(getIni('Thresholds', 'daysfreewarn', 'int', '14'))
templateData['daysFreeAlarm'] = int(getIni('Thresholds', 'daysfreealarm', 'int', '7'))

templateData['piLastImageFile'] = piLastImageFile
try:
with open(PI_TRANSFER_FILE, 'r') as f:
for line in reversed(f.read().splitlines()):
Expand Down

0 comments on commit 1cd7e21

Please sign in to comment.