updated structure a bit.

This commit is contained in:
Matt Troutman 2024-10-02 16:37:20 -05:00
parent 46156f7bdd
commit 358e94cde7
No known key found for this signature in database
7 changed files with 61 additions and 15 deletions

View file

@ -3,6 +3,8 @@ import time
from fileinput import filename
repo_location = '/Users/fishy/custom_fonts'
os.system(f"cd ")
font_location = f'{repo_location}/font_files'
bad_phrases = [' Free',

View file

@ -0,0 +1,51 @@
import os
import subprocess
import sys
def main():
mydir = os.path.dirname(__file__)
# Define the absolute path to the prep script
prep_script = os.path.join(mydir, 'prep 1 font.sh')
# Activate python environment
env_activate = os.path.join(mydir, '.env/bin/activate')
subprocess.run(['source', env_activate], shell=True, check=True)
# Move orphans before we do anything else
orphans_script = os.path.join(mydir, 'orphans.py')
subprocess.run(['python3', orphans_script], check=True)
# Check if the prep script exists
if not os.path.isfile(prep_script):
print(f"Prep script not found: {prep_script}")
sys.exit(1)
# Ensure the prep script is executable
os.chmod(prep_script, 0o755)
# Check if the prep script is executable
if not os.access(prep_script, os.X_OK):
print(f"Prep script not executable: {prep_script}")
sys.exit(1)
# Define the absolute path to the font_files directory
font_files_dir = os.path.join(mydir, 'font_files')
# Check if the font_files directory exists
if not os.path.isdir(font_files_dir):
print(f"font_files directory not found: {font_files_dir}")
sys.exit(1)
# Iterate over each folder in font_files
for folder in os.listdir(font_files_dir):
folder_path = os.path.join(font_files_dir, folder)
if os.path.isdir(folder_path):
os.chdir(folder_path)
subprocess.run(['zsh', prep_script], check=True)
os.chdir('..')
else:
print(f"No such directory: {folder}")
if __name__ == '__main__':
main()

View file

@ -21,8 +21,8 @@ fi
#recursively find all .zip files and unzip them
find . -name '*.zip' -exec unzip {} \;
# Make OTF and TTF folders if they don't exist
mkdir -p OTF TTF "other files"
# Make otf and ttf folders if they don't exist
mkdir -p otf ttf "other files"
# Recurse through all folders and subfolders and move files that are not .ttf or .otf into the "other files" folder
find . -type f -exec mv {} "other files" \;
@ -35,12 +35,12 @@ find . -name '*.ofm' -type f -delete
find . -name '*.cfg' -type f -delete
find . -name '*.zip' -type f -delete
# Recurse through all folders and subfolders and move all .ttf files into the TTF folder
find . -name '*.ttf' -type f -exec mv {} TTF \;
# Recurse through all folders and subfolders and move all .ttc files into the TTF folder
find . -name '*.ttc' -type f -exec mv {} TTF \;
# Recurse through all folders and subfolders and move all .otf files into the OTF folder
find . -name '*.otf' -type f -exec mv {} OTF \;
# Recurse through all folders and subfolders and move all .ttf files into the ttf folder
find . -name '*.ttf' -type f -exec mv {} ttf \;
# Recurse through all folders and subfolders and move all .ttc files into the ttf folder
find . -name '*.ttc' -type f -exec mv {} ttf \;
# Recurse through all folders and subfolders and move all .otf files into the otf folder
find . -name '*.otf' -type f -exec mv {} otf \;
# Recurse through all folders and subfolders and delete all empty folders
find . -type d -empty -delete

View file

@ -1,7 +0,0 @@
#! /bin/bash
mydir=$(dirname "$0")
cd $mydir/font_files
find . -type d -empty -delete
#find . -name '.setup_complete' -type f -delete