Skip to content

Commit

Permalink
Save new picture type records
Browse files Browse the repository at this point in the history
  • Loading branch information
efloehr committed Feb 4, 2015
1 parent 07c6655 commit 696c462
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions image/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,13 @@ def match_image(cls, image_info, normal_entry=None, rejected_normal=None):
class Product(models.Model):
ALLNIGHT = 1
ALLNIGHT_NEG = 2
DAYSTRIP = 3
DAYSTRIP_PIC = 4
KINDS = (
(ALLNIGHT, "All-night overlay image"),
(ALLNIGHT_NEG, "All-night overlay image negative"),
(DAYSTRIP, "Classic daystrip"),
(DAYSTRIP_PIC, "Daystrip that goes from left to right and is each column in the image"),
)

# Metadata
Expand Down
14 changes: 10 additions & 4 deletions image/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ def make_daystrip(day):
img.paste(picture.crop((0,400,2048,401)),(0,row))

imagepath = os.path.join(TIMELAPSE_DIR, APP_DIR, 'daystrip')
img.save(os.path.join(imagepath, '{0}.png'.format(dayname)))
filename = '{0}.png'.format(dayname)
img_filepath = os.path.join(imagepath, filename)
img.save(img_filepath)
image_record = get_image_product(day_start, day_start, day_end, Product.DAYSTRIP, imagepath, filename)
record_size(img_filepath, image_record)


@task()
Expand Down Expand Up @@ -142,6 +146,8 @@ def make_daystrip_picture(day):
img.paste(picture.crop((column,0,column+1,1536)),(column,0))

imagepath = os.path.join(TIMELAPSE_DIR, APP_DIR, 'daypic')
img.save(os.path.join(imagepath, '{0}.png'.format(dayname)))


filename = '{0}.png'.format(dayname)
img_filepath = os.path.join(imagepath, filename)
img.save(img_filepath)
image_record = get_image_product(day_start, day_start, day_end, Product.DAYSTRIP, imagepath, filename)
record_size(img_filepath, image_record)

0 comments on commit 696c462

Please sign in to comment.