#!/usr/bin/env python3.4 from flask import Flask from werkzeug.contrib.cache import FileSystemCache import mediabrowser import os import tempfile import logging from argparse import ArgumentParser logging.basicConfig(level=logging.INFO) if __name__ == "__main__": parser = ArgumentParser(description="Flask Mediabrowser") parser.add_argument("--root", metavar="DIR", required=True, help="Media collection root directory") args = parser.parse_args() cache_dir = os.path.join(tempfile.gettempdir(), "mediabrowser-{}".format(os.geteuid())) if not os.path.exists(cache_dir): os.makedirs(cache_dir) # default_timeout=0 doesn't work with FileSystemCache cache = FileSystemCache(cache_dir, default_timeout=9999999999, threshold=5000) app = Flask("mediabrowser-demo") app.register_blueprint(mediabrowser.build(args.root, cache)) app.run(debug=True)