summaryrefslogtreecommitdiff
path: root/flask-mediabrowser
blob: d1c0f8aacf466973cdb3b9cc8bdf198d20572e4a (plain)
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
#!/usr/bin/env python3.4
from flask import Flask
from werkzeug.contrib.cache import SimpleCache

import mediabrowser

import os
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 = SimpleCache(threshold=5000, default_timeout=60*60*5)
    app = Flask("mediabrowser-demo")
    app.register_blueprint(mediabrowser.build(args.root, cache))

    app.run(debug=True)