Blog Entry
Time Lapse für Symbian S60 3rd/5th Posted on July 30, 2010
Seit geraumer Zeit besitze ich wieder ein Nokia Handy. Das trübe Herbstwetter animierte mich dazu mich etwas genauer mit den Scripting Möglichkeiten zu beschäftigen. Nokia bietet mit PyS60 eine offizielle Python Portierung für Geräte mit Symbian OS an. Die meisten Scripte im Netz funktionieren leider mit der neuen offiziellen Version PyS60 Version nicht mehr :(
Ein interessantes Script das ich gefunden habe ist Time Lapse das ich nun deutlich überarbeitet/erweitert habe damit es auch mit einem neueren Handy läuft. Eine weitere Version ist bereits in Arbeit ;)
# -*- coding: utf-8 -*- #################################### # Python s60 3rd/5th Edition -- Time lapse Photography for Nokia N80 # Code by Anteater -- http://blog.foozia.com # Improved/Modified by Werner Hartnagel # * e32.Ao_timer() Class instead time.sleep # * Use popup_menu instead select_list # * Query device capatilies instead using fixed values # * Create folder for Image Output if it doesn´t exist already import appuifw, e32 import camera import audio import os def prepare_array(arr_in): tmp = [unicode(x) for x in arr_in] return [tmp, [x.replace('_', ' ').title() for x in tmp]] def quit(): app_lock.signal() # Global defaults title = u"Time Lapse" # Change the default path here to a folder on your phone path_out = u'e:\\Images\\timelapse' # Create folder if not exist if not os.path.isdir(path_out): try: os.mkdir(path_out) except: appuifw.note(u"Unable to create Image Folder: %s" % path_out, "info") appuifw.app.title = title # Query the capabilities of your phone imageSizes = [camera.image_sizes(), [u'%dx%d' % (x, y) for x, y in camera.image_sizes()]] flashModes = prepare_array(camera.flash_modes()) exposureModes = prepare_array(camera.exposure_modes()) whiteBalance = prepare_array(camera.white_balance_modes()) # These will show the options available for your phone nameOfProject = appuifw.query(u"Enter a name for this project:", "text") numImages = appuifw.query(u"Enter number of photos:", "number", 4) delay = appuifw.query(u"Enter time between each photo:", "number", 20) imageSizeSelect = appuifw.popup_menu(imageSizes[1], u'Image Size:') flashModeSelect = appuifw.popup_menu(flashModes[1], u'Flash Mode:') exposureModeSelect = appuifw.popup_menu(exposureModes[1], u'Exposure Mode:') whiteBalanceSelect = appuifw.popup_menu(whiteBalance[1], u'White Balance:') x = 0 timer = e32.Ao_timer() while x != numImages: image = camera.take_photo(size=imageSizes[0][imageSizeSelect], flash=flashModes[0][flashModeSelect], exposure=exposureModes[0][exposureModeSelect], white_balance=whiteBalance[0][whiteBalanceSelect]) filename=path_out+'\\'+nameOfProject+'_'+str(x)+'.jpg' print "Image %d/%d taken ....saving" % (x+1, numImages) image.save(filename) print "Image %d/%d saved! ...waiting %d seconds" % (x+1, numImages, delay) timer.after(delay) x +=1 appuifw.note(u"Finished.", "info")
Tags: Python, Nokia, Symbian
| View Comments