import os from datetime import datetime from urllib.parse import urljoin from discord_embed import settings def generate_html_for_videos(url: str, width: int, height: int, screenshot: str, filename: str) -> str: """Generate HTML for video files. Args: url: URL for the video. This is accessible from the browser. width: This is the width of the video. height: This is the height of the video. screenshot: URL for the screenshot. filename: Original video filename. Returns: Returns HTML for video. """ video_html: str = f"""
""" domain: str = settings.serve_domain html_url: str = urljoin(domain, filename) # Take the filename and append .html to it. filename += ".html" file_path: str = os.path.join(settings.upload_folder, filename) with open(file_path, "w", encoding="utf-8") as f: f.write(video_html) return html_url