scope 0.4.8__tar.gz → 0.4.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {scope-0.4.8 → scope-0.4.9}/PKG-INFO +1 -1
- {scope-0.4.8 → scope-0.4.9}/scope/__init__.py +1 -1
- {scope-0.4.8 → scope-0.4.9}/viewer/server.py +6 -4
- {scope-0.4.8 → scope-0.4.9}/README.md +0 -0
- {scope-0.4.8 → scope-0.4.9}/requirements.txt +0 -0
- {scope-0.4.8 → scope-0.4.9}/scope/formats.py +0 -0
- {scope-0.4.8 → scope-0.4.9}/scope/reader.py +0 -0
- {scope-0.4.8 → scope-0.4.9}/scope/writer.py +0 -0
- {scope-0.4.8 → scope-0.4.9}/setup.py +0 -0
- {scope-0.4.8 → scope-0.4.9}/tests/test_float.py +0 -0
- {scope-0.4.8 → scope-0.4.9}/tests/test_image.py +0 -0
- {scope-0.4.8 → scope-0.4.9}/tests/test_video.py +0 -0
- {scope-0.4.8 → scope-0.4.9}/viewer/__init__.py +0 -0
- {scope-0.4.8 → scope-0.4.9}/viewer/__main__.py +0 -0
- {scope-0.4.8 → scope-0.4.9}/viewer/config.py +0 -0
- {scope-0.4.8 → scope-0.4.9}/viewer/dist/assets/index-Du-CKEDG.css +0 -0
- {scope-0.4.8 → scope-0.4.9}/viewer/dist/assets/index-m1uYntfT.js +0 -0
- {scope-0.4.8 → scope-0.4.9}/viewer/dist/assets/material-symbols-DplPX30d.woff2 +0 -0
- {scope-0.4.8 → scope-0.4.9}/viewer/dist/favicon.png +0 -0
- {scope-0.4.8 → scope-0.4.9}/viewer/dist/index.html +0 -0
- {scope-0.4.8 → scope-0.4.9}/viewer/dist/logo.png +0 -0
- {scope-0.4.8 → scope-0.4.9}/viewer/filesystems.py +0 -0
|
@@ -25,7 +25,9 @@ fs = dict(
|
|
|
25
25
|
|
|
26
26
|
is_local = isinstance(fs, filesystems.Local)
|
|
27
27
|
if config.cachedir and config.cachesize and not is_local:
|
|
28
|
-
|
|
28
|
+
cachedfs = filesystems.WithFileCache(fs, config.cachedir, config.cachesize)
|
|
29
|
+
else:
|
|
30
|
+
cachedfs = fs
|
|
29
31
|
|
|
30
32
|
|
|
31
33
|
@app.get('/api/exps')
|
|
@@ -81,11 +83,11 @@ def get_file(request: fastapi.Request, fileid: str):
|
|
|
81
83
|
ext = fileid.rsplit('.', 1)[-1]
|
|
82
84
|
path = basedir + '/' + fileid.replace(':', '/')
|
|
83
85
|
if ext == 'txt':
|
|
84
|
-
text =
|
|
86
|
+
text = cachedfs.read(path).decode('utf-8')
|
|
85
87
|
return {'id': fileid, 'text': text}
|
|
86
88
|
elif ext in ('mp4', 'webm'):
|
|
87
|
-
filesize =
|
|
88
|
-
openfn = functools.partial(
|
|
89
|
+
filesize = cachedfs.size(path)
|
|
90
|
+
openfn = functools.partial(cachedfs.open, path)
|
|
89
91
|
content_type = f'video/{ext}'
|
|
90
92
|
return RangeResponse(request, openfn, filesize, content_type)
|
|
91
93
|
else:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|