-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpreviewScript.py
More file actions
50 lines (29 loc) · 857 Bytes
/
previewScript.py
File metadata and controls
50 lines (29 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
import OlympusAir
import os
import datetime
import requests
from OlympusAir import OlympusAir, OlympusAirError, OlympusAirLiveViewFrame
cam = OlympusAir()
cam.commInterface()
cam.switchMode('rec')
cam.setProperty('FOCUS_STILL','FOCUS_SAF')
cam.setProperty('RAW','ON')
cam.setProperty('TAKE_DRIVE','DRIVE_NORMAL')
cam.setProperty('TAKEMODE','P')
cam.setProperty('DESTINATION_FILE','DESTINATION_FILE_MEDIA')
cam.setZoom(20)
dirPath = './' + datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
print '======= ' + dirPath + ' ======='
# os.mkdir(dirPath)
cam.startPreview()
try:
frame = OlympusAirLiveViewFrame()
frame.getLiveViewFrame(cam.lvSocket)
fle = open('liveView.jpg','w')
fle.write(frame.jpegStream)
except:
cam.stopPreview()
cam.disconnect()