diff --git a/src/nerdfonts/download.py b/src/nerdfonts/download.py new file mode 100644 index 0000000..8e2923e --- /dev/null +++ b/src/nerdfonts/download.py @@ -0,0 +1,22 @@ +if __name__ == "__main__": + import os + import sys + sys.path.append(os.path.realpath(os.path.dirname(os.path.realpath(__file__))+"/../")) +import os +import zipfile +import wgetHandler + +link_FontPatcher = "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FontPatcher.zip" + +def downloadPatcher(): + if not os.path.exists("assets"): os.mkdir("assets") + if not os.path.exists("assets/NerdFontPatcher_extract"): + if not os.path.exists("assets/NerdFontPatcher.zip"): + wgetHandler.download(link_FontPatcher,"assets/NerdFontPatcher.zip") + print("Unzipping NerdFontPatcher.zip",end="") + with zipfile.ZipFile("assets/NerdFontPatcher.zip", 'r') as zip_ref: + extractName = zip_ref.extractall("assets/NerdFontPatcher_extract") + print(" [OK]") + return "assets/NanumSquareNeoKr.ttf" + +if __name__ == "__main__": downloadPatcher() diff --git a/src/wgetHandler.py b/src/wgetHandler.py index 20399ca..d081b2d 100644 --- a/src/wgetHandler.py +++ b/src/wgetHandler.py @@ -1,6 +1,7 @@ from .wget import wget import math +# bar 를 커스텀.... 하는 어떤 글에서 가져온거 def bar_custom(current, total, width=80): width=30 avail_dots = width-2 @@ -9,6 +10,7 @@ def bar_custom(current, total, width=80): progress = "%d%% %s [%d / %d]" % (current / total * 100, percent_bar, current, total) return progress +# 그냥 간단한 download 함수인데 좀 프린트를 넣어봤는거? def download(url, fileName): print("Downloading resource to "+fileName+" ...") wget.download(url, fileName, bar=bar_custom)