Created
January 3, 2019 16:06
-
-
Save lucasgautheron/4a55e21fb0d7dcb05e076889599a740b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'params.php'; | |
$presets = list_presets(); | |
if (!empty($_POST['script']) && !empty($_POST['url'])) { | |
$url = $_POST['url']; | |
$id = basename(youtube_url_to_id($url)); | |
$url = escapeshellarg($url); | |
file_put_contents("data/{$id}_script.txt", $_POST['script']); | |
exec('python3 -m aeneas.tools.execute_task ' . $url . ' data/' . $id . '_script.txt "task_language=fr|is_text_type=plain|os_task_file_format=srt" data/' . $id . '_script.srt -y'); | |
//echo "python captions.py --videoid='$id' --name='auto' --file='data/{$id}_script.txt' --language='fr-FR' --action='action'"; | |
header('Content-type: text/srt'); | |
header('Content-Disposition: attachment; filename="' . $id . '_script.srt"'); | |
readfile("data/{$id}_script.srt"); | |
die(); | |
} | |
?> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<!-- Latest compiled and minified CSS --> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | |
<link href="dist/css/bootstrap-colorpicker.min.css" rel="stylesheet"> | |
<!-- jQuery library --> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
<!-- Latest compiled JavaScript --> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> | |
<script src="dist/js/bootstrap-colorpicker.js"></script> | |
</head> | |
<body> | |
<div class="container"> | |
<h2>Script -> .srt</h2> | |
<div> | |
<form action="alignment.php" method="POST"> | |
<p><input type="text" name="url" value="https://www.youtube.com/?v=" size="40" /> URL de la vidéo YouTube</p> | |
<p>Script (1 ligne par panneau)</p> | |
<p> | |
<textarea name="script" cols="80" rows="20"> | |
</textarea> | |
</p> | |
<input type="submit" value="Générer un fichier .srt" /> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment