videos/sorted

This commit is contained in:
Marc Beninca 2023-01-11 10:02:12 +01:00
parent bf31e8a4c9
commit 47aa5ec591

View file

@ -88,12 +88,16 @@ def main():
} }
content = [] content = []
raw_category = os.path.join(raw_root, category) raw_category = os.path.join(raw_root, category)
videos = {}
for directory, directories, files in os.walk(raw_category): for directory, directories, files in os.walk(raw_category):
for file in files: for file in files:
relative = os.path.relpath(directory, raw_root) relative = os.path.relpath(directory, raw_root)
name, _ = os.path.splitext(file) name, _ = os.path.splitext(file)
raw_file = os.path.join('raw', relative, file) raw_file = os.path.join('raw', relative, file)
web_file = os.path.join('web', relative, f'{name}.mp4') web_file = os.path.join('web', relative, f'{name}.mp4')
videos[name] = [web_file, raw_file]
for name, files in sorted(videos.items()):
web_file, raw_file = files
content.append(card(name, web_file, raw_file)) content.append(card(name, web_file, raw_file))
section['content'] = os.linesep.join(content) section['content'] = os.linesep.join(content)
sections[category] = section sections[category] = section