Skip to content

Commit c8d4a04

Browse files
committed
reduce to single string format. Fix long line in example for CircuitPython
1 parent 91969b4 commit c8d4a04

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

adafruit_pycamera/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -827,10 +827,7 @@ def open_next_image(self, extension="jpg", filename_prefix="img"):
827827
except OSError as exc: # no SD card!
828828
raise RuntimeError("No SD card mounted") from exc
829829
while True:
830-
filename = f"/sd/{filename_prefix}%04d.%s" % (
831-
self._image_counter,
832-
extension,
833-
)
830+
filename = f"/sd/{filename_prefix}{self._image_counter}.{extension}"
834831
self._image_counter += 1
835832
try:
836833
os.stat(filename)

examples/timestamp_filename/code.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@
4747
try:
4848
pycam.display_message("snap", color=0x00DD00)
4949
# pylint: disable=line-too-long
50-
timestamp = (
51-
f"img_{time.localtime().tm_year}-{time.localtime().tm_mon}-{time.localtime().tm_mday}"
52-
f"_{time.localtime().tm_hour:02}-{time.localtime().tm_min:02}-{time.localtime().tm_sec:02}_"
53-
)
50+
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}_"
5451
pycam.capture_jpeg(filename_prefix=timestamp)
5552
pycam.live_preview_mode()
5653
except TypeError as exception:

0 commit comments

Comments
 (0)