Tuesday, January 5, 2010

This involved making the image button function, so that when data was collected and image was taken and not just a video and sound.

def image(self):
self.image_path = "/tmp/tmp" + str(time.time())

IMAGE_GST_PIPE = ['v4l2src', 'ffmpegcolorspace', 'pngenc']
pipe = IMAGE_GST_PIPE + ['filesink location=%s' % (self.image_path)]
self.bus = self.pipe.get_bus()
self.pipe.set_state(gst.STATE_PLAYING)
self.bus.poll(gst.MESSAGE_EOS, -1)

self.file_dsobject = datastore.create()
self.file_dsobject.metadata['title'] = "Image Sample"
self.file_dsobject.metadata['mime_type'] = 'image/png'
self.file_dsobject.set_file_path(self.image_path)
datastore.write(self.file_dsobject)
self.file_dsobject.destroy()

No comments:

Post a Comment