Remove types in docstring to reduce clutter
This commit is contained in:
@ -24,14 +24,14 @@ def generate_html_for_videos(
|
||||
"""Generate HTML for video files.
|
||||
|
||||
Args:
|
||||
url (str): URL for the video. This is accessible from the browser.
|
||||
width (int): This is the width of the video.
|
||||
height (int): This is the height of the video.
|
||||
screenshot (str): URL for screenshot.
|
||||
filename (str): Original video filename.
|
||||
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 screenshot.
|
||||
filename: Original video filename.
|
||||
|
||||
Returns:
|
||||
str: Returns HTML for video.
|
||||
Returns HTML for video.
|
||||
"""
|
||||
video_html = f"""
|
||||
<!DOCTYPE html>
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""Our site has one POST endpoint for uploading videos and one GET
|
||||
endpoint for getting the HTML. Images are served from a webserver."""
|
||||
endpoint for getting the HTML. Images are served from a web server."""
|
||||
from typing import Dict
|
||||
from urllib.parse import urljoin
|
||||
|
||||
@ -40,11 +40,10 @@ async def upload_file(file: UploadFile = File(...)) -> Dict[str, str]:
|
||||
If something goes wrong, we will send a message to Discord.
|
||||
|
||||
Args:
|
||||
file (UploadFile): Our uploaded file.
|
||||
file: Our uploaded file.
|
||||
|
||||
Returns:
|
||||
Dict[str, str]: Returns a dict with the filename or a link to
|
||||
the .html if it was a video.
|
||||
Returns a dict with the filename or a link to the .html if it was a video.
|
||||
"""
|
||||
domain_url = ""
|
||||
if file.content_type.startswith("video/"):
|
||||
|
@ -10,10 +10,10 @@ def video_resolution(path_to_video: str) -> tuple[int, int]:
|
||||
"""Find video resolution.
|
||||
|
||||
Args:
|
||||
path_to_video (str): Path to video file.
|
||||
path_to_video: Path to video file.
|
||||
|
||||
Returns:
|
||||
tuple[int, int]: Returns height and width.
|
||||
Returns height and width.
|
||||
"""
|
||||
probe = ffmpeg.probe(path_to_video)
|
||||
video_stream = next((stream for stream in probe["streams"] if stream["codec_type"] == "video"), None)
|
||||
@ -31,11 +31,11 @@ def make_thumbnail(path_video: str, file_filename: str) -> str:
|
||||
"""Make thumbnail for Discord. This is a screenshot of the video.
|
||||
|
||||
Args:
|
||||
path_video (str): Path where video file is stored.
|
||||
file_filename (str): File name for URL.
|
||||
path_video: Path where video file is stored.
|
||||
file_filename: File name for URL.
|
||||
|
||||
Returns:
|
||||
str: Returns thumbnail filename.
|
||||
Returns thumbnail filename.
|
||||
"""
|
||||
(
|
||||
ffmpeg.input(path_video, ss="1")
|
||||
|
@ -17,10 +17,10 @@ def save_to_disk(file: UploadFile) -> tuple[str, str]:
|
||||
If spaces in filename, replace with dots.
|
||||
|
||||
Args:
|
||||
file (UploadFile): Our file object.
|
||||
file: Our uploaded file.
|
||||
|
||||
Returns:
|
||||
tuple[str, str]: Returns filename and file location.
|
||||
Returns filename and file location.
|
||||
"""
|
||||
# Create folder if it doesn't exist.
|
||||
folder_video = os.path.join(settings.upload_folder, "video")
|
||||
@ -41,10 +41,10 @@ async def do_things(file: UploadFile) -> Dict[str, str]:
|
||||
"""Save video to disk, generate HTML, thumbnail, and return a .html URL.
|
||||
|
||||
Args:
|
||||
file (UploadFile): Our file object.
|
||||
file: Our uploaded file.
|
||||
|
||||
Returns:
|
||||
Dict[str, str]: Returns URL for video.
|
||||
Returns URL for video.
|
||||
"""
|
||||
filename, file_location = save_to_disk(file)
|
||||
|
||||
|
@ -8,7 +8,7 @@ def send_webhook(message: str) -> None:
|
||||
"""Send webhook to Discord.
|
||||
|
||||
Args:
|
||||
message (str): The message to send.
|
||||
message: The message to send.
|
||||
"""
|
||||
webhook = DiscordWebhook(
|
||||
url=settings.webhook_url,
|
||||
|
Reference in New Issue
Block a user