From f1cf0a2cdc6f4f172ed07db896479dcddc4ce268 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 3 Jul 2018 19:47:35 +0200 Subject: [PATCH 01/15] feat: Add a way to trim the audio --- classes/VideoDownload.php | 57 +++++++++++++++++++++------- controllers/FrontController.php | 67 ++++++++++++++++++++++++--------- css/style.css | 13 +++++-- templates/index.tpl | 13 +++++-- 4 files changed, 112 insertions(+), 38 deletions(-) diff --git a/classes/VideoDownload.php b/classes/VideoDownload.php index d357b0b..08d3ecc 100644 --- a/classes/VideoDownload.php +++ b/classes/VideoDownload.php @@ -268,27 +268,52 @@ class VideoDownload * @param int $audioBitrate Audio bitrate of the converted file * @param string $filetype Filetype of the converted file * @param bool $audioOnly True to return an audio-only file + * @param string $from Start the conversion at this time + * @param string $to End the conversion at this time * * @throws Exception If avconv/ffmpeg is missing * * @return Process Process */ - private function getAvconvProcess(stdClass $video, $audioBitrate, $filetype = 'mp3', $audioOnly = true) - { + private function getAvconvProcess( + stdClass $video, + $audioBitrate, + $filetype = 'mp3', + $audioOnly = true, + $from = null, + $to = null + ) { if (!$this->checkCommand([$this->config->avconv, '-version'])) { throw new Exception(_('Can\'t find avconv or ffmpeg at ').$this->config->avconv.'.'); } + $durationRegex = '/(\d+:)?(\d+:)?(\d+)/'; + if ($video->protocol == 'rtmp') { - $rtmpArguments = $this->getRtmpArguments($video); + $beforeArguments = $this->getRtmpArguments($video); } else { - $rtmpArguments = []; + $beforeArguments = []; } if ($audioOnly) { - $videoArguments = ['-vn']; + $afterArguments = ['-vn']; } else { - $videoArguments = []; + $afterArguments = []; + } + + if (isset($from) && !empty($from)) { + if (!preg_match($durationRegex, $from)) { + throw new Exception(_('Invalid start time: ').$from.'.'); + } + $afterArguments[] = '-ss'; + $afterArguments[] = $from; + } + if (isset($to) && !empty($to)) { + if (!preg_match($durationRegex, $to)) { + throw new Exception(_('Invalid end time: ').$to.'.'); + } + $afterArguments[] = '-to'; + $afterArguments[] = $to; } $arguments = array_merge( @@ -296,13 +321,13 @@ class VideoDownload $this->config->avconv, '-v', $this->config->avconvVerbosity, ], - $rtmpArguments, + $beforeArguments, [ '-i', $video->url, '-f', $filetype, '-b:a', $audioBitrate.'k', ], - $videoArguments, + $afterArguments, [ 'pipe:1', ] @@ -322,13 +347,15 @@ class VideoDownload * @param string $url URL of page * @param string $format Format to use for the video * @param string $password Video password + * @param string $from Start the conversion at this time + * @param string $to End the conversion at this time * * @throws Exception If your try to convert and M3U8 video * @throws Exception If the popen stream was not created correctly * * @return resource popen stream */ - public function getAudioStream($url, $format, $password = null) + public function getAudioStream($url, $format, $password = null, $from = null, $to = null) { $video = $this->getJSON($url, $format, $password); @@ -336,13 +363,15 @@ class VideoDownload throw new Exception(_('Conversion of playlists is not supported.')); } - if (in_array($video->protocol, ['m3u8', 'm3u8_native'])) { - throw new Exception(_('Conversion of M3U8 files is not supported.')); - } elseif ($video->protocol == 'http_dash_segments') { - throw new Exception(_('Conversion of DASH segments is not supported.')); + if (isset($video->protocol)) { + if (in_array($video->protocol, ['m3u8', 'm3u8_native'])) { + throw new Exception(_('Conversion of M3U8 files is not supported.')); + } elseif ($video->protocol == 'http_dash_segments') { + throw new Exception(_('Conversion of DASH segments is not supported.')); + } } - $avconvProc = $this->getAvconvProcess($video, $this->config->audioBitrate); + $avconvProc = $this->getAvconvProcess($video, $this->config->audioBitrate, 'mp3', true, $from, $to); $stream = popen($avconvProc->getCommandLine(), 'r'); diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 3d1e2f5..43fbf14 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -201,7 +201,50 @@ class FrontController } /** - * Return the converted MP3 file. + * Return a converted MP3 file. + * + * @param Request $request PSR-7 request + * @param Response $response PSR-7 response + * @param array $params GET query parameters + * @param string $password Video password + * + * @return Response HTTP response + */ + private function getConvertedAudioResponse(Request $request, Response $response, array $params, $password = null) + { + $response = $response->withHeader( + 'Content-Disposition', + 'attachment; filename="'. + $this->download->getAudioFilename($params['url'], 'bestaudio/best', $password).'"' + ); + $response = $response->withHeader('Content-Type', 'audio/mpeg'); + + if ($request->isGet() || $request->isPost()) { + try { + $process = $this->download->getAudioStream( + $params['url'], + 'bestaudio/best', + $password, + $params['from'], + $params['to'] + ); + } catch (Exception $e) { + $process = $this->download->getAudioStream( + $params['url'], + $this->defaultFormat, + $password, + $params['from'], + $params['to'] + ); + } + $response = $response->withBody(new Stream($process)); + } + + return $response; + } + + /** + * Return the MP3 file. * * @param Request $request PSR-7 request * @param Response $response PSR-7 response @@ -213,6 +256,10 @@ class FrontController private function getAudioResponse(Request $request, Response $response, array $params, $password = null) { try { + if (isset($params['from']) || isset($params['to'])) { + throw new Exception('Force convert when we need to seek.'); + } + if ($this->config->stream) { return $this->getStream($params['url'], 'mp3', $response, $request, $password); } else { @@ -223,23 +270,7 @@ class FrontController } catch (PasswordException $e) { return $this->password($request, $response); } catch (Exception $e) { - $response = $response->withHeader( - 'Content-Disposition', - 'attachment; filename="'. - $this->download->getAudioFilename($params['url'], 'bestaudio/best', $password).'"' - ); - $response = $response->withHeader('Content-Type', 'audio/mpeg'); - - if ($request->isGet() || $request->isPost()) { - try { - $process = $this->download->getAudioStream($params['url'], 'bestaudio/best', $password); - } catch (Exception $e) { - $process = $this->download->getAudioStream($params['url'], $this->defaultFormat, $password); - } - $response = $response->withBody(new Stream($process)); - } - - return $response; + return $this->getConvertedAudioResponse($request, $response, $params, $password); } } diff --git a/css/style.css b/css/style.css index 0dc7cd2..951ef4d 100644 --- a/css/style.css +++ b/css/style.css @@ -260,11 +260,10 @@ footer a:hover { width:622px; } -.mp3 p { +.mp3-inner { padding:3px; } - .audio:not(:checked), .audio:checked { left: -9999px; @@ -273,7 +272,7 @@ footer a:hover { .audio:not(:checked) + label, .audio:checked + label { cursor: pointer; - line-height:22px; + line-height:20px; padding-left: 82px; position: relative; } @@ -373,7 +372,15 @@ footer a:hover { width:73px; } +.seekOptions { + display: none; + margin-top: 15px; + text-align: center; +} +.audio:checked ~ .seekOptions { + display: block; +} /* Playlists */ diff --git a/templates/index.tpl b/templates/index.tpl index 2a5420f..e293947 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -19,9 +19,16 @@
{if $config->convert}
-

-

+
+ + +
+ From + to +
+
{/if} From 159ea245a88859c1b03b13e785bc2aff12738931 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 3 Jul 2018 19:52:24 +0200 Subject: [PATCH 02/15] fix: Undefined variables --- controllers/FrontController.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 43fbf14..68f16ce 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -212,6 +212,13 @@ class FrontController */ private function getConvertedAudioResponse(Request $request, Response $response, array $params, $password = null) { + if (!isset($params['from'])) { + $params['from'] = ''; + } + if (!isset($params['to'])) { + $params['to'] = ''; + } + $response = $response->withHeader( 'Content-Disposition', 'attachment; filename="'. From cb7c21164b921016aea60d81a5783c276bfc8cdb Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 3 Jul 2018 20:09:45 +0200 Subject: [PATCH 03/15] refactor: Simplify getAvconvProcess() --- classes/VideoDownload.php | 50 ++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/classes/VideoDownload.php b/classes/VideoDownload.php index 08d3ecc..0f3c462 100644 --- a/classes/VideoDownload.php +++ b/classes/VideoDownload.php @@ -222,24 +222,26 @@ class VideoDownload { $arguments = []; - foreach ([ - 'url' => '-rtmp_tcurl', - 'webpage_url' => '-rtmp_pageurl', - 'player_url' => '-rtmp_swfverify', - 'flash_version' => '-rtmp_flashver', - 'play_path' => '-rtmp_playpath', - 'app' => '-rtmp_app', - ] as $property => $option) { - if (isset($video->{$property})) { - $arguments[] = $option; - $arguments[] = $video->{$property}; + if ($video->protocol == 'rtmp') { + foreach ([ + 'url' => '-rtmp_tcurl', + 'webpage_url' => '-rtmp_pageurl', + 'player_url' => '-rtmp_swfverify', + 'flash_version' => '-rtmp_flashver', + 'play_path' => '-rtmp_playpath', + 'app' => '-rtmp_app', + ] as $property => $option) { + if (isset($video->{$property})) { + $arguments[] = $option; + $arguments[] = $video->{$property}; + } } - } - if (isset($video->rtmp_conn)) { - foreach ($video->rtmp_conn as $conn) { - $arguments[] = '-rtmp_conn'; - $arguments[] = $conn; + if (isset($video->rtmp_conn)) { + foreach ($video->rtmp_conn as $conn) { + $arguments[] = '-rtmp_conn'; + $arguments[] = $conn; + } } } @@ -289,26 +291,20 @@ class VideoDownload $durationRegex = '/(\d+:)?(\d+:)?(\d+)/'; - if ($video->protocol == 'rtmp') { - $beforeArguments = $this->getRtmpArguments($video); - } else { - $beforeArguments = []; - } + $afterArguments = []; if ($audioOnly) { - $afterArguments = ['-vn']; - } else { - $afterArguments = []; + $afterArguments[] = '-vn'; } - if (isset($from) && !empty($from)) { + if (!empty($from)) { if (!preg_match($durationRegex, $from)) { throw new Exception(_('Invalid start time: ').$from.'.'); } $afterArguments[] = '-ss'; $afterArguments[] = $from; } - if (isset($to) && !empty($to)) { + if (!empty($to)) { if (!preg_match($durationRegex, $to)) { throw new Exception(_('Invalid end time: ').$to.'.'); } @@ -321,7 +317,7 @@ class VideoDownload $this->config->avconv, '-v', $this->config->avconvVerbosity, ], - $beforeArguments, + $this->getRtmpArguments($video), [ '-i', $video->url, '-f', $filetype, From 61857f0bdfc170b8f1ea317f16af70cff59120b6 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 3 Jul 2018 20:15:10 +0200 Subject: [PATCH 04/15] Update Alltube.po (POEditor.com) --- i18n/fr_FR/LC_MESSAGES/Alltube.po | 219 ++++++++++++++---------------- 1 file changed, 104 insertions(+), 115 deletions(-) diff --git a/i18n/fr_FR/LC_MESSAGES/Alltube.po b/i18n/fr_FR/LC_MESSAGES/Alltube.po index 34ab3a6..ab319e3 100644 --- a/i18n/fr_FR/LC_MESSAGES/Alltube.po +++ b/i18n/fr_FR/LC_MESSAGES/Alltube.po @@ -1,19 +1,11 @@ msgid "" msgstr "" -"Project-Id-Version: AllTube Download\n" -"POT-Creation-Date: \n" -"PO-Revision-Date: \n" -"Last-Translator: Pierre Rudloff \n" -"Language-Team: \n" -"Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.8.11\n" - -#: templates/error.tpl:5 -msgid "An error occurred" -msgstr "Une erreur est survenue" +"X-Generator: POEditor.com\n" +"Project-Id-Version: AllTube Download\n" +"Language: fr\n" #: templates/error.tpl:6 msgid "Please check the URL of your video." @@ -27,9 +19,9 @@ msgstr "Vidéos extraites depuis" msgid ":" msgstr " :" -#: templates/playlist.tpl:26 templates/password.tpl:10 templates/video.tpl:96 -#: templates/video.tpl:99 templates/index.tpl:19 -#: controllers/FrontController.php:275 +#: templates/playlist.tpl:26 templates/video.tpl:96 templates/video.tpl:99 +#: templates/password.tpl:10 templates/index.tpl:19 +#: controllers/FrontController.php:315 msgid "Download" msgstr "Télécharger" @@ -49,7 +41,7 @@ msgstr "L'accès à cette vidéo nécessite un mot de passe." msgid "Video password" msgstr "Mot de passe de la vidéo" -#: templates/extractors.tpl:4 controllers/FrontController.php:165 +#: templates/extractors.tpl:4 controllers/FrontController.php:167 msgid "Supported websites" msgstr "Sites web supportés" @@ -81,18 +73,6 @@ msgstr "Pire qualité" msgid "Detailed formats" msgstr "Formats détaillés" -#: templates/video.tpl:85 -msgid "Convert into a custom format:" -msgstr "Convertir dans un format personnalisé :" - -#: templates/video.tpl:91 -msgid "with" -msgstr "avec de l'audio à" - -#: templates/video.tpl:93 -msgid "kbit/s audio" -msgstr "kbit/s" - #: templates/inc/footer.tpl:4 msgid "Code by" msgstr "Développé par" @@ -109,18 +89,6 @@ msgstr "Obtenir le code" msgid "Based on" msgstr "Basé sur" -#: templates/inc/footer.tpl:14 -msgid "Donate using Liberapay" -msgstr "Faire un don avec Liberapay" - -#: templates/inc/footer.tpl:14 -msgid "Donate" -msgstr "Faire un don" - -#: templates/inc/header.tpl:4 -msgid "Switch language" -msgstr "Changer de langue" - #: templates/inc/header.tpl:21 msgid "Share on Twitter" msgstr "Partager sur Twitter" @@ -133,108 +101,129 @@ msgstr "Partager sur Facebook" msgid "Copy here the URL of your video (Youtube, Dailymotion, etc.)" msgstr "Copiez ici l'URL de votre vidéo (Youtube, Dailymotion, etc.)" -#: templates/index.tpl:24 +#: templates/index.tpl:25 msgid "Audio only (MP3)" msgstr "Audio uniquement (MP3)" -#: templates/index.tpl:29 +#: templates/index.tpl:36 msgid "See all supported websites" msgstr "Voir tous les sites supportés" -#: templates/index.tpl:31 +#: templates/index.tpl:38 msgid "Drag this to your bookmarks bar:" msgstr "Glissez ce lien dans votre barre de favoris :" -#: templates/index.tpl:32 +#: templates/index.tpl:39 msgid "Bookmarklet" msgstr "Bookmarklet" +#: templates/inc/header.tpl:4 +msgid "Switch language" +msgstr "Changer de langue" + +#: templates/error.tpl:5 +msgid "An error occurred" +msgstr "Une erreur est survenue" + +#: templates/video.tpl:85 +msgid "Convert into a custom format:" +msgstr "Convertir dans un format personnalisé :" + +#: templates/video.tpl:93 +msgid "kbit/s audio" +msgstr "kbit/s" + +#: templates/video.tpl:91 +msgid "with" +msgstr "avec de l'audio à" + #: classes/VideoDownload.php:117 msgid "Wrong password" msgstr "Mauvais mot de passe" +#: classes/VideoDownload.php:364 classes/VideoDownload.php:526 +msgid "Conversion of M3U8 files is not supported." +msgstr "La conversion des fichiers M3U8 n'est pas possible." + +#: classes/VideoDownload.php:375 classes/VideoDownload.php:412 +#: classes/VideoDownload.php:445 classes/VideoDownload.php:478 +#: classes/VideoDownload.php:534 +msgid "Could not open popen stream." +msgstr "Impossible d'ouvrir le flux popen." + +#: classes/VideoDownload.php:502 +msgid "Could not open fopen stream." +msgstr "Impossible d'ouvrir le flux fopen." + +#: controllers/FrontController.php:124 +msgid "Easily download videos from Youtube, Dailymotion, Vimeo and other websites." +msgstr "Téléchargez facilement des vidéos depuis Youtube, Dailymotion, Vimeo et d'autres sites web." + +#: controllers/FrontController.php:168 +msgid "List of all supported websites from which Alltube Download can extract video or audio files" +msgstr "Liste de tous les sites web depuis lesquels Alltube Download peut extraire des fichiers vidéo ou audio" + +#: controllers/FrontController.php:193 +msgid "Password prompt" +msgstr "Demande de mot de passe" + +#: controllers/FrontController.php:194 +msgid "You need a password in order to download this video with Alltube Download" +msgstr "Vous avez besoin d'un mot de passe pour télécharger cette vidéo avec Alltube Download" + +#: controllers/FrontController.php:311 +msgid "Video download" +msgstr "Téléchargement d'une vidéo" + +#: controllers/FrontController.php:312 +msgid "Download video from " +msgstr "Téléchargement d'une vidéo depuis " + +#: controllers/FrontController.php:315 +msgid "from" +msgstr "depuis" + +#: controllers/FrontController.php:378 +msgid "Error" +msgstr "Erreur" + +#: controllers/FrontController.php:450 +msgid "You need to enable remux mode to merge two formats." +msgstr "Vous devez activer le mode remux pour fusionner deux formats." + +#: controllers/FrontController.php:525 +msgid "Can't find URL of video." +msgstr "Impossible de trouver l'URL de la vidéo." + +#: classes/VideoDownload.php:289 classes/VideoDownload.php:394 +msgid "Can't find avconv or ffmpeg at " +msgstr "Impossible de trouver avconv ou ffmpeg à " + +#: templates/inc/footer.tpl:14 +msgid "Donate" +msgstr "Faire un don" + #: classes/VideoDownload.php:158 msgid "youtube-dl returned an empty URL." msgstr "youtube-dl a retourné une URL vide." -#: classes/VideoDownload.php:279 classes/VideoDownload.php:369 -msgid "Can't find avconv or ffmpeg at " -msgstr "Impossible de trouver avconv ou ffmpeg à " - -#: classes/VideoDownload.php:336 +#: classes/VideoDownload.php:359 msgid "Conversion of playlists is not supported." msgstr "Impossible de convertir une playlist." -#: classes/VideoDownload.php:340 classes/VideoDownload.php:501 -msgid "Conversion of M3U8 files is not supported." -msgstr "La conversion des fichiers M3U8 n'est pas possible." - -#: classes/VideoDownload.php:342 +#: classes/VideoDownload.php:366 msgid "Conversion of DASH segments is not supported." msgstr "Impossible de convertir des segments DASH." -#: classes/VideoDownload.php:350 classes/VideoDownload.php:387 -#: classes/VideoDownload.php:420 classes/VideoDownload.php:453 -#: classes/VideoDownload.php:509 -msgid "Could not open popen stream." -msgstr "Impossible d'ouvrir le flux popen." +#: templates/inc/footer.tpl:14 +msgid "Donate using Liberapay" +msgstr "Faire un don avec Liberapay" -#: classes/VideoDownload.php:477 -msgid "Could not open fopen stream." -msgstr "Impossible d'ouvrir le flux fopen." +#: classes/VideoDownload.php:302 +msgid "Invalid start time: " +msgstr "Horodatage de début non-valide :␣" -#: controllers/FrontController.php:122 -msgid "" -"Easily download videos from Youtube, Dailymotion, Vimeo and other websites." -msgstr "" -"Téléchargez facilement des vidéos depuis Youtube, Dailymotion, Vimeo et " -"d'autres sites web." +#: classes/VideoDownload.php:309 +msgid "Invalid end time: " +msgstr "Horodatage de fin non-valide :␣" -#: controllers/FrontController.php:166 -msgid "" -"List of all supported websites from which Alltube Download can extract video " -"or audio files" -msgstr "" -"Liste de tous les sites web depuis lesquels Alltube Download peut extraire " -"des fichiers vidéo ou audio" - -#: controllers/FrontController.php:191 -msgid "Password prompt" -msgstr "Demande de mot de passe" - -#: controllers/FrontController.php:192 -msgid "" -"You need a password in order to download this video with Alltube Download" -msgstr "" -"Vous avez besoin d'un mot de passe pour télécharger cette vidéo avec Alltube " -"Download" - -#: controllers/FrontController.php:271 -msgid "Video download" -msgstr "Téléchargement d'une vidéo" - -#: controllers/FrontController.php:272 -msgid "Download video from " -msgstr "Téléchargement d'une vidéo depuis " - -#: controllers/FrontController.php:275 -msgid "from" -msgstr "depuis" - -#: controllers/FrontController.php:338 -msgid "Error" -msgstr "Erreur" - -#: controllers/FrontController.php:410 -msgid "You need to enable remux mode to merge two formats." -msgstr "Vous devez activer le mode remux pour fusionner deux formats." - -#: controllers/FrontController.php:485 -msgid "Can't find URL of video." -msgstr "Impossible de trouver l'URL de la vidéo." - -#~ msgid "AllTube Download on Facebook" -#~ msgstr "AllTube Download sur Facebook" - -#~ msgid "Like us on Facebook" -#~ msgstr "Suivez-nous sur Facebook" From f22538eb9b2fa0633c3927adce9ac3f111d21aff Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 3 Jul 2018 20:15:36 +0200 Subject: [PATCH 05/15] chore: Add missing terms to translation --- i18n/template.pot | 144 ++++++++++++++++++++++++---------------------- 1 file changed, 76 insertions(+), 68 deletions(-) diff --git a/i18n/template.pot b/i18n/template.pot index 6f88d80..8618a64 100644 --- a/i18n/template.pot +++ b/i18n/template.pot @@ -1,12 +1,40 @@ msgid "" msgstr "Content-Type: text/plain; charset=UTF-8\n" -#: templates/error.tpl:5 -msgid "An error occurred" +#: templates/inc/footer.tpl:4 +msgid "Code by" msgstr "" -#: templates/error.tpl:6 -msgid "Please check the URL of your video." +#: templates/inc/footer.tpl:6 +msgid "Design by" +msgstr "" + +#: templates/inc/footer.tpl:10 +msgid "Get the code" +msgstr "" + +#: templates/inc/footer.tpl:12 +msgid "Based on" +msgstr "" + +#: templates/inc/footer.tpl:14 +msgid "Donate using Liberapay" +msgstr "" + +#: templates/inc/footer.tpl:14 +msgid "Donate" +msgstr "" + +#: templates/inc/header.tpl:4 +msgid "Switch language" +msgstr "" + +#: templates/inc/header.tpl:21 +msgid "Share on Twitter" +msgstr "" + +#: templates/inc/header.tpl:23 +msgid "Share on Facebook" msgstr "" #: templates/playlist.tpl:5 @@ -17,9 +45,9 @@ msgstr "" msgid ":" msgstr "" -#: templates/playlist.tpl:26 templates/password.tpl:10 templates/video.tpl:96 -#: templates/video.tpl:99 templates/index.tpl:19 -#: controllers/FrontController.php:275 +#: templates/playlist.tpl:26 templates/video.tpl:96 templates/video.tpl:99 +#: templates/password.tpl:10 templates/index.tpl:19 +#: controllers/FrontController.php:315 msgid "Download" msgstr "" @@ -27,19 +55,7 @@ msgstr "" msgid "More options" msgstr "" -#: templates/password.tpl:5 -msgid "This video is protected" -msgstr "" - -#: templates/password.tpl:6 -msgid "You need a password in order to download this video." -msgstr "" - -#: templates/password.tpl:8 -msgid "Video password" -msgstr "" - -#: templates/extractors.tpl:4 controllers/FrontController.php:165 +#: templates/extractors.tpl:4 controllers/FrontController.php:167 msgid "Supported websites" msgstr "" @@ -83,59 +99,43 @@ msgstr "" msgid "kbit/s audio" msgstr "" -#: templates/inc/footer.tpl:4 -msgid "Code by" +#: templates/error.tpl:5 +msgid "An error occurred" msgstr "" -#: templates/inc/footer.tpl:6 -msgid "Design by" +#: templates/error.tpl:6 +msgid "Please check the URL of your video." msgstr "" -#: templates/inc/footer.tpl:10 -msgid "Get the code" +#: templates/password.tpl:5 +msgid "This video is protected" msgstr "" -#: templates/inc/footer.tpl:12 -msgid "Based on" +#: templates/password.tpl:6 +msgid "You need a password in order to download this video." msgstr "" -#: templates/inc/footer.tpl:14 -msgid "Donate using Liberapay" -msgstr "" - -#: templates/inc/footer.tpl:14 -msgid "Donate" -msgstr "" - -#: templates/inc/header.tpl:4 -msgid "Switch language" -msgstr "" - -#: templates/inc/header.tpl:21 -msgid "Share on Twitter" -msgstr "" - -#: templates/inc/header.tpl:23 -msgid "Share on Facebook" +#: templates/password.tpl:8 +msgid "Video password" msgstr "" #: templates/index.tpl:8 msgid "Copy here the URL of your video (Youtube, Dailymotion, etc.)" msgstr "" -#: templates/index.tpl:24 +#: templates/index.tpl:25 msgid "Audio only (MP3)" msgstr "" -#: templates/index.tpl:29 +#: templates/index.tpl:36 msgid "See all supported websites" msgstr "" -#: templates/index.tpl:31 +#: templates/index.tpl:38 msgid "Drag this to your bookmarks bar:" msgstr "" -#: templates/index.tpl:32 +#: templates/index.tpl:39 msgid "Bookmarklet" msgstr "" @@ -147,72 +147,80 @@ msgstr "" msgid "youtube-dl returned an empty URL." msgstr "" -#: classes/VideoDownload.php:279 classes/VideoDownload.php:369 +#: classes/VideoDownload.php:289 classes/VideoDownload.php:394 msgid "Can't find avconv or ffmpeg at " msgstr "" -#: classes/VideoDownload.php:336 +#: classes/VideoDownload.php:302 +msgid "Invalid start time: " +msgstr "" + +#: classes/VideoDownload.php:309 +msgid "Invalid end time: " +msgstr "" + +#: classes/VideoDownload.php:359 msgid "Conversion of playlists is not supported." msgstr "" -#: classes/VideoDownload.php:340 classes/VideoDownload.php:501 +#: classes/VideoDownload.php:364 classes/VideoDownload.php:526 msgid "Conversion of M3U8 files is not supported." msgstr "" -#: classes/VideoDownload.php:342 +#: classes/VideoDownload.php:366 msgid "Conversion of DASH segments is not supported." msgstr "" -#: classes/VideoDownload.php:350 classes/VideoDownload.php:387 -#: classes/VideoDownload.php:420 classes/VideoDownload.php:453 -#: classes/VideoDownload.php:509 +#: classes/VideoDownload.php:375 classes/VideoDownload.php:412 +#: classes/VideoDownload.php:445 classes/VideoDownload.php:478 +#: classes/VideoDownload.php:534 msgid "Could not open popen stream." msgstr "" -#: classes/VideoDownload.php:477 +#: classes/VideoDownload.php:502 msgid "Could not open fopen stream." msgstr "" -#: controllers/FrontController.php:122 +#: controllers/FrontController.php:124 msgid "" "Easily download videos from Youtube, Dailymotion, Vimeo and other websites." msgstr "" -#: controllers/FrontController.php:166 +#: controllers/FrontController.php:168 msgid "" "List of all supported websites from which Alltube Download can extract video " "or audio files" msgstr "" -#: controllers/FrontController.php:191 +#: controllers/FrontController.php:193 msgid "Password prompt" msgstr "" -#: controllers/FrontController.php:192 +#: controllers/FrontController.php:194 msgid "" "You need a password in order to download this video with Alltube Download" msgstr "" -#: controllers/FrontController.php:271 +#: controllers/FrontController.php:311 msgid "Video download" msgstr "" -#: controllers/FrontController.php:272 +#: controllers/FrontController.php:312 msgid "Download video from " msgstr "" -#: controllers/FrontController.php:275 +#: controllers/FrontController.php:315 msgid "from" msgstr "" -#: controllers/FrontController.php:338 +#: controllers/FrontController.php:378 msgid "Error" msgstr "" -#: controllers/FrontController.php:410 +#: controllers/FrontController.php:450 msgid "You need to enable remux mode to merge two formats." msgstr "" -#: controllers/FrontController.php:485 +#: controllers/FrontController.php:525 msgid "Can't find URL of video." msgstr "" From 2efe969212f3ef7d635e09f050c698084c99a775 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 3 Jul 2018 20:16:37 +0200 Subject: [PATCH 06/15] chore: Missing translations --- i18n/template.pot | 8 ++++++++ templates/index.tpl | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/i18n/template.pot b/i18n/template.pot index 8618a64..6bc0c01 100644 --- a/i18n/template.pot +++ b/i18n/template.pot @@ -127,6 +127,14 @@ msgstr "" msgid "Audio only (MP3)" msgstr "" +#: templates/index.tpl:28 +msgid "From" +msgstr "" + +#: templates/index.tpl:29 +msgid "to" +msgstr "" + #: templates/index.tpl:36 msgid "See all supported websites" msgstr "" diff --git a/templates/index.tpl b/templates/index.tpl index e293947..9796394 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -25,8 +25,8 @@ {t}Audio only (MP3){/t}
- From - to + {t}From{/t} + {t}to{/t}
From 44bed5335aae3679dae12d13176494c6e77ffba3 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 3 Jul 2018 20:17:24 +0200 Subject: [PATCH 07/15] Update Alltube.po (POEditor.com) --- i18n/fr_FR/LC_MESSAGES/Alltube.po | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/i18n/fr_FR/LC_MESSAGES/Alltube.po b/i18n/fr_FR/LC_MESSAGES/Alltube.po index ab319e3..fa25dd4 100644 --- a/i18n/fr_FR/LC_MESSAGES/Alltube.po +++ b/i18n/fr_FR/LC_MESSAGES/Alltube.po @@ -227,3 +227,11 @@ msgstr "Horodatage de début non-valide :␣" msgid "Invalid end time: " msgstr "Horodatage de fin non-valide :␣" +#: templates/index.tpl:28 +msgid "From" +msgstr "À partir de" + +#: templates/index.tpl:29 +msgid "to" +msgstr "jusqu'à" + From 298848a2f11bdd55b2748ba864d37370c2a5a6d9 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 5 Jul 2018 17:05:12 +0200 Subject: [PATCH 08/15] fix: Remux mode should fall back to best format if bestvideo+bestaudio is not available --- controllers/FrontController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 68f16ce..36f4fa9 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -98,7 +98,7 @@ class FrontController $session = $session_factory->newInstance($cookies); $this->sessionSegment = $session->getSegment(self::class); if ($this->config->remux) { - $this->defaultFormat = 'bestvideo+bestaudio'; + $this->defaultFormat = 'bestvideo+bestaudio,best'; } elseif ($this->config->stream) { $this->defaultFormat = 'best'; } From fb90545d927eb732e15bdfc5aba378631fc995a9 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Fri, 6 Jul 2018 10:36:53 +0200 Subject: [PATCH 09/15] feat: Add STREAM environment variable so stream mode can be enabled on Heroku See #178 --- app.json | 4 ++++ classes/Config.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app.json b/app.json index b9584fe..bf59617 100644 --- a/app.json +++ b/app.json @@ -32,6 +32,10 @@ "PYTHON": { "description": "Path to python binary", "value": "/app/.heroku/python/bin/python" + }, + "STREAM": { + "description": "Enable stream mode", + "value": "false" } }, "website": "https://alltubedownload.net/" diff --git a/classes/Config.php b/classes/Config.php index 0a06d55..40c0de5 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -144,7 +144,7 @@ class Config */ private function getEnv() { - foreach (['CONVERT', 'PYTHON', 'AUDIO_BITRATE'] as $var) { + foreach (['CONVERT', 'PYTHON', 'AUDIO_BITRATE', 'STREAM'] as $var) { $env = getenv($var); if ($env) { $prop = lcfirst(str_replace('_', '', ucwords(strtolower($var), '_'))); From c5f3d8d1a1ee124e85e0e446ef0b1196b4ebe1a5 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Fri, 6 Jul 2018 10:39:58 +0200 Subject: [PATCH 10/15] fix: STREAM is not required on Heroku --- app.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app.json b/app.json index bf59617..9aaf88c 100644 --- a/app.json +++ b/app.json @@ -35,7 +35,8 @@ }, "STREAM": { "description": "Enable stream mode", - "value": "false" + "value": "false", + "required": false } }, "website": "https://alltubedownload.net/" From dd58345cd71d90d691c502df7c5f515178d9b63c Mon Sep 17 00:00:00 2001 From: nicolass67 <34300716+nicolass67@users.noreply.github.com> Date: Thu, 26 Jul 2018 20:37:59 +0200 Subject: [PATCH 11/15] Fix missing gnupg program Issue #181 --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 117328b..bb3a9dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ FROM php:7.0-apache +RUN apt-get update && apt-get install -my gnupg RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list From b8b6180609d182c12bfc7e2be8fd0adc420bb49a Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sat, 4 Aug 2018 15:46:49 +0200 Subject: [PATCH 12/15] feat: Allow Youtube-like URLs Fixes #184 --- controllers/FrontController.php | 5 +++++ index.php | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 36f4fa9..a778650 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -343,6 +343,11 @@ class FrontController public function video(Request $request, Response $response) { $params = $request->getQueryParams(); + + if (!isset($params['url']) && isset($params['v'])) { + $params['url'] = $params['v']; + } + if (isset($params['url'])) { $password = $request->getParam('password'); if (isset($password)) { diff --git a/index.php b/index.php index e59b357..a3d4a27 100644 --- a/index.php +++ b/index.php @@ -47,6 +47,10 @@ $app->any( '/video', [$controller, 'video'] )->setName('video'); +$app->any( + '/watch', + [$controller, 'video'] +); $app->get( '/redirect', [$controller, 'redirect'] From 169752a214827b496e86cfb826379032487506c8 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 13 Aug 2018 09:40:14 +0200 Subject: [PATCH 13/15] docs(FAQ): Explain why alltubedownload.net is slow --- resources/FAQ.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/resources/FAQ.md b/resources/FAQ.md index 2699385..ed4153d 100644 --- a/resources/FAQ.md +++ b/resources/FAQ.md @@ -8,6 +8,20 @@ Most recent browsers automatically play a video if it is a format they know how to play. You can ususally download the video by doing *File > Save to* or *ctrl + S*. +## Why is [alltubedownload.net](https://alltubedownload.net) so slow? + +[alltubedownload.net](https://alltubedownload.net) is hosted on a free [Heroku server](https://www.heroku.com/pricing) +so it has low RAM and CPU. + +AllTube probably won't switch to a more expensive hosting +because this project does not earn any financial ressources +(although [donations are welcome](https://liberapay.com/Rudloff/)) +and you are encouraged to host it yourself. + +## alltubedownload.net often says "An error occurred in the application…" + +See above. + ## How do I change config parameters? You need to create a YAML file called `config.yml` in the `config/` folder. From 9a688e931a14d8af77ae734a2a3e64806500b555 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 13 Aug 2018 10:05:38 +0200 Subject: [PATCH 14/15] fix: Check if the url GET parameter is empty --- controllers/FrontController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index a778650..b34ed28 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -348,7 +348,7 @@ class FrontController $params['url'] = $params['v']; } - if (isset($params['url'])) { + if (isset($params['url']) && !empty($params['url'])) { $password = $request->getParam('password'); if (isset($password)) { $this->sessionSegment->setFlash($params['url'], $password); From 7c908d29ba730947b3a67f0e0c19937b7ce949b0 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 13 Aug 2018 10:07:33 +0200 Subject: [PATCH 15/15] build(yarn): 1.2.0 release Bump version number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 08dc658..b4e568e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "alltube", "description": "HTML GUI for youtube-dl", - "version": "1.1.3", + "version": "1.2.0", "author": "Pierre Rudloff", "bugs": "https://github.com/Rudloff/alltube/issues", "dependencies": {