B:BD[
3.359] → [
3.359:472]
B:BD[
3.472] → [
2.1962:2075]
∅:D[
2.2075] → [
3.572:698]
B:BD[
3.572] → [
3.572:698]
B:BD[
3.698] → [
2.2076:2179]
∅:D[
2.2179] → [
3.788:847]
B:BD[
3.788] → [
3.788:847]
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()
self.wfile.write(
bytes("<html><head><title>Emerald's Meme Server</title></head>", "utf-8"))
self.wfile.write(bytes("<p>Request: %s</p>" % self.path, "utf-8"))
self.wfile.write(bytes("<body>", "utf-8"))
self.wfile.write(
bytes("<p>This will send you memes at some point</p>", "utf-8"))
self.wfile.write(bytes("</body></html>", "utf-8"))
parsed_path = urlparse(self.path)
print(parsed_path.path)
if parsed_path.path == "/whathow":
print("Branching to whathow")
q_parts = parse_qs(parsed_path.query)
req = Request(q_parts['image'][0], headers={'User-Agent': 'Mozilla/5.0'})
img_path = f'./tmp/image_{datetime.now().microsecond}'
with open(img_path, mode='xb') as image:
with urlopen(req) as r:
image.write(r.read())
video_path = whathow.gen_video(img_path)
self.send_response(200)
self.send_header("Content-type", "video/mp4")
self.end_headers()
self.wfile.write(
load_bin(video_path))
clean_files([img_path, video_path])
else:
print("dind't branch")
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()
self.wfile.write(
bytes("<html><head><title>Meme server Post Response</title></head>", "utf-8"))
self.wfile.write(bytes("<body>", "utf-8"))
self.wfile.write(
bytes("<p>This will send you memes at some point</p>", "utf-8"))
self.wfile.write(bytes("</body></html>", "utf-8"))