hollywood =[]
hollywood1 = ["TITTY","ASS","GOOCH","ROBOT","HOVERCRAFT"]
hollywood2 = ["BLASTER","DESTROYER","ACCELERATOR","DETECTIVE","CHEF"]
hollywood3 = ["2","II","3","III","4","IV","V","VI"
,"THE PRE-SEQUEL","THE SEQUEL TO THE SEQUEL","DIRECTORS CUT"
]
hollywood4 = [
,"110% HALAL"
,"THE SEQUEL EVERYBODY WANTED"
,"<#> HIGH SPEED ASS <!> DESTRUCTION"
,"IT CAME FROM THE <@>"
,"KIM JONG UN APPROVED"
]
hwshort1 = ["SUPER","ULTRA","MEGA","HYPER","GIGA","ULTIMATE","TURBO"]
hwshort2 = ["EXPLODING","BLASTING","BLOWING"
,"ANNIHOLATING","DESTRUCTING","INCINERATING"
,"CRUSHING","EXPLODING","SCORCHING"
,"FISTING","TURBO"]
hwshort3 = ["FUTURE","STONE AGE","POSTMODERN"
,"COLD WAR","IRON AGE","PAST"]

# Notably absent is the inclusion of spam tables, except for slices of the hardcoded "Hollywood" table :)
# This is because ButtBlasterPy is intended to fetch JSON data, but does not currently support the feature.
# Soon enough, an update will be ready, and this version will be ready out-the-box in future...

import json, pyautogui, pyperclip, pyperclipimg, random, time, sys, os
BUTTBLASTER_PATH="~/.buttblaster"
if not os.path.isdir(BUTTBLASTER_PATH):
    os.makedirs(BUTTBLASTER_PATH)
string = ""; # string buffer
def str_to_class(classname):
    return getattr(sys.modules[__name__], classname)
def send(spam):
    img=False;

    clip1=pyperclip.paste() #handles clipboard text; if no text, then it should use pyperclipimg instead
    #if clip1==string:
        # todo later; make so if new spam matches previous spam, find the next spam to avoid repetition
    if clip1=="":
        # we should only be here if we have image data in our clipboard, other kinds of data will unfortunately be unhandled and therefore lost :(
        print("Clipboard text is empty, copying image...")
        clip1=pyperclipimg.paste();img=True
    if spam == hollywood:
        str = random.choice(hollywood4)
        subt1 = str.replace("<#>",random.choice(hwshort1))
        subt2 = subt1.replace("<!>",random.choice(hwshort2))
        subt3 = subt2.replace("<@>",random.choice(hwshort3))
        #
        movie = random.choice(hollywood1)+" "+random.choice(hollywood2)+" "+random.choice(hollywood3)+": "+subt3
        pyperclip.copy(movie);print(movie)
    else:
        shitpost = random.choice(spam)
        pyperclip.copy(shitpost)
        #print(shitpost) # uncomment this to see spam output to terminal
    time.sleep(.2) # we pause to allow enough time to avoid conflict with hotkey to activate hotkey

    # soon: modifier to input shift for terminal compatability
    pyautogui.hotkey('ctrl', 'v')
    pyautogui.press('enter')
    buffer = clip1
    if not img:
        pyperclip.copy(clip1)
    else:
        pyperclipimg.copy(clip1)

if len(sys.argv) > 2:
    for i in range(int(sys.argv[2])):
        send(str_to_class(sys.argv[1]))
else:
    send(str_to_class(sys.argv[1]))
