From caad659d802858af7bcc704a4f1181bb5e117c59 Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Fri, 30 Aug 2019 22:41:03 -0400 Subject: [PATCH] use relative path for file path_entries --- video_metadata/static/style.css | 2 +- video_metadata/templates/file_listing/index.html | 2 +- video_metadata/views/file_listing.py | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/video_metadata/static/style.css b/video_metadata/static/style.css index c2d1725..4aab799 100644 --- a/video_metadata/static/style.css +++ b/video_metadata/static/style.css @@ -18,6 +18,6 @@ nav ul li a, nav ul li span, header .action { display: block; padding: 0.5rem; } input { color: #333; background-color: #eee; } input.danger { color: #cc2f2e; } .debug { background: lightgrey; padding: 1em; overflow: auto; border: 1px solid darkgrey } -.search_result { max-width: 400px; padding: 1em; background: aquamarine; } +.search_result { max-width: 400px; margin-bottom: 1em; padding: 1em; background: lightblue; border: 1px solid blue } .arrow_submit { width: 3em; font-weight: bold; } .content li { list-style: ' - '; } diff --git a/video_metadata/templates/file_listing/index.html b/video_metadata/templates/file_listing/index.html index 6bcbcdd..02f0632 100644 --- a/video_metadata/templates/file_listing/index.html +++ b/video_metadata/templates/file_listing/index.html @@ -14,7 +14,7 @@
{{ path.base_name }} - +
{% endif %} diff --git a/video_metadata/views/file_listing.py b/video_metadata/views/file_listing.py index d0bdba6..f93154e 100644 --- a/video_metadata/views/file_listing.py +++ b/video_metadata/views/file_listing.py @@ -1,4 +1,5 @@ import os +import re import yaml from flask import Blueprint, current_app, render_template @@ -12,7 +13,7 @@ bp = Blueprint('file_listing', __name__) class path_entry: def __init__(self): self.base_name = '' - self.full_path = '' + self.rel_path = '' self.file_extension = '' self.is_dir = False self.depth = 0 @@ -38,14 +39,13 @@ def index(): def getPathInfo(entry, depth=0): if not entry.name.startswith('.') and not entry.is_symlink(): + video_path = current_app.config['MOVIE_DIR'] pe = path_entry() pe.base_name = entry.name - pe.path = entry.path + pe.rel_path = re.sub(video_path, '', entry.path) pe.is_dir = entry.is_dir() pe.depth = depth - # TODO: add relative path for http server root links as 'full_path' - if entry.is_file(): ext = os.path.splitext(entry)[1]