File tree 1 file changed +7
-4
lines changed
examples/timestamp_filename
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 5
5
add timestamp to photo filenames. Must install adafruit_ntp library!"""
6
6
7
7
import time
8
- import adafruit_pycamera # pylint: disable=import-error
9
8
import wifi
10
9
import socketpool
11
- import adafruit_ntp
12
10
import rtc
13
- import time
11
+ import adafruit_ntp
12
+ import adafruit_pycamera # pylint: disable=import-error
14
13
15
14
pool = socketpool .SocketPool (wifi .radio )
16
15
ntp = adafruit_ntp .NTP (pool , tz_offset = 0 )
44
43
pycam .tone (1600 , 0.05 )
45
44
try :
46
45
pycam .display_message ("snap" , color = 0x00DD00 )
47
- timestamp = f"img_{ time .localtime ().tm_year } -{ time .localtime ().tm_mon } -{ time .localtime ().tm_mday } _{ time .localtime ().tm_hour :02} -{ time .localtime ().tm_min :02} -{ time .localtime ().tm_sec :02} _"
46
+ # pylint: disable=line-too-long
47
+ timestamp = (
48
+ f"img_{ time .localtime ().tm_year } -{ time .localtime ().tm_mon } -{ time .localtime ().tm_mday } "
49
+ f"_{ time .localtime ().tm_hour :02} -{ time .localtime ().tm_min :02} -{ time .localtime ().tm_sec :02} _"
50
+ )
48
51
pycam .capture_jpeg (filename_prefix = timestamp )
49
52
pycam .live_preview_mode ()
50
53
except TypeError as exception :
You can’t perform that action at this time.
0 commit comments