Browse Source

remove slow recursive file listing

master
cinnaboot 7 years ago
parent
commit
7987d3735b
  1. 1
      video_metadata/templates/base.html
  2. 23
      video_metadata/templates/file_listing/index.html
  3. 18
      video_metadata/views/file_listing.py

1
video_metadata/templates/base.html

@ -10,7 +10,6 @@
<h1>pvdb</h1>
<ul>
<li><a href="{{ url_for('index') }}">Home</a>
<li><a href="{{ url_for('file_listing.index') }}">File Listing Slow</a>
<li><a href="{{ url_for('file_listing.getBaseFolderContents') }}">File Listing_Async</a>
<li><a href="{{ url_for('tmdb.query_movie') }}">Query</a>
</ul>

23
video_metadata/templates/file_listing/index.html

@ -1,23 +0,0 @@
{% extends 'base.html' %}
{% block header %}
<h1>{% block title %}File Listing{% endblock %}</h1>
{% endblock %}
{% block content %}
<ul>
{% for path in paths recursive %}
<li>
{% if path.is_dir %}
<span>{{ path.base_name }}</span>
{% else %}
<a href="{{ url_for('tmdb.query_movie', query=path.base_name, rel_path=path.rel_path) }}">
{{ path.base_name }}</a>
{% endif %}
{% if path.contents %}
<ul>{{ loop(path.contents) }}</ul>
{% endif %}
</li>
{% endfor %}
</ul>
{% endblock %}

18
video_metadata/views/file_listing.py

@ -23,24 +23,6 @@ class path_entry:
contents = []
@bp.route('/')
def index():
# construct tree of path_entry objects
video_path = current_app.config['MOVIE_DIR']
paths = []
for entry in os.scandir(video_path):
p = getPathInfo(entry)
if p:
paths.append(p)
return render_template(
'file_listing/index.html',
paths=paths,
debug_str=util.dumpObject(paths)
)
@bp.route('/folder_contents/')
def getBaseFolderContents():
full_path = current_app.config['MOVIE_DIR']

Loading…
Cancel
Save