Smal fixes with playlists

This commit is contained in:
Pierre Rudloff 2017-04-25 11:05:49 +02:00
parent 554dd14edd
commit 7428b334de
4 changed files with 40 additions and 6 deletions

View file

@ -227,14 +227,21 @@ class FrontController
} else { } else {
$template = 'video.tpl'; $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( $this->view->render(
$response, $response,
$template, $template,
[ [
'video' => $video, 'video' => $video,
'class' => 'video', 'class' => 'video',
'title' => $video->title, 'title' => $title,
'description' => 'Download "'.$video->title.'" from '.$video->extractor_key, 'description' => $description,
'protocol' => $protocol, 'protocol' => $protocol,
'config' => $this->config, 'config' => $this->config,
'canonical' => $this->getCanonicalUrl($request), 'canonical' => $this->getCanonicalUrl($request),

View file

@ -407,6 +407,7 @@ padding:3px;
clear: both; clear: both;
padding-top: 2em; padding-top: 2em;
text-align: left; text-align: left;
width: 600px;
} }
.playlist-entry h3 { .playlist-entry h3 {
@ -682,6 +683,16 @@ h1 {
text-align:left; text-align:left;
} }
.playlist-entry {
text-align: center;
width: auto;
}
.playlist-entry .thumb {
float: none;
margin-right: 0;
}
} }
@media all and (display-mode: standalone) { @media all and (display-mode: standalone) {

View file

@ -2,16 +2,18 @@
<div class="wrapper"> <div class="wrapper">
<div class="main"> <div class="main">
{include file="inc/logo.tpl"} {include file="inc/logo.tpl"}
<p>Videos extracted from the<i> <p>Videos extracted from the {if isset($video->title)}<i>
<a href="{$video->webpage_url}"> <a href="{$video->webpage_url}">
{$video->title}</a></i> playlist: {$video->title}</a></i>{/if} playlist:
</p> </p>
{foreach $video->entries as $video} {foreach $video->entries as $video}
<div class="playlist-entry"> <div class="playlist-entry">
<img class="thumb" src="{$video->thumbnail}" alt="" width="200" /> <img class="thumb" src="{$video->thumbnail}" alt="" width="200" />
<h3><a href="{$video->webpage_url}">{$video->title}</a></h3> <h3><a target="_blank" href="{$video->webpage_url}">{$video->title}</a></h3>
<a target="_blank" class="downloadBtn" href="{path_for name="redirect"}?url={$video->webpage_url}">Download</a> <a target="_blank" class="downloadBtn" href="{path_for name="redirect"}?url={$video->webpage_url}">Download</a>
<a target="_blank" href="{path_for name="video"}?url={$video->webpage_url}">More options</a> {if count($video->formats) > 1}
<a target="_blank" href="{path_for name="video"}?url={$video->webpage_url}">More options</a>
{/if}
</div> </div>
{/foreach} {/foreach}

View file

@ -179,6 +179,20 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($result->isOk()); $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. * Test the video() function with audio conversion.
* *