49 lines
1.1 KiB
Python
49 lines
1.1 KiB
Python
import sys
|
|
import os
|
|
from os import listdir
|
|
from os.path import isfile, join
|
|
|
|
input_path = "./"
|
|
|
|
input_argv = []
|
|
|
|
if len(sys.argv) > 1:
|
|
input_argv = sys.argv[1]
|
|
input_path = input_argv
|
|
|
|
else:
|
|
print("No input path, cwd assumed.")
|
|
|
|
real_path = os.path.dirname(os.path.realpath(input_path))
|
|
|
|
output_array = []
|
|
|
|
def pleromoji(current_path):
|
|
output_path = ""
|
|
output_shortcode = ""
|
|
output_line = ""
|
|
|
|
for f in listdir(current_path):
|
|
if isfile(join(current_path, f)):
|
|
if join(current_path, f)[-4:] == ".png":
|
|
|
|
output_path = os.path.dirname(os.path.realpath(join(current_path, f))).replace(real_path, "") + "/" + f
|
|
output_path = "/emoji" + output_path
|
|
|
|
output_shortcode = f.replace(".png", "")
|
|
|
|
output_line = output_shortcode + ", " + output_path
|
|
|
|
output_array.append(output_line)
|
|
else:
|
|
pleromoji(join(current_path,f))
|
|
|
|
pleromoji(input_path)
|
|
|
|
output_file = open("emoji.txt", "w+")
|
|
|
|
for l in output_array:
|
|
output_file.write(l + "\n")
|
|
print(l)
|
|
|
|
output_file.close()
|