From 7428b334de7a9b114bdf425cfcdea5123f683fae Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 25 Apr 2017 11:05:49 +0200 Subject: [PATCH] Smal fixes with playlists --- controllers/FrontController.php | 11 +++++++++-- css/style.css | 11 +++++++++++ templates/playlist.tpl | 10 ++++++---- tests/FrontControllerTest.php | 14 ++++++++++++++ 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 83b2db8..36c7d30 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -227,14 +227,21 @@ class FrontController } else { $template = 'video.tpl'; } + if (isset($video->title)) { + $title = $video->title; + $description = 'Download "'.$video->title.'" from '.$video->extractor_key; + } else { + $title = 'Video download'; + $description = 'Download video from '.$video->extractor_key; + } $this->view->render( $response, $template, [ 'video' => $video, 'class' => 'video', - 'title' => $video->title, - 'description' => 'Download "'.$video->title.'" from '.$video->extractor_key, + 'title' => $title, + 'description' => $description, 'protocol' => $protocol, 'config' => $this->config, 'canonical' => $this->getCanonicalUrl($request), diff --git a/css/style.css b/css/style.css index 4ec7276..a055a97 100644 --- a/css/style.css +++ b/css/style.css @@ -407,6 +407,7 @@ padding:3px; clear: both; padding-top: 2em; text-align: left; + width: 600px; } .playlist-entry h3 { @@ -682,6 +683,16 @@ h1 { text-align:left; } + .playlist-entry { + text-align: center; + width: auto; + } + + .playlist-entry .thumb { + float: none; + margin-right: 0; + } + } @media all and (display-mode: standalone) { diff --git a/templates/playlist.tpl b/templates/playlist.tpl index 62319d8..cab5c4a 100644 --- a/templates/playlist.tpl +++ b/templates/playlist.tpl @@ -2,16 +2,18 @@
{include file="inc/logo.tpl"} -

Videos extracted from the +

Videos extracted from the {if isset($video->title)} -{$video->title} playlist: +{$video->title}{/if} playlist:

{foreach $video->entries as $video}
-

{$video->title}

+

{$video->title}

webpage_url}">Download - webpage_url}">More options + {if count($video->formats) > 1} + webpage_url}">More options + {/if}
{/foreach} diff --git a/tests/FrontControllerTest.php b/tests/FrontControllerTest.php index 7a6d425..3ba8884 100644 --- a/tests/FrontControllerTest.php +++ b/tests/FrontControllerTest.php @@ -179,6 +179,20 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase $this->assertTrue($result->isOk()); } + /** + * Test the video() function with a video that does not have a title. + * + * @return void + */ + public function testVideoWithoutTitle() + { + $result = $this->controller->video( + $this->request->withQueryParams(['url'=>'http://html5demos.com/video']), + $this->response + ); + $this->assertTrue($result->isOk()); + } + /** * Test the video() function with audio conversion. *