It's ready to share.
This commit is contained in:
parent
7c77f76f05
commit
44ee833a71
2 changed files with 49 additions and 8 deletions
23
README.md
23
README.md
|
@ -1 +1,22 @@
|
|||
Empty readme for commit.
|
||||
# Description
|
||||
Pleromji is a python script designed to help Pleroma instance admins format an emoji.txt for adding custom emojis.
|
||||
I decided to make it when I was trying to add Mutant Standard to my instance and was overwhelmed with adding all the emoji paths to a text file.
|
||||
|
||||
# Usage
|
||||
`python pleromoji.py [path]`
|
||||
|
||||
where [path] is the current path to the directory you wish to run the script on.
|
||||
Or, you can simply omit the path and run:
|
||||
|
||||
`python pleromoji.py`
|
||||
|
||||
if you have the script in the current directory you wish to run the script on.
|
||||
|
||||
The result will be an emoji.txt file saved in the same directory as the script correctly formated.
|
||||
|
||||
# Troubleshooting
|
||||
Idk, maybe you didn't put a directory that has the .png files? I made this cript in like an hour.
|
||||
|
||||
Feel free to hmu if you need help or have suggestions:
|
||||
@shadow8t4@pleroma.werefoxsoftware.com
|
||||
@shadow8t4@cybre.space
|
||||
|
|
34
pleromoji.py
34
pleromoji.py
|
@ -1,13 +1,23 @@
|
|||
import sys
|
||||
import os
|
||||
from os import listdir
|
||||
from os.path import isfile, join
|
||||
|
||||
print("Hello, world!")
|
||||
input_path = "./"
|
||||
|
||||
input_path = "./ms-emoji"
|
||||
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 = ""
|
||||
|
@ -15,15 +25,25 @@ def pleromoji(current_path):
|
|||
|
||||
for f in listdir(current_path):
|
||||
if isfile(join(current_path, f)):
|
||||
output_path = os.path.dirname(os.path.realpath(join(current_path, f))).replace(real_path, "") + "/" + f
|
||||
output_path = "emoji" + output_path
|
||||
if join(current_path, f)[-4:] == ".png":
|
||||
|
||||
output_shortcode = f.replace(".png", "")
|
||||
output_path = os.path.dirname(os.path.realpath(join(current_path, f))).replace(real_path, "") + "/" + f
|
||||
output_path = "emoji" + output_path
|
||||
|
||||
output_line = output_shortcode + ", " + output_path
|
||||
print(output_line)
|
||||
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()
|
||||
|
|
Reference in a new issue