Merge commit 'd7fe57b9d0'
* commit 'd7fe57b9d0':
Adding Cleanup script
Initial commit (not cleaned up)
This commit is contained in:
commit
40a941786a
378 changed files with 4988 additions and 0 deletions
0
.fontfoldercleanup/__init__.py
Normal file
0
.fontfoldercleanup/__init__.py
Normal file
150
.fontfoldercleanup/cleanup.py
Normal file
150
.fontfoldercleanup/cleanup.py
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
import os
|
||||
import time
|
||||
from fileinput import filename
|
||||
|
||||
bad_phrases = [' Free',
|
||||
'TBJ ',
|
||||
' - Zarma Type',
|
||||
' Only',
|
||||
' Personal use',
|
||||
' PERSONAL USE',
|
||||
' SVG',
|
||||
' Free Non-Commercial Use',
|
||||
' Free for Personal Use',
|
||||
' Free for personal use',
|
||||
' Personal Use',
|
||||
' Personl Use Only',
|
||||
' Personl Use',
|
||||
' Free To Try Personal Use Only',
|
||||
' - Personal Use Only',
|
||||
' - DCU',
|
||||
' - Demo',
|
||||
' - Free for Personal Use',
|
||||
' - Free for personal use',
|
||||
' - Free for personal use only',
|
||||
' Demo',
|
||||
' DCU',
|
||||
' To Try',
|
||||
' - Free Personal Use Only',
|
||||
' - Free Personal Use',
|
||||
' - Personal use Only',
|
||||
' -',
|
||||
"'",
|
||||
'Non-Commercial Use',
|
||||
]
|
||||
|
||||
def remove_ds_store_files(path):
|
||||
"""
|
||||
Recursively removes .DS_Store files within the given path.
|
||||
|
||||
Args:
|
||||
path (str): The path to the directory to be checked and cleaned.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
for root, dirs, files in os.walk(path):
|
||||
for file in files:
|
||||
if file == '.DS_Store':
|
||||
file_path = os.path.join(root, file)
|
||||
os.remove(file_path)
|
||||
print(f"Removed .DS_Store file: {file_path}")
|
||||
|
||||
def remove_empty_folders(path):
|
||||
"""
|
||||
Recursively removes empty directories within the given path, except for .git and .env directories and their subdirectories.
|
||||
|
||||
Args:
|
||||
path (str): The path to the directory to be checked and cleaned.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
for root, dirs, files in os.walk(path, topdown=False):
|
||||
for dir in dirs:
|
||||
dir_path = os.path.join(root, dir)
|
||||
if '.git' in dir_path.split(os.sep) or '.env' in dir_path.split(os.sep):
|
||||
continue
|
||||
if not os.listdir(dir_path):
|
||||
os.rmdir(dir_path)
|
||||
print(f"Removed empty folder: {dir_path}")
|
||||
|
||||
# Usage
|
||||
def remove_bad_phrases(path):
|
||||
"""
|
||||
Recursively removes bad phrases from the names of directories at the root of the given path.
|
||||
|
||||
Args:
|
||||
path (str): The path to the directory to be checked and cleaned.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
while True:
|
||||
removed_any = False
|
||||
for root, dirs, files in os.walk(path):
|
||||
for dir in dirs:
|
||||
dir_path = os.path.join(root, dir)
|
||||
for phrase in bad_phrases:
|
||||
if phrase in dir:
|
||||
new_dir = dir.replace(phrase, '')
|
||||
new_dir_path = os.path.join(root, new_dir)
|
||||
os.rename(dir_path, new_dir_path)
|
||||
print(f"Renamed directory: {dir_path} -> {new_dir_path}")
|
||||
removed_any = True
|
||||
break # Exit the loop after renaming to avoid modifying the same directory multiple times
|
||||
if not removed_any:
|
||||
break
|
||||
# time.sleep(1) # Delay to allow the file system to settle
|
||||
|
||||
def collect_orphaned_fonts(path):
|
||||
"""
|
||||
Collects orphaned font files at the root of the given path.
|
||||
|
||||
Args:
|
||||
path (str): The path to the directory to be checked for orphaned font files.
|
||||
|
||||
Returns:
|
||||
list: A list of orphaned font files.
|
||||
"""
|
||||
orphaned_fonts = []
|
||||
for file in os.listdir(path):
|
||||
file_path = os.path.join(path, file)
|
||||
if os.path.isfile(file_path) and (file.endswith('.otf') or file.endswith('.ttf')):
|
||||
# Create a directory for the orphaned font
|
||||
orphan_folder = os.path.join(path, os.path.splitext(file)[0])
|
||||
if not os.path.exists(orphan_folder):
|
||||
os.mkdir(orphan_folder)
|
||||
|
||||
# Move the font file into the new directory
|
||||
new_path = os.path.join(orphan_folder, file)
|
||||
os.rename(file_path, new_path)
|
||||
orphaned_fonts.append(new_path)
|
||||
print(f"Moved {file_path} to {new_path}")
|
||||
|
||||
return orphaned_fonts
|
||||
|
||||
def lowercase_all_the_folders(root_path):
|
||||
"""
|
||||
Lowercases all the folders in the root path.
|
||||
|
||||
Args:
|
||||
root_path (str): The path to the directory to be checked and cleaned.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
for dir in os.listdir(root_path):
|
||||
dir_path = os.path.join(root_path, dir)
|
||||
if os.path.isdir(dir_path):
|
||||
new_dir_path = os.path.join(root_path, dir.lower())
|
||||
os.rename(dir_path, new_dir_path)
|
||||
print(f"Renamed directory: {dir_path} -> {new_dir_path}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
remove_ds_store_files('/Users/fishy/custom_fonts/')
|
||||
remove_empty_folders('/Users/fishy/custom_fonts/')
|
||||
remove_bad_phrases('/Users/fishy/custom_fonts/')
|
||||
collect_orphaned_fonts('/Users/fishy/custom_fonts/')
|
||||
lowercase_all_the_folders('/Users/fishy/custom_fonts/')
|
||||
Binary file not shown.
BIN
AGPX - Personal Use Only/AGPX.otf
Normal file
BIN
AGPX - Personal Use Only/AGPX.otf
Normal file
Binary file not shown.
BIN
Acrylic Hand SVG/Regular Vector Font/AcylicalHand-Thick.ttf
Executable file
BIN
Acrylic Hand SVG/Regular Vector Font/AcylicalHand-Thick.ttf
Executable file
Binary file not shown.
BIN
Acrylic Hand SVG/TomChalky_Desktop_Licensing.pdf
Executable file
BIN
Acrylic Hand SVG/TomChalky_Desktop_Licensing.pdf
Executable file
Binary file not shown.
Binary file not shown.
BIN
Airosol - Personal Use Only/Airosol.otf
Executable file
BIN
Airosol - Personal Use Only/Airosol.otf
Executable file
Binary file not shown.
BIN
AlphaLyrae-Medium.otf
Normal file
BIN
AlphaLyrae-Medium.otf
Normal file
Binary file not shown.
BIN
Angular DCU/- Desktop Commercial Use License - Pixel Surplus.pdf
Normal file
BIN
Angular DCU/- Desktop Commercial Use License - Pixel Surplus.pdf
Normal file
Binary file not shown.
BIN
Angular DCU/ANgular.otf
Normal file
BIN
Angular DCU/ANgular.otf
Normal file
Binary file not shown.
BIN
Arinoe - Zarma Type/Arinoe.otf
Normal file
BIN
Arinoe - Zarma Type/Arinoe.otf
Normal file
Binary file not shown.
BIN
Arinoe - Zarma Type/Arinoe.ttf
Normal file
BIN
Arinoe - Zarma Type/Arinoe.ttf
Normal file
Binary file not shown.
BIN
Benford Demo/Benford DEMO.otf
Executable file
BIN
Benford Demo/Benford DEMO.otf
Executable file
Binary file not shown.
BIN
Benford Demo/Benford DEMO.ttf
Executable file
BIN
Benford Demo/Benford DEMO.ttf
Executable file
Binary file not shown.
Binary file not shown.
BIN
Christmas Picture - Personal Use Only/Christmas Picture.zip
Normal file
BIN
Christmas Picture - Personal Use Only/Christmas Picture.zip
Normal file
Binary file not shown.
Binary file not shown.
BIN
Chrone - Personal Use Only/Chrone Demo - gene type.zip
Normal file
BIN
Chrone - Personal Use Only/Chrone Demo - gene type.zip
Normal file
Binary file not shown.
Binary file not shown.
BIN
Clancy - Personal Use Only/Clancy-Free - firstype studio.zip
Normal file
BIN
Clancy - Personal Use Only/Clancy-Free - firstype studio.zip
Normal file
Binary file not shown.
BIN
Clancy Experience.otf
Normal file
BIN
Clancy Experience.otf
Normal file
Binary file not shown.
Binary file not shown.
BIN
Creamy Dreams - Personal Use Only/Creamy Dreams.otf
Normal file
BIN
Creamy Dreams - Personal Use Only/Creamy Dreams.otf
Normal file
Binary file not shown.
Binary file not shown.
BIN
Cucurucho DCU/Cucurucho.otf
Normal file
BIN
Cucurucho DCU/Cucurucho.otf
Normal file
Binary file not shown.
BIN
DAMN Free /- Free Personal Use License - Pixel Surplus.pdf
Normal file
BIN
DAMN Free /- Free Personal Use License - Pixel Surplus.pdf
Normal file
Binary file not shown.
BIN
DAMN Free /OpenType-PS/DAMN.otf
Normal file
BIN
DAMN Free /OpenType-PS/DAMN.otf
Normal file
Binary file not shown.
BIN
DAMN Free /OpenType-TT/DAMN.ttf
Normal file
BIN
DAMN Free /OpenType-TT/DAMN.ttf
Normal file
Binary file not shown.
Binary file not shown.
BIN
DEPOK CUBISM DCU/DEPOK CUBISM.otf
Normal file
BIN
DEPOK CUBISM DCU/DEPOK CUBISM.otf
Normal file
Binary file not shown.
BIN
DEPOK CUBISM DCU/DEPOK CUBISM.ttf
Normal file
BIN
DEPOK CUBISM DCU/DEPOK CUBISM.ttf
Normal file
Binary file not shown.
BIN
DEPOK CUBISM DCU/Kosmos.otf
Normal file
BIN
DEPOK CUBISM DCU/Kosmos.otf
Normal file
Binary file not shown.
BIN
DK Frozen Memory.otf
Normal file
BIN
DK Frozen Memory.otf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Dirty Clouds - Personal Use Only/Dirty Clouds.otf
Normal file
BIN
Dirty Clouds - Personal Use Only/Dirty Clouds.otf
Normal file
Binary file not shown.
Binary file not shown.
BIN
District DCU/District-Regular.otf
Normal file
BIN
District DCU/District-Regular.otf
Normal file
Binary file not shown.
BIN
District DCU/District.ttf
Normal file
BIN
District DCU/District.ttf
Normal file
Binary file not shown.
Binary file not shown.
BIN
Funky Round DCU/funkyround.otf
Normal file
BIN
Funky Round DCU/funkyround.otf
Normal file
Binary file not shown.
BIN
Funky Round DCU/funkyround_striped.otf
Normal file
BIN
Funky Round DCU/funkyround_striped.otf
Normal file
Binary file not shown.
Binary file not shown.
BIN
Futura 1986 - Free Personal Use/FUTURA1986.otf
Normal file
BIN
Futura 1986 - Free Personal Use/FUTURA1986.otf
Normal file
Binary file not shown.
Binary file not shown.
BIN
Galaxia - Personal Use Only/Galaxia Personal Used - Flava.otf
Normal file
BIN
Galaxia - Personal Use Only/Galaxia Personal Used - Flava.otf
Normal file
Binary file not shown.
BIN
Gyanko Free/- Free Personal Use License - Pixel Surplus.pdf
Normal file
BIN
Gyanko Free/- Free Personal Use License - Pixel Surplus.pdf
Normal file
Binary file not shown.
BIN
Gyanko Free/Gyanko-Regular.otf
Normal file
BIN
Gyanko Free/Gyanko-Regular.otf
Normal file
Binary file not shown.
BIN
Gyanko Free/Gyanko-Stencil.otf
Normal file
BIN
Gyanko Free/Gyanko-Stencil.otf
Normal file
Binary file not shown.
Binary file not shown.
BIN
Horseland - Personal Use Only/Wtf Horseland - was habib.ttf
Normal file
BIN
Horseland - Personal Use Only/Wtf Horseland - was habib.ttf
Normal file
Binary file not shown.
Binary file not shown.
BIN
IDGrotesk - Personal Use Only/IDGrotesk-Trial - Typeface ID.zip
Normal file
BIN
IDGrotesk - Personal Use Only/IDGrotesk-Trial - Typeface ID.zip
Normal file
Binary file not shown.
Binary file not shown.
BIN
JOC - Personal Use/JOC-Fill.otf
Normal file
BIN
JOC - Personal Use/JOC-Fill.otf
Normal file
Binary file not shown.
BIN
JOC - Personal Use/JOC-Line.otf
Normal file
BIN
JOC - Personal Use/JOC-Line.otf
Normal file
Binary file not shown.
BIN
Kompeni Free/- Free Personal Use License - Pixel Surplus.pdf
Normal file
BIN
Kompeni Free/- Free Personal Use License - Pixel Surplus.pdf
Normal file
Binary file not shown.
BIN
Kompeni Free/Kompeni-Regular.ttf
Normal file
BIN
Kompeni Free/Kompeni-Regular.ttf
Normal file
Binary file not shown.
BIN
Latcha - Free Personal Use Only/- Personal Use License.pdf
Normal file
BIN
Latcha - Free Personal Use Only/- Personal Use License.pdf
Normal file
Binary file not shown.
BIN
Latcha - Free Personal Use Only/Latcha-PersonalUseOnly.otf
Normal file
BIN
Latcha - Free Personal Use Only/Latcha-PersonalUseOnly.otf
Normal file
Binary file not shown.
BIN
Lexa.otf
Normal file
BIN
Lexa.otf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
MADE CARVING - Personal Use Only/MADECARVINGPersonalUse-Bold.otf
Normal file
BIN
MADE CARVING - Personal Use Only/MADECARVINGPersonalUse-Bold.otf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
MADE CARVING - Personal Use Only/MADECARVINGPersonalUse-Thin.otf
Normal file
BIN
MADE CARVING - Personal Use Only/MADECARVINGPersonalUse-Thin.otf
Normal file
Binary file not shown.
BIN
MADE INFINITY PERSONAL USE/MADEINFINITY PERSONALUSE-Black.otf
Normal file
BIN
MADE INFINITY PERSONAL USE/MADEINFINITY PERSONALUSE-Black.otf
Normal file
Binary file not shown.
BIN
MADE INFINITY PERSONAL USE/MADEINFINITY PERSONALUSE-Light.otf
Normal file
BIN
MADE INFINITY PERSONAL USE/MADEINFINITY PERSONALUSE-Light.otf
Normal file
Binary file not shown.
BIN
MADE INFINITY PERSONAL USE/MADEINFINITY PERSONALUSE-Medium.otf
Normal file
BIN
MADE INFINITY PERSONAL USE/MADEINFINITY PERSONALUSE-Medium.otf
Normal file
Binary file not shown.
BIN
MADE INFINITY PERSONAL USE/MADEINFINITY PERSONALUSE-Regular.otf
Normal file
BIN
MADE INFINITY PERSONAL USE/MADEINFINITY PERSONALUSE-Regular.otf
Normal file
Binary file not shown.
BIN
MADE INFINITY PERSONAL USE/MADEINFINITY PERSONALUSE-Thin.otf
Normal file
BIN
MADE INFINITY PERSONAL USE/MADEINFINITY PERSONALUSE-Thin.otf
Normal file
Binary file not shown.
Binary file not shown.
BIN
Magic Painted Personal Use Only/Magic Painted.otf
Normal file
BIN
Magic Painted Personal Use Only/Magic Painted.otf
Normal file
Binary file not shown.
Binary file not shown.
BIN
Magnode - Personal Use Only/Magnode Trial Version.otf
Normal file
BIN
Magnode - Personal Use Only/Magnode Trial Version.otf
Normal file
Binary file not shown.
BIN
Magnode - Personal Use Only/Magnode Trial Version.ttf
Normal file
BIN
Magnode - Personal Use Only/Magnode Trial Version.ttf
Normal file
Binary file not shown.
BIN
Magnode - Personal Use Only/xkcd.otf
Normal file
BIN
Magnode - Personal Use Only/xkcd.otf
Normal file
Binary file not shown.
Binary file not shown.
BIN
Morgon SVG - Personal Use Only/Morgon-PersonalUseOnly.otf
Normal file
BIN
Morgon SVG - Personal Use Only/Morgon-PersonalUseOnly.otf
Normal file
Binary file not shown.
Binary file not shown.
BIN
NafasManual - DCU/NafasManualRegular.otf
Normal file
BIN
NafasManual - DCU/NafasManualRegular.otf
Normal file
Binary file not shown.
BIN
NafasManual - DCU/NafasManualRegular.ttf
Normal file
BIN
NafasManual - DCU/NafasManualRegular.ttf
Normal file
Binary file not shown.
BIN
NafasManual - DCU/NafasManualSliced.otf
Normal file
BIN
NafasManual - DCU/NafasManualSliced.otf
Normal file
Binary file not shown.
BIN
NafasManual - DCU/NafasManualSliced.ttf
Normal file
BIN
NafasManual - DCU/NafasManualSliced.ttf
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue