From 912fe5951d9cfc2010728755be9b1380f45bded7 Mon Sep 17 00:00:00 2001 From: Qwreey Date: Thu, 2 Feb 2023 19:24:35 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=EA=B1=B0=20=EC=95=88=EB=90=98?= =?UTF-8?q?=EB=8A=94=20=EC=9D=B4=EC=9C=A0=EB=A5=BC=20=EC=A2=80=20=EC=95=8C?= =?UTF-8?q?=EB=A0=A4=EC=A3=BC=EC=8B=A4=EB=B6=84=20=EC=B0=BE=EC=95=84?= =?UTF-8?q?=EC=9A=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nerdfonts/download.py | 22 ++++++++++++++++++++++ src/wgetHandler.py | 2 ++ 2 files changed, 24 insertions(+) create mode 100644 src/nerdfonts/download.py 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)