Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: delete bcid row
Browse files Browse the repository at this point in the history
flap1 committed May 10, 2024
1 parent e0e896a commit cad6d7f
Showing 3 changed files with 11 additions and 21 deletions.
26 changes: 8 additions & 18 deletions c2a_generator/bct_csv.py
Original file line number Diff line number Diff line change
@@ -12,7 +12,9 @@ def generate(bct_src: list, dest_file_path: Path) -> None:
"""
Comment,Name,ShortName,BCID,エイリアス,,,,,Danger Flag,Description,Note
,,,,Deploy,SetBlockPosition,Clear,Activate,Inactivate,,,
"""[1:]
"""[
1:
]
)
bcid = 0
for src_path, bcid_base in bct_src:
@@ -24,30 +26,18 @@ def generate(bct_src: list, dest_file_path: Path) -> None:
dict_reader = csv.DictReader(src_file, fieldnames=headers)

for row in dict_reader:
row["description"] = (
row["description"].replace(",", "@@").replace("\n", "##")
if row["description"]
else ""
)
row["note"] = (
row["note"].replace(",", "@@").replace("\n", "##")
if row["note"]
else ""
)
row["description"] = row["description"].replace(",", "@@").replace("\n", "##") if row["description"] else ""
row["note"] = row["note"].replace(",", "@@").replace("\n", "##") if row["note"] else ""
if not any(row):
continue
if not row["name"].strip():
continue
# dest_file.write(f",{row['name']},,{bcid},,,,,,,{row['description']},")
dest_file.write(
f",{row['name']},,{row['bcid']},,,,,,,{row['description']},"
)
dest_file.write(f",{row['name']},,{bcid},,,,,,,{row['description']},")
# dest_file.write(f",{row['name']},,{row['bcid']},,,,,,,{row['description']},")
if row["note"]:
dest_file.write(f"{row['note']}")
dest_file.write("\n")
bcid += 1
line_index += 1

dest_file.write(
("," * (dest_line_len - 1) + "\n") * (dest_line_max - line_index)
)
dest_file.write(("," * (dest_line_len - 1) + "\n") * (dest_line_max - line_index))
4 changes: 2 additions & 2 deletions c2a_generator/bct_def_h.py
Original file line number Diff line number Diff line change
@@ -40,8 +40,8 @@ def generate(bct_src: list, dest_path: Path) -> None:
if len(row) > 2 and row["description"]
else ""
)
# header_file.write(f" {row['name']} = {bcid},{comment}\n")
header_file.write(f" {row['name']} = {row['bcid']},{comment}\n")
header_file.write(f" {row['name']} = {bcid},{comment}\n")
# header_file.write(f" {row['name']} = {row['bcid']},{comment}\n")
bcid += 1
header_file.write(
"""
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "c2a_generator"
version = "0.1.1"
version = "0.1.2"
description = "Add your description here"
authors = [
{ name = "flap1", email = "[email protected]" }

0 comments on commit cad6d7f

Please sign in to comment.