-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandWeb.py
More file actions
25 lines (21 loc) · 761 Bytes
/
CommandWeb.py
File metadata and controls
25 lines (21 loc) · 761 Bytes
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
from tornado.ioloop import IOLoop
from tornado.web import RequestHandler, Application, url
import Processor
class MainHandler(RequestHandler):
def get(self):
self.write("ImgLoader")
class DownloadHandler(RequestHandler):
def get(self, url):
processor = Processor.Processor(self.application.settings["folder"])
result = processor.ProcessUrl(url)
for url in result["urls"]:
self.write("%s<br/>" % url)
self.write(result["fullFolder"])
def start(opts):
application = Application([
url(r"/", MainHandler),
url(r"/download/(.*)", DownloadHandler, name="download")
])
application.settings["folder"] = opts.folder;
application.listen(9356)
IOLoop.instance().start()