Skip to content

Commit 9fdb807

Browse files
committed
Use file name if title is empty
Fixes #8
1 parent b1abda6 commit 9fdb807

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

InteractiveHtmlBom/generate_interactive_bom.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,17 @@ def main(pcb, launch_browser=True):
336336
file_mtime = os.path.getmtime(pcb_file_name)
337337
file_date = datetime.fromtimestamp(file_mtime).strftime(
338338
'%Y-%m-%d %H:%M:%S')
339+
title = title_block.GetTitle()
340+
if not title:
341+
title = os.path.basename(pcb_file_name)
342+
# remove .kicad_pcb extension
343+
title = os.path.splitext(title)[0]
339344
pcbdata = {
340345
"edges": parse_edges(pcb),
341346
"silkscreen": parse_silkscreen(pcb),
342347
"modules": parse_modules(pcb),
343348
"metadata": {
344-
"title": title_block.GetTitle(),
349+
"title": title,
345350
"revision": title_block.GetRevision(),
346351
"company": title_block.GetCompany(),
347352
"date": file_date,

0 commit comments

Comments
 (0)