{% block body %}
{{ macros.nav_head(page_names, "files") }}
<form method="GET">
-filter: <input name="filter" value="{{filter}}" /><input type="submit" value="filter" />
+filter: <input name="filter" value="{{filter}}" />
+show absent: <input type="checkbox" name="show_absent" {% if show_absent %}checked{% endif %}/>
+<input type="submit" value="filter" />
</form>
-<p>downloaded videos ({{files|length}}):</p>
-<ul>
+<p>known files (shown: {{files|length}}):</p>
+<table>
+<tr><th>present</th><th>path</th></td>
{% for file in files %}
-<li><a href="/{{page_names.file}}/{{file.rel_path_b64}}">{{file.rel_path}}</a>
+<tr>
+<td><input type="checkbox"{% if file.present %} checked{% endif %} disabled/></td>
+<td><a href="/{{page_names.file}}/{{file.rel_path_b64}}">{{file.rel_path}}</a></td>
+</tr>
{% endfor %}
-</ul>
+</table>
{% endblock %}
elif PAGE_NAMES['download'] == page_name:
self._send_or_download_video(YoutubeId(toks_url[2]))
elif PAGE_NAMES['files'] == page_name:
- filter_ = ParamsStr(parse_qs(url.query).get('filter', [''])[0])
- self._send_files_index(filter_)
+ params = parse_qs(url.query)
+ filter_ = ParamsStr(params.get('filter', [''])[0])
+ show_absent = params.get('show_absent', [False])[0]
+ self._send_files_index(filter_, bool(show_absent))
elif PAGE_NAMES['file'] == page_name:
self._send_file_data(B64Str(toks_url[2]))
elif PAGE_NAMES['yt_result'] == page_name:
NAME_TEMPLATE_FILE_DATA,
{'file': file, 'flag_names': list(FILE_FLAGS)})
- def _send_files_index(self, filter_: ParamsStr) -> None:
+ def _send_files_index(self, filter_: ParamsStr, show_absent: bool) -> None:
conn = DbConnection()
- files = [f for f in VideoFile.get_all(conn) if filter_ in f.rel_path]
+ files = [f for f in VideoFile.get_all(conn)
+ if (filter_ in f.rel_path) and (show_absent or f.present)]
conn.commit_close()
files.sort(key=lambda t: t.rel_path)
- self._send_rendered_template(NAME_TEMPLATE_FILES,
- {'files': files, 'filter': filter_})
+ self._send_rendered_template(
+ NAME_TEMPLATE_FILES,
+ {'files': files, 'filter': filter_,
+ 'show_absent': show_absent})
def _send_missing_json(self) -> None:
conn = DbConnection()