summaryrefslogtreecommitdiff
path: root/flask-mediabrowser
diff options
context:
space:
mode:
Diffstat (limited to 'flask-mediabrowser')
-rwxr-xr-xflask-mediabrowser10
1 files changed, 8 insertions, 2 deletions
diff --git a/flask-mediabrowser b/flask-mediabrowser
index d1c0f8a..584d7bb 100755
--- a/flask-mediabrowser
+++ b/flask-mediabrowser
@@ -1,10 +1,11 @@
#!/usr/bin/env python3.4
from flask import Flask
-from werkzeug.contrib.cache import SimpleCache
+from werkzeug.contrib.cache import FileSystemCache
import mediabrowser
import os
+import tempfile
import logging
from argparse import ArgumentParser
@@ -19,7 +20,12 @@ if __name__ == "__main__":
args = parser.parse_args()
- cache = SimpleCache(threshold=5000, default_timeout=60*60*5)
+ 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))