Switched Function to helper.py
This commit is contained in:
parent
91db934f52
commit
67a5584840
@ -29,4 +29,9 @@ def get_video_duration_from_file(video_path):
|
|||||||
return duration
|
return duration
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Can't fetch Video-Duration: {str(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)}"
|
@ -26,7 +26,7 @@ import requests
|
|||||||
import yt_dlp
|
import yt_dlp
|
||||||
from flask import Flask, request, render_template_string, send_file, Response, abort, jsonify
|
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__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@ -234,12 +234,6 @@ def index():
|
|||||||
return render_template_string(INDEX_TEMPLATE, results=results)
|
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"])
|
@app.route("/watch", methods=["GET"])
|
||||||
def watch():
|
def watch():
|
||||||
video_id = request.args.get("video_id")
|
video_id = request.args.get("video_id")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user