forked from distok/cutthecord
Add blobmoji patches
This commit is contained in:
parent
c240dde4ef
commit
62972eff16
5 changed files with 64 additions and 2 deletions
9
patches/blobs/README.md
Normal file
9
patches/blobs/README.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
## DisTok CutTheCord: Blob Emoji Patch
|
||||
|
||||
This patch replaces emojis with Blob Emojis.
|
||||
|
||||
You'll need to pack in the right images to the apk. See README.md at the root of the repo for more information.
|
||||
|
||||
#### Bugs / Side effects
|
||||
- Not all emojis are replaced
|
||||
|
47
patches/blobs/emojireplace.py
Normal file
47
patches/blobs/emojireplace.py
Normal file
|
@ -0,0 +1,47 @@
|
|||
#!/bin/env python3
|
||||
import os
|
||||
import shutil
|
||||
|
||||
# REPLACE THESE LINES
|
||||
# extracted_discord_path = "/home/ave/Downloads/dic/com.discord-832"
|
||||
# extracted_blobmoji_path = "/home/ave/Downloads/dic/72x72"
|
||||
extracted_discord_path = "/tmp/cutthecord/discord"
|
||||
extracted_blobmoji_path = "/home/ave/blobmoji/png/72"
|
||||
|
||||
|
||||
def clean_emoji_name(name):
|
||||
name = name.lower().replace("_", "-")\
|
||||
.replace("emoji-", "").replace("-fe0f", "")
|
||||
return name
|
||||
|
||||
|
||||
discord_emoji_path = os.path.join(extracted_discord_path, "res", "raw")
|
||||
# Get file listings in relevant folders
|
||||
discord_emojis = os.listdir(discord_emoji_path)
|
||||
blobmojis = os.listdir(extracted_blobmoji_path)
|
||||
|
||||
# Clean names of blobmojis so thar we can compare them
|
||||
# to clean discord emojis later
|
||||
clean_blobmojis = {clean_emoji_name(emoji): emoji for emoji in blobmojis}
|
||||
|
||||
replace_counter = 0
|
||||
|
||||
# Go through each discord emoji, and clean their names
|
||||
for emoji in discord_emojis:
|
||||
clean_discord_emoji = clean_emoji_name(emoji)
|
||||
|
||||
# Check if said clean name of emoji is in clean blobmoji list
|
||||
if clean_discord_emoji in clean_blobmojis:
|
||||
# Get full unclean filename of blobmoji, generate relevant paths
|
||||
full_blobmoji_name = clean_blobmojis[clean_discord_emoji]
|
||||
full_blobmoji_path = os.path.join(extracted_blobmoji_path,
|
||||
full_blobmoji_name)
|
||||
full_discord_path = os.path.join(discord_emoji_path, emoji)
|
||||
|
||||
# Copy and overwrite the discord emojis with the blobmoji alternatives
|
||||
shutil.copyfile(full_blobmoji_path, full_discord_path)
|
||||
|
||||
# print("Replaced {} emoji.".format(emoji))
|
||||
replace_counter += 1
|
||||
|
||||
print("Done, {} emojis replaced.".format(replace_counter))
|
Loading…
Add table
Add a link
Reference in a new issue