File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 44
44
import os
45
45
import random
46
46
import displayio
47
+ import json
47
48
48
49
__version__ = "0.0.0-auto.0"
49
50
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Slideshow.git"
@@ -190,6 +191,15 @@ def __init__(
190
191
h_align = HorizontalAlignment .LEFT ,
191
192
v_align = VerticalAlignment .TOP ,
192
193
):
194
+ def _check_json_file (file ):
195
+ with open (file ) as f :
196
+ try :
197
+ json_data = json .loads (f .read ())
198
+ if "text" in json_data :
199
+ return True
200
+ except ValueError :
201
+ return False
202
+ return False
193
203
self .loop = loop
194
204
"""Specifies whether to loop through the images continuously or play through the list once.
195
205
``True`` will continue to loop, ``False`` will play only once."""
@@ -214,7 +224,7 @@ def __init__(
214
224
self ._file_list = [
215
225
folder + "/" + f
216
226
for f in os .listdir (folder )
217
- if (f .endswith (".bmp" ) and not f .startswith ("." ))
227
+ if (( f .endswith (".bmp" ) or _check_json_file ( folder + "/" + f ) ) and not f .startswith ("." ))
218
228
]
219
229
220
230
self ._order = None
Original file line number Diff line number Diff line change
1
+ {
2
+ "text" : " Sample Text\n Slideshow" ,
3
+ "h_alignment" : " CENTER" ,
4
+ "v_alignment" : " CENTER" ,
5
+ "color" : " 0x0000FF" ,
6
+ "background_color" : " 0xFF00FF"
7
+ }
You can’t perform that action at this time.
0 commit comments