import tts as tts
import reddit as reddit
import output as output
import time
import html2text
import sys

if len(sys.argv) != 3:
    print("Usage: python3 src <post count> <skip>")
    exit(1)

count = int(sys.argv[1])
skip = int(sys.argv[2])


intro = "This video was generated by the automatic video generation tool built by Evan Pratten."

## Video Start ##
tts.write(intro)
tts.play()

feed = reddit.getRss("prorevenge")["entries"][skip:]
for i in range(count):
    title = reddit.parse(feed[i])["title"]
    body = html2text.html2text(reddit.parse(feed[i])["body"])

    tts.write(title)
    output.writeTitle(title)
    tts.play()

    tts.write(body)
    tts.play()

    output.clearAll()
    time.sleep(1)
