Skip to content

Commit

Permalink
fix GD folder download error
Browse files Browse the repository at this point in the history
  • Loading branch information
liao961120 committed Apr 20, 2022
1 parent 9447555 commit 760e26e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: |
sudo timedatectl set-timezone Asia/Taipei
pip install -r requirements.txt
python3 GlossProcessor.py ${{ secrets.GDURL2022 }} 2022
python3 GlossProcessor.py ${{ secrets.GDURLID2022 }} 2022
cp -r 202* archive/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
Expand Down
6 changes: 4 additions & 2 deletions GlossProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,17 @@ def read_with_guessed_encoding(fp: str):


if __name__ == "__main__":
from gdown import download_folder
DOCX_FOLDER_PATH = sys.argv[2] # 2020_Budai_Rukai/
GDRIVE_URL = sys.argv[1]

logging.basicConfig(level=logging.INFO, format='%(message)s', filemode='w', filename=f'{DOCX_FOLDER_PATH.strip("/")}.log')
logging.info(f'{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}\n')

# Download from GDrive
cmd = f'curl gdrive.sh | bash -s {GDRIVE_URL} > curl_download.log'
os.system(cmd)
# cmd = f'curl gdrive.sh | bash -s {GDRIVE_URL} > curl_download.log'
# os.system(cmd)
download_folder(id=GDRIVE_URL)

os.chdir(DOCX_FOLDER_PATH)
DOCX_FOLDER_PATH = pathlib.Path('.')
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
python-docx==0.8.10
chardet==3.0.4
beautifulsoup4==4.9.1
gdown==4.4.0

0 comments on commit 760e26e

Please sign in to comment.