Merge branch 'develop' into feature/stream

This commit is contained in:
Pierre Rudloff 2016-10-13 17:30:30 +02:00
commit b3632ccd69

View file

@ -47,9 +47,7 @@ class FrontController
{
$this->config = Config::getInstance();
$this->download = new VideoDownload();
if ($container instanceof Container) {
$this->container = $container;
}
$this->container = $container;
}
/**
@ -62,15 +60,17 @@ class FrontController
*/
public function index(Request $request, Response $response)
{
$this->container->view->render(
$response,
'index.tpl',
[
'convert' => $this->config->convert,
'class' => 'index',
'description' => 'Easily download videos from Youtube, Dailymotion, Vimeo and other websites.',
]
);
if ($this->container instanceof Container) {
$this->container->view->render(
$response,
'index.tpl',
[
'convert' => $this->config->convert,
'class' => 'index',
'description' => 'Easily download videos from Youtube, Dailymotion, Vimeo and other websites.',
]
);
}
}
/**
@ -83,17 +83,19 @@ class FrontController
*/
public function extractors(Request $request, Response $response)
{
$this->container->view->render(
$response,
'extractors.tpl',
[
'extractors' => $this->download->listExtractors(),
'class' => 'extractors',
'title' => 'Supported websites',
'description' => 'List of all supported websites from which Alltube Download '.
'can extract video or audio files',
]
);
if ($this->container instanceof Container) {
$this->container->view->render(
$response,
'extractors.tpl',
[
'extractors' => $this->download->listExtractors(),
'class' => 'extractors',
'title' => 'Supported websites',
'description' => 'List of all supported websites from which Alltube Download '.
'can extract video or audio files',
]
);
}
}
/**
@ -129,16 +131,18 @@ class FrontController
}
} else {
$video = $this->download->getJSON($params['url']);
$this->container->view->render(
$response,
'video.tpl',
[
'video' => $video,
'class' => 'video',
'title' => $video->title,
'description' => 'Download "'.$video->title.'" from '.$video->extractor_key,
]
);
if ($this->container instanceof Container) {
$this->container->view->render(
$response,
'video.tpl',
[
'video' => $video,
'class' => 'video',
'title' => $video->title,
'description' => 'Download "'.$video->title.'" from '.$video->extractor_key,
]
);
}
}
} else {
return $response->withRedirect($this->container->get('router')->pathFor('index'));
@ -156,15 +160,17 @@ class FrontController
*/
public function error(Request $request, Response $response, \Exception $exception)
{
$this->container->view->render(
$response,
'error.tpl',
[
'errors' => $exception->getMessage(),
'class' => 'video',
'title' => 'Error',
]
);
if ($this->container instanceof Container) {
$this->container->view->render(
$response,
'error.tpl',
[
'errors' => $exception->getMessage(),
'class' => 'video',
'title' => 'Error',
]
);
}
return $response->withStatus(500);
}