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