From b91fe78dcd8b51ecae2a115998be1aa37891ca3e Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sun, 28 Apr 2019 00:25:03 +0200 Subject: [PATCH] feat: Make streaming optional when stream mode is enabled Closes #218 --- controllers/DownloadController.php | 2 +- templates/info.tpl | 5 +++++ tests/DownloadControllerTest.php | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/controllers/DownloadController.php b/controllers/DownloadController.php index 2d03218..ddd83b3 100644 --- a/controllers/DownloadController.php +++ b/controllers/DownloadController.php @@ -240,7 +240,7 @@ class DownloadController extends BaseController } if (count($videoUrls) > 1) { return $this->getRemuxStream($request, $response); - } elseif ($this->config->stream) { + } elseif ($this->config->stream && (isset($this->video->entries) || $request->getQueryParam('stream'))) { return $this->getStream($request, $response); } else { if (empty($videoUrls[0])) { diff --git a/templates/info.tpl b/templates/info.tpl index ff977df..54847ef 100644 --- a/templates/info.tpl +++ b/templates/info.tpl @@ -80,6 +80,11 @@ {/foreach}

+ {if $config->stream} + + +

+ {/if} {if $config->convertAdvanced} diff --git a/tests/DownloadControllerTest.php b/tests/DownloadControllerTest.php index 99587ac..df89efa 100644 --- a/tests/DownloadControllerTest.php +++ b/tests/DownloadControllerTest.php @@ -67,7 +67,7 @@ class DownloadControllerTest extends ControllerTest $this->assertRequestIsOk( 'download', - ['url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU'] + ['url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'stream' => true] ); } @@ -89,6 +89,7 @@ class DownloadControllerTest extends ControllerTest [ 'url' => 'https://twitter.com/verge/status/813055465324056576/video/1', 'format' => 'hls-2176', + 'stream' => true, ] ); }