-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 5th tone to __add_tone_mark Use other data source for pinyin Remove obsolete corrections Update deck ans source.csv
- Loading branch information
Showing
217 changed files
with
11,830 additions
and
549 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import csv | ||
import os | ||
import urllib.request | ||
|
||
img_list = os.listdir("./media") | ||
downloaded_img = [i[0] for i in img_list] | ||
|
||
|
||
def download_from_website(url, name, appendix): | ||
if url not in downloaded_img: | ||
try: | ||
urllib.request.urlretrieve( | ||
url, f"./media/stroke_order/{name}_{appendix}.svg" | ||
) | ||
except Exception as e: | ||
print(f"can't load IMG {url}") | ||
print(e) | ||
|
||
|
||
if __name__ == "__main__": | ||
url_base = ( | ||
"https://raw.githubusercontent.com/skishore/makemeahanzi/master/svgs-still" | ||
) | ||
with open("./data/source.csv", "r", encoding="UTF8") as csvfile: | ||
reader = csv.reader(csvfile, delimiter="\t") | ||
for row in reader: | ||
char_int = ord(row[0]) | ||
download_from_website( | ||
f"{url_base}/{char_int}-still.svg", row[0], "stroke_order" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.