From 62972eff16f701eaeddbeefca21610a317917981 Mon Sep 17 00:00:00 2001 From: Ave Ozkal Date: Mon, 13 May 2019 11:20:03 +0300 Subject: [PATCH] Add blobmoji patches --- README.md | 3 +- patches/blobs/README.md | 9 ++++++ patches/blobs/emojireplace.py | 47 +++++++++++++++++++++++++++++++ patches/customversion/addpatch.py | 4 +++ patchport.py | 3 +- 5 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 patches/blobs/README.md create mode 100644 patches/blobs/emojireplace.py diff --git a/README.md b/README.md index 136836f..1441d53 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,8 @@ Feel free to ignore play protect, it's bullshit. - Get apktool (due to 2 bugs present in v2.3.4, you're strongly recommended to use v2.4.0) - Get a keystore, see [here](https://stackoverflow.com/a/14994354/3286892), step 1. -- If you want Mutant Standard emoji patches, get 72x72 copies of latest version of mutant standard emojis with codepoints. I have a zip [here](https://mutant.lavatech.top/72x72.zip). +- If you want Mutant Standard emoji patches, get 72x72 PNG copies of latest version of mutant standard emojis with codepoints. I have a zip [here](https://mutant.lavatech.top/72x72.zip). +- If you want Blob emoji patches, get 72x72 PNG copies of blobmojis with codepoints. I personally resized the png/128 folder in this [repo](https://github.com/C1710/blobmoji) (`find /home/ave/blobmoji/png/72 -iname '*.png' -exec convert \{\} -verbose -resize 72x72\> \{\} \;`). - Extract the emojis you got somewhere. - Clone this repo somewhere, edit `emojireplace.py` and set the `extracted_mutstd_path` folder to the folder you just extracted emojis to. diff --git a/patches/blobs/README.md b/patches/blobs/README.md new file mode 100644 index 0000000..d3397cf --- /dev/null +++ b/patches/blobs/README.md @@ -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 + diff --git a/patches/blobs/emojireplace.py b/patches/blobs/emojireplace.py new file mode 100644 index 0000000..f98844e --- /dev/null +++ b/patches/blobs/emojireplace.py @@ -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)) diff --git a/patches/customversion/addpatch.py b/patches/customversion/addpatch.py index 66d2688..02f7057 100644 --- a/patches/customversion/addpatch.py +++ b/patches/customversion/addpatch.py @@ -31,6 +31,10 @@ if "mutant" in sys.argv: disclaimers += " | This build uses Mutant Standard"\ " emoji (https://mutant.tech)." +if "blobs" in sys.argv: + disclaimers += " | This build uses Blob"\ + " emoji, licensed SIL OFL, version 1.1." + customtext += ", built on {}@{} at {}{}".format(uname, hostname, timestamp, diff --git a/patchport.py b/patchport.py index f0624c0..c256eff 100644 --- a/patchport.py +++ b/patchport.py @@ -118,7 +118,8 @@ for patch in os.listdir(os.path.join(cutthecord_folder, "patches")): if not os.path.isfile(patch_path) and patch not in ["necessary"]: # Don't warn on instructional patches if patch not in ["customfont", "customring", - "bettertm", "bettertmlight"]: + "bettertm", "bettertmlight", + "blobs"]: print(f"SKIPPED: No {from_versionname} version found for {patch}.") continue