- Go here. You must use ANSI Shadow font.
- Type your text and copy it.
- Save it as text file or pass the clipboard directly to script.
Example usage:
xsel -ob | ./volafilememe.py BEEPi
./volafilememe.py "shit room, kys.txt" HF33Go
Example usage:
xsel -ob | ./volafilememe.py BEEPi
./volafilememe.py "shit room, kys.txt" HF33Go
| #!/usr/bin/env python3 | |
| import sys | |
| import os | |
| import re | |
| from tempfile import TemporaryDirectory | |
| from subprocess import run | |
| class FilenameTooLongError(OSError): | |
| pass | |
| def list_duplicates(seq): | |
| seen = set() | |
| seen_add = seen.add | |
| return [idx for idx, item in enumerate(seq) if item in seen or seen_add(item)] | |
| room, memes = [], [] | |
| if sys.stdin.isatty(): | |
| with open(os.path.abspath(sys.argv[1]), "r") as boi: | |
| memes = [l for l in boi.readlines()] | |
| try: | |
| if sys.argv[2]: | |
| room.append("-r") | |
| room.append(sys.argv[2]) | |
| except IndexError: | |
| pass | |
| else: | |
| memes = [l for l in sys.stdin.readlines()] | |
| try: | |
| if sys.argv[1]: | |
| room.append("-r") | |
| room.append(sys.argv[1]) | |
| except IndexError: | |
| pass | |
| for m in memes: | |
| if len(m.encode("utf-8")) > 250: # 255 - 5 bytes for additional filename later | |
| raise FilenameTooLongError( | |
| "Ey boi, max length of lelnix filename is 255" | |
| "bytes, make your text shorter if you want your meme reign supreme." | |
| ) | |
| box = re.compile(r"[\u2500-\u257F]", re.I | re.M) | |
| for i, l in enumerate(memes): | |
| memes[i] = box.sub("░", l).strip().replace(" ", "░") | |
| # remove empty lines | |
| memes = [m for m in memes if m] | |
| # remove double lines and trailing line at the bottom | |
| for i, l in enumerate(memes): | |
| if (l == len(l) * l[0]) and (memes[i + 1] == len(memes[i + 1]) * memes[i + 1][0]): | |
| memes.pop(i) | |
| if memes[-1] == len(memes[-1]) * memes[-1][0]: | |
| memes.pop() | |
| # add some invis character to the end so we can have filenames that are the same | |
| # also dat SO doe: https://stackoverflow.com/a/23645451/8774873 | |
| invis_char = " \u200C" | |
| for idx in list_duplicates(memes): | |
| memes[idx] += invis_char | |
| invis_char = f"{invis_char}\u200C" | |
| with TemporaryDirectory() as d: | |
| meme_files = [] | |
| for i in memes[::-1]: | |
| path = d + "/" + i | |
| try: | |
| with open(path, "w") as nuthing: | |
| pass | |
| except Exception: | |
| print( | |
| "Can't make it dude, are you sure you have ASCII stuff " | |
| "consisting of box drawing characters in your clipboard/file?", | |
| file=sys.stderr, | |
| ) | |
| sys.exit(1) | |
| meme_files.append(path) | |
| run(["volaupload.sh", *room, *meme_files]) |
As of now works again, give it a whirl bois.
Doesn't work as of now. Seems like lain disallows box-drawing characters in filenames now.