fnic-lemmy / lemmy-directory

A repo for the Lemmy directory
https://lemmy.dbzer0.com/c/lemmydirectory
MIT License
1 stars 0 forks source link

Fix JSON script #47

Closed chris-y closed 6 days ago

chris-y commented 6 days ago

Bombing out with this error:

Animals
Traceback (most recent call last):
  File "/home/runner/work/lemmy-directory/lemmy-directory/directory/./scripts/directory_to_json.py", line 24, in <module>
    communities[current_section][current_subsection].append(match.group(1))
KeyError: 'Wallpapers'
Process completed with exit code 1.
chris-y commented 6 days ago

@M4rtineski I think this must be because you have Animals at the top level with no subsection before the communities start.

It shouldn't have crashed though.

M4rtineski commented 6 days ago

Sure, will add subsection.

chris-y commented 6 days ago

With #33 I can modify it so it takes three header levels, and puts the posts at the right level.

M4rtineski commented 6 days ago

Well, it still failed.

M4rtineski commented 6 days ago

With #33 I can modify it so it takes three header levels, and puts the posts at the right level.

Can you elaborate?

M4rtineski commented 6 days ago

Coz the idea with the new headers is

1. Section

1.1. SubSection

1.1.1. SubSubSection

chris-y commented 6 days ago

Yes, that's correct, I just needed the script to handle it properly - done now.

M4rtineski commented 6 days ago

Epic.