Skip to content

Commit ec5dd13

Browse files
authored
fix: langs parse
1 parent 70c0945 commit ec5dd13

File tree

3 files changed

+31
-12
lines changed

3 files changed

+31
-12
lines changed

.github/workflows/python.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout source
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@v6
1515

1616
- name: Set up Python
17-
uses: actions/setup-python@v5
17+
uses: actions/setup-python@v6
1818
with:
19-
python-version: 3.11
19+
python-version: 3.12
2020

2121
- name: Install Dependencies
2222
run: |
@@ -27,4 +27,5 @@ jobs:
2727
2828
- name: Fetch Files
2929
run: |
30+
bash download.sh
3031
python main.py

download.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
# Download AnimeGameData TextMap archive and extract to raw/langs
4+
URL="https://gitlab.com/Dimbreath/AnimeGameData/-/archive/master/AnimeGameData-master.tar?ref_type=heads&path=TextMap"
5+
OUTPUT_DIR="raw/langs"
6+
7+
# Create output directory if it doesn't exist
8+
mkdir -p "$OUTPUT_DIR"
9+
10+
# Download the tar file
11+
echo "Downloading from $URL..."
12+
curl -L -o temp.tar "$URL"
13+
14+
# Extract to the output directory
15+
echo "Extracting..."
16+
tar -xf temp.tar
17+
18+
# Clean up temporary file
19+
rm -f temp.tar
20+
21+
# move extracted files to the output directory
22+
echo "Moving files to $OUTPUT_DIR..."
23+
mv AnimeGameData-master-TextMap/* "$OUTPUT_DIR/"
24+
25+
echo "Done!"

main.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,20 +120,13 @@ async def main():
120120

121121
await asyncio.sleep(1)
122122

123-
if not SKIP_DOWNLOAD:
124-
langPath = await request(GIT2.format(PATH=f"/projects/{PROJECT_ID}/repository/tree?recursive=true&path={os.getenv('LANG_FOLDER')}"))
125-
for lang in langPath:
126-
await download_json(
127-
url=RAW_GIT2.format(PATH=f"{USERNAME}/{REPOSITORY}/-/raw/{PROJECT_BRANCH}/{lang['path']}"),
128-
filename=lang["name"],
129-
path=os.path.join("raw", "langs")
130-
)
123+
# download langs, moved to download.sh
131124

132125
# Load langs
133126
for lang in os.listdir(os.path.join("raw", "langs")):
134127
if lang.endswith(".json"):
135128
with open(os.path.join("raw", "langs", lang), "r", encoding="utf-8") as f:
136-
_lang = lang.split(".")[0].replace("TextMap", "")
129+
_lang = lang.split(".")[0].replace("TextMap", "").replace("_Medium", "")
137130
_lang_real = _lang.split("_")[0]
138131
LOGGER.debug(f"Loading lang ({_lang}) {_lang_real}...")
139132
_temp_dict = LANGS.get(_lang_real, {})

0 commit comments

Comments
 (0)