This repository was archived by the owner on Feb 24, 2023. It is now read-only.
forked from mpapazog/python-ppt-remote
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpptremoteserver.py
More file actions
56 lines (43 loc) · 1.59 KB
/
pptremoteserver.py
File metadata and controls
56 lines (43 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# This is a script to remote control PowerPoint presentations on macOS from your smartphone.
# Usage:
# * Run pptremoteserver.py on a server accessible from the internet
# * Run pptremoteagent.py on the computer where you have PowerPoint running
# * Open the pptremoteserver's IP address with your smartphone's browser and control the slideshow
#
# Notes:
# * By default pptremoteagent.py polls localhost:8080. To have it poll a different address, run:
# pptremoteagent.py -s <serverip>:<serverport>
# * You will need to install the following Python 3 modules:
# On server: flask
# On agent: keyboard, requests
import sys
from flask import Flask, jsonify, render_template
COMMAND = None
SERVER_PORT = '8080' #modify this to set server to run on a different port
app = Flask(__name__)
app.config['SECRET_KEY'] = 'my-powerpoint-game-is-strong'
@app.route("/", methods=['GET'])
@app.route("/index/", methods=['GET'])
def index():
global COMMAND
return render_template('index.html')
@app.route("/command/")
def command():
global COMMAND
returnvalue = jsonify({'command': COMMAND})
COMMAND = None
return (returnvalue)
@app.route("/setcmdnext/")
def setcmdnext():
global COMMAND
COMMAND = 'next'
return jsonify({'command': COMMAND})
@app.route("/setcmdback/")
def setcmdback():
global COMMAND
COMMAND = 'back'
return jsonify({'command': COMMAND})
def main(argv):
app.run(host='0.0.0.0', port=SERVER_PORT)
if __name__ == '__main__':
main(sys.argv[1:])