Browse Source

use relative path for file path_entries

master
cinnaboot 7 years ago
parent
commit
caad659d80
  1. 2
      video_metadata/static/style.css
  2. 2
      video_metadata/templates/file_listing/index.html
  3. 8
      video_metadata/views/file_listing.py

2
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: ' - '; }

2
video_metadata/templates/file_listing/index.html

@ -14,7 +14,7 @@
<form action="{{ url_for('tmdb.query_movie') }}" method="post">
<span>{{ path.base_name }}</span>
<input type="hidden" name="base_name" value="{{ path.base_name }}" />
<input type="hidden" name="full_path" value="{{ path.full_path }}" />
<input type="hidden" name="rel_path" value="{{ path.rel_path }}" />
<input class="arrow_submit" type="submit" value="->" />
</form>
{% endif %}

8
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]

Loading…
Cancel
Save