chrisjrn / kaas Goto Github PK
View Code? Open in Web Editor NEWKeynote-as-a-Service: HTTP control for Keynote Presenters
Keynote-as-a-Service: HTTP control for Keynote Presenters
Potential improvement due to @parisba:
'if it was a filesystem action then it could just launch itself when keynote was running and close itself otherwise'
I run the server as writen in README, but it firstly had problem with some permissons issues in my /Applications folder (it is issue, but it should not stop kaas):
Bobik-MacBook-Pro-2:kaas Bobik$ ./remote_server.py
Traceback (most recent call last):
File "./remote_server.py", line 31, in <module>
import remote_handler
File "/Users/Bobik/Applications/kaas/kaas/remote_handler.py", line 17, in <module>
import keynote_script
File "/Users/Bobik/Applications/kaas/kaas/keynote_script.py", line 204, in <module>
INSTALLED_VERSIONS = __scan_for_apps__()
File "/Users/Bobik/Applications/kaas/kaas/keynote_script.py", line 185, in __scan_for_apps__
candidates = walk_selective("/Applications", [])
File "/Users/Bobik/Applications/kaas/kaas/keynote_script.py", line 183, in walk_selective
walk_selective(ff, found)
File "/Users/Bobik/Applications/kaas/kaas/keynote_script.py", line 183, in walk_selective
walk_selective(ff, found)
File "/Users/Bobik/Applications/kaas/kaas/keynote_script.py", line 174, in walk_selective
files = os.listdir(dir)
OSError: [Errno 13] Permission denied: '/Applications/Hry/Prehistorik 2.boxer'
I repaired permission in this folder and run server again. It wrote this errors (web service is not accessible):
Bobik-MacBook-Pro-2:kaas Bobik$ ./remote_server.py
Generating export from frontmost keynote slideshow...
/Users/Bobik/Applications/kaas/kaas/slideshow.py:204: RuntimeWarning: tmpnam is a potential security risk to your program
out_dir = os.tmpnam()
Output: /var/tmp/tmp.0.t28hkB
Keynote version: 6.5
Generating build previews...
Starting server...
Now serving on: http://192.168.0.15:8000
The PIN number is: 431331
----------------------------------------
Exception happened during processing of request from ('192.168.0.15', 53865)
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 283, in _handle_request_noblock
self.process_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 309, in process_request
self.finish_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 322, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 617, in __init__
self.handle()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 329, in handle
self.handle_one_request()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 323, in handle_one_request
method()
File "./remote_server.py", line 68, in do_GET
if not self.authenticate():
File "./remote_server.py", line 115, in authenticate
nonce = self.headers["X-Kaas-Nonce"]
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/rfc822.py", line 388, in __getitem__
return self.dict[name.lower()]
KeyError: 'x-kaas-nonce'
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('192.168.0.15', 53866)
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 283, in _handle_request_noblock
self.process_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 309, in process_request
self.finish_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 322, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 617, in __init__
self.handle()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 329, in handle
self.handle_one_request()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 323, in handle_one_request
method()
File "./remote_server.py", line 68, in do_GET
if not self.authenticate():
File "./remote_server.py", line 115, in authenticate
nonce = self.headers["X-Kaas-Nonce"]
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/rfc822.py", line 388, in __getitem__
return self.dict[name.lower()]
KeyError: 'x-kaas-nonce'
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('192.168.0.15', 53867)
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 283, in _handle_request_noblock
self.process_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 309, in process_request
self.finish_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 322, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 617, in __init__
self.handle()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 329, in handle
self.handle_one_request()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 323, in handle_one_request
method()
File "./remote_server.py", line 68, in do_GET
if not self.authenticate():
File "./remote_server.py", line 115, in authenticate
nonce = self.headers["X-Kaas-Nonce"]
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/rfc822.py", line 388, in __getitem__
return self.dict[name.lower()]
KeyError: 'x-kaas-nonce'
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('192.168.0.15', 53877)
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 283, in _handle_request_noblock
self.process_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 309, in process_request
self.finish_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 322, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 617, in __init__
self.handle()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 329, in handle
self.handle_one_request()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 323, in handle_one_request
method()
File "./remote_server.py", line 68, in do_GET
if not self.authenticate():
File "./remote_server.py", line 115, in authenticate
nonce = self.headers["X-Kaas-Nonce"]
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/rfc822.py", line 388, in __getitem__
return self.dict[name.lower()]
KeyError: 'x-kaas-nonce'
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('192.168.0.15', 53878)
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 283, in _handle_request_noblock
self.process_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 309, in process_request
self.finish_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 322, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 617, in __init__
self.handle()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 329, in handle
self.handle_one_request()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 323, in handle_one_request
method()
File "./remote_server.py", line 68, in do_GET
if not self.authenticate():
File "./remote_server.py", line 115, in authenticate
nonce = self.headers["X-Kaas-Nonce"]
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/rfc822.py", line 388, in __getitem__
return self.dict[name.lower()]
KeyError: 'x-kaas-nonce'
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('192.168.0.15', 53879)
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 283, in _handle_request_noblock
self.process_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 309, in process_request
self.finish_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 322, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 617, in __init__
self.handle()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 329, in handle
self.handle_one_request()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 323, in handle_one_request
method()
File "./remote_server.py", line 68, in do_GET
if not self.authenticate():
File "./remote_server.py", line 115, in authenticate
nonce = self.headers["X-Kaas-Nonce"]
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/rfc822.py", line 388, in __getitem__
return self.dict[name.lower()]
KeyError: 'x-kaas-nonce'
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('192.168.0.15', 53901)
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 283, in _handle_request_noblock
self.process_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 309, in process_request
self.finish_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 322, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 617, in __init__
self.handle()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 329, in handle
self.handle_one_request()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 323, in handle_one_request
method()
File "./remote_server.py", line 68, in do_GET
if not self.authenticate():
File "./remote_server.py", line 115, in authenticate
nonce = self.headers["X-Kaas-Nonce"]
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/rfc822.py", line 388, in __getitem__
return self.dict[name.lower()]
KeyError: 'x-kaas-nonce'
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('192.168.0.15', 53902)
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 283, in _handle_request_noblock
self.process_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 309, in process_request
self.finish_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 322, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 617, in __init__
self.handle()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 329, in handle
self.handle_one_request()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 323, in handle_one_request
method()
File "./remote_server.py", line 68, in do_GET
if not self.authenticate():
File "./remote_server.py", line 115, in authenticate
nonce = self.headers["X-Kaas-Nonce"]
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/rfc822.py", line 388, in __getitem__
return self.dict[name.lower()]
KeyError: 'x-kaas-nonce'
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('192.168.0.15', 53903)
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 283, in _handle_request_noblock
self.process_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 309, in process_request
self.finish_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 322, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 617, in __init__
self.handle()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 329, in handle
self.handle_one_request()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 323, in handle_one_request
method()
File "./remote_server.py", line 68, in do_GET
if not self.authenticate():
File "./remote_server.py", line 115, in authenticate
nonce = self.headers["X-Kaas-Nonce"]
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/rfc822.py", line 388, in __getitem__
return self.dict[name.lower()]
KeyError: 'x-kaas-nonce'
----------------------------------------
Keynote 6 removes AppleScript support for determining which slide is currently visible in the slide show. This means the server is unable to present the current slide via the API.
This needs a short-term workaround (use KAAS as the source of truth instead of Keynote for now?); and a long-term fix from Apple.
Use HMAC authentication to guarantee that all requests originate from an authorised device.
Advertise the existence of the KAAS server using Bonjour.
Looks like the 'dns-sd' command line util might work up-front on OS X.
See http://stackoverflow.com/questions/1916017/simplest-way-to-publish-over-zeroconf-bonjour
Keynote 6 now has an AppleScript API. It is largely similar to Keynote 5's; exports seems to have some minor syntactic changes.
Version of a given app can be found by using applescript
tell application "foo" to version
This returns the version code of foo. A path to a specific app bundle can be provided where foo
is.
K6 installation puts K5.x into a separate location on the filesystem.
Behaviour should be:
I got a execution error with the following traceback:
123:130: execution error: The variable Classic is not defined. (-2753)
Traceback (most recent call last):
File "remote_server.py", line 215, in <module>
main()
File "remote_server.py", line 199, in main
set_show()
File "remote_server.py", line 161, in set_show
STATE.show = slideshow.generate()
File "/Users/nikriek/Downloads/kaas-master/kaas/slideshow.py", line 199, in generate
return Slideshow(keynote_script.APPLICATION_VERSION, path, out_dir)
File "/Users/nikriek/Downloads/kaas-master/kaas/slideshow.py", line 35, in __init__
self.__kpf__ = kpfutil_v6.KpfV6(kpfdir)
File "/Users/nikriek/Downloads/kaas-master/kaas/kpfutil_v6.py", line 63, in __init__
self.generate_notes()
File "/Users/nikriek/Downloads/kaas-master/kaas/kpfutil_v6.py", line 109, in generate_notes
keynote_script.export_classic(f)
File "/Users/nikriek/Downloads/kaas-master/kaas/keynote_script.py", line 95, in export_classic
return __execute__(command)
File "/Users/nikriek/Downloads/kaas-master/kaas/keynote_script.py", line 125, in __execute__
return __execute_with_app__(INSTALLED_VERSIONS[APPLICATION_VERSION], command)
File "/Users/nikriek/Downloads/kaas-master/kaas/keynote_script.py", line 131, in __execute_with_app__
return check_output(["osascript", "-e", to_run]).strip()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 575, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['osascript', '-e', 'tell application "/Applications/Keynote.app" to export front document to POSIX file "/var/tmp/tmp.0.guJaCa/classic.key" as Classic']' returned non-zero exit status 1
Any ideas why? I'm not that python-experienced to fix it myself… Maybe it has something to do with recent API changes in Keynote?!
Due to @parisba
'you should send the passcode to authenticate via notification center'
There are tho other forks. I think it will be better to collaborate on maintaining of just one project. Don't you think?
@BobertForever @lgleasain
It looks like the KPF assets in Keynote 6.2 are stored in a PDF file. This may need some work to disentangle.
Should do some caching of assets in case we've already got an NSImage of them somewhere.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.