From f1dbd50b059bd473bf42750e53cb4018ddc44255 Mon Sep 17 00:00:00 2001 From: guidotheelen Date: Mon, 20 Apr 2020 11:51:16 +0200 Subject: [PATCH] redundant vars --- Makefile | 6 ++---- README.md | 6 ++++++ get_png_files_from_drive.py | 7 ++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 4ba88fc13..e81fe9eea 100644 --- a/Makefile +++ b/Makefile @@ -31,8 +31,6 @@ ZOPFLIPNG = zopflipng OPTIPNG = optipng DOWNLOAD_DRIVE_PNGS = get_png_files_from_drive.py -DRIVE_FOLDER_NAME = Emoji_test_folder -DOWNLOAD_FOLDER = temp_download_folder DOWNLOAD_REPORTING = --reporting EMOJI_BUILDER = third_party/color_emoji/emoji_builder.py @@ -158,8 +156,8 @@ ifdef MISSING_ADDER endif download_png_source: -ifdef DOWNLOAD_SOURCE - $(PYTHON) $(DOWNLOAD_DRIVE_PNGS) $(DRIVE_FOLDER_NAME) $(DOWNLOAD_FOLDER) $(DOWNLOAD_REPORTING) +ifdef DOWNLOAD + $(PYTHON) $(DOWNLOAD_DRIVE_PNGS) $(DOWNLOAD) $(DOWNLOAD_REPORTING) endif $(EMOJI_DIR) $(FLAGS_DIR) $(RESIZED_FLAGS_DIR) $(RENAMED_FLAGS_DIR) $(QUANTIZED_DIR) $(COMPRESSED_DIR): diff --git a/README.md b/README.md index 1883dd933..b13ed483f 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,12 @@ especially if you are using zopflipng for compression. Intermediate products (compressed image files, for example) will be put into a build subdirectory; the font will be at the top level. +## Adding external assets + +It is possible to download your emoji artwork automatically from Google Drive. Make sure you got the credentials.json file included in the root of this project. You can get it [here](https://developers.google.com/drive/api/v3/quickstart/python). Click the `Enable Drive API` and make sure you select `Desktop app`. To start the download and the build process run: + + `make DOWNLOAD=“Name_Of_The_Drive_Folder”` + ## Using NotoColorEmoji NotoColorEmoji uses the CBDT/CBLC color font format, which is supported by Android diff --git a/get_png_files_from_drive.py b/get_png_files_from_drive.py index 9859933fb..4b1e5fd38 100644 --- a/get_png_files_from_drive.py +++ b/get_png_files_from_drive.py @@ -31,18 +31,19 @@ from googleapiclient.http import MediaIoBaseDownload SCOPES = ["https://www.googleapis.com/auth/drive"] -def main(folder_name, output_dir, reporting=False): +def main(folder_name="", reporting=False): # Create a token.pickle file to store the users session service = get_service() - folder_name = input("Please enter the name of your drive folder: ") + if folder_name == "": + folder_name = input("Please enter the name of your drive folder: ") # Get the folder instance folder_id = get_folder_id(service, folder_name) # Create output_dir - output_dir = create_dir(output_dir) + output_dir = create_dir("temp_download_folder") # Get the file IDs file_list = get_file_list(service, folder_id)