diff --git a/Makefile b/Makefile index cfb11ac84..4ba88fc13 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,9 @@ ZOPFLIPNG = zopflipng OPTIPNG = optipng DOWNLOAD_DRIVE_PNGS = get_png_files_from_drive.py -DRIVE_FOLDER_NAME = Emoji_folder +DRIVE_FOLDER_NAME = Emoji_test_folder +DOWNLOAD_FOLDER = temp_download_folder +DOWNLOAD_REPORTING = --reporting EMOJI_BUILDER = third_party/color_emoji/emoji_builder.py # flag for emoji builder. Default to legacy small metrics for the time being. @@ -41,10 +43,10 @@ ADD_GLYPHS_FLAGS = -a emoji_aliases.txt PUA_ADDER = map_pua_emoji.py VS_ADDER = add_vs_cmap.py # from nototools -ifeq (True, False) - EMOJI_SRC_DIR ?= png/128 -else +ifdef DOWNLOAD_SOURCE EMOJI_SRC_DIR ?= build/combined_png +else + EMOJI_SRC_DIR ?= png/128 endif FLAGS_SRC_DIR := third_party/region-flags/png @@ -155,10 +157,13 @@ ifdef MISSING_ADDER $(error "$(VS_ADDER) not in path, run setup.py in nototools") endif +download_png_source: +ifdef DOWNLOAD_SOURCE + $(PYTHON) $(DOWNLOAD_DRIVE_PNGS) $(DRIVE_FOLDER_NAME) $(DOWNLOAD_FOLDER) $(DOWNLOAD_REPORTING) +endif $(EMOJI_DIR) $(FLAGS_DIR) $(RESIZED_FLAGS_DIR) $(RENAMED_FLAGS_DIR) $(QUANTIZED_DIR) $(COMPRESSED_DIR): - mkdir -p "$@" - + mkdir -p "$@" waveflag: waveflag.c $(CC) $< -o $@ $(CFLAGS) $(LDFLAGS) @@ -222,8 +227,8 @@ endif @rm -f "$@" ttx "$<" -$(EMOJI).ttf: $(EMOJI).tmpl.ttf $(EMOJI_BUILDER) $(PUA_ADDER) \ - $(ALL_COMPRESSED_FILES) | check_vs_adder | download +$(EMOJI).ttf: download_png_source $(EMOJI).tmpl.ttf $(EMOJI_BUILDER) $(PUA_ADDER) \ + $(ALL_COMPRESSED_FILES) | check_vs_adder @$(PYTHON) $(EMOJI_BUILDER) $(SMALL_METRICS) -V $< "$@" "$(COMPRESSED_DIR)/emoji_u" @$(PYTHON) $(PUA_ADDER) "$@" "$@-with-pua" @$(VS_ADDER) -vs 2640 2642 2695 --dstdir '.' -o "$@-with-pua-varsel" "$@-with-pua" @@ -235,11 +240,8 @@ clean: rm -f waveflag rm -rf $(BUILD_DIR) -download: - $(PYTHON) $(DOWNLOAD_DRIVE_PNGS) $(DRIVE_FOLDER_NAME) $(EMOJI_SRC_DIR) - .SECONDARY: $(EMOJI_FILES) $(FLAG_FILES) $(RESIZED_FLAG_FILES) $(RENAMED_FLAG_FILES) \ $(ALL_QUANTIZED_FILES) $(ALL_COMPRESSED_FILES) -.PHONY: clean flags emoji renamed_flags quantized compressed check_compress_tool download +.PHONY: clean flags emoji renamed_flags quantized compressed check_compress_tool diff --git a/get_png_files_from_drive.py b/get_png_files_from_drive.py index e26fdf2ae..75df61028 100644 --- a/get_png_files_from_drive.py +++ b/get_png_files_from_drive.py @@ -38,6 +38,8 @@ def main(folder_name, output_dir, 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: ") + # Get the folder instance folder_id = get_folder_id(service, folder_name) @@ -164,7 +166,7 @@ def download_files(service, file_list, output_dir): while done is False: status, done = downloader.next_chunk() - filelocation = f"downloaded_pngs/{filename}" + filelocation = f"{output_dir}/{filename}" with open(filelocation, "wb") as f: f.write(fh.getbuffer()) @@ -198,7 +200,7 @@ def merge_png_dirs(output_dir): full_file_name = path.join(output_dir, file_name) if path.isfile(full_file_name): shutil.copy(full_file_name, "./build/combined_png") - shutil.rmtree("./downloaded_pngs/") + shutil.rmtree(output_dir) if __name__ == "__main__":