diff --git a/helper.py b/helper.py index fa4c52a..35d162f 100644 --- a/helper.py +++ b/helper.py @@ -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 \ No newline at end of file + return 0 + +def format_duration(seconds): + minutes = seconds // 60 + seconds = seconds % 60 + return f"{minutes}:{str(seconds).zfill(2)}" \ No newline at end of file diff --git a/revivetube.py b/revivetube.py index 031c86c..ebfd955 100644 --- a/revivetube.py +++ b/revivetube.py @@ -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")