summaryrefslogtreecommitdiff
path: root/flask-mediabrowser
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2016-01-02 15:05:53 +0100
committerYves Fischer <yvesf-git@xapek.org>2016-01-08 20:38:18 +0100
commit478b2feb875e4ef5a458531c0d24f0b2117f5490 (patch)
tree799ff53e65e3992424e190ee4201500a8862eb71 /flask-mediabrowser
parentd63cdea1618f3e493a966ce43fb735b0afc098b6 (diff)
downloadflask-mediabrowser-478b2feb875e4ef5a458531c0d24f0b2117f5490.tar.gz
flask-mediabrowser-478b2feb875e4ef5a458531c0d24f0b2117f5490.zip
better thumbs, better caching (with filesystem)
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))