def scan_photos(): global cwd response = send_process([ "stdbuf", "-oL", os.path.abspath(os.path.join(cwd, "../main.py")), os.path.abspath(app.config["ALBUM_PATH"]), os.path.abspath(app.config["CACHE_PATH"]) ], os.path.join(cwd, "scanner.pid")) response.headers.add("X-Accel-Buffering", "no") response.cache_control.no_cache = True return response
def render(path): url = request.headers.get("x-se-original-url") if url is None: abort(404) url = urlsplit(url, allow_fragments=False) query = parse_qs(url.query) fragment = "" if "_escaped_fragment_" in query: fragment = "!" + query["_escaped_fragment_"][0] del query["_escaped_fragment_"] url = urlunsplit((url.scheme, url.netloc, url.path, urlencode(query), fragment)) return send_process( ["phantomjs", "--load-images=false", os.path.join(os.path.dirname(os.path.abspath(__file__)), "driver.js"), url] )