Switched Function to helper.py

This commit is contained in:
rmilooo 2025-01-01 22:21:47 +01:00
parent 91db934f52
commit 67a5584840
2 changed files with 7 additions and 8 deletions

View File

@ -29,4 +29,9 @@ def get_video_duration_from_file(video_path):
return duration
except Exception as e:
print(f"Can't fetch Video-Duration: {str(e)}")
return 0
return 0
def format_duration(seconds):
minutes = seconds // 60
seconds = seconds % 60
return f"{minutes}:{str(seconds).zfill(2)}"

View File

@ -26,7 +26,7 @@ import requests
import yt_dlp
from flask import Flask, request, render_template_string, send_file, Response, abort, jsonify
from helper import read_file, get_video_duration_from_file
from helper import read_file, get_video_duration_from_file, format_duration
app = Flask(__name__)
@ -234,12 +234,6 @@ def index():
return render_template_string(INDEX_TEMPLATE, results=results)
def format_duration(seconds):
minutes = seconds // 60
seconds = seconds % 60
return f"{minutes}:{str(seconds).zfill(2)}"
@app.route("/watch", methods=["GET"])
def watch():
video_id = request.args.get("video_id")