parent
f063f2ead4
commit
44bf858c35
35 changed files with 101 additions and 67 deletions
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* DownloadController class.
|
||||
*/
|
||||
|
@ -49,7 +50,8 @@ class DownloadController extends BaseController
|
|||
return $this->getDownloadResponse($request, $response);
|
||||
} catch (PasswordException $e) {
|
||||
return $response->withRedirect(
|
||||
$this->container->get('router')->pathFor('info').'?'.http_build_query($request->getQueryParams())
|
||||
$this->container->get('router')->pathFor('info') .
|
||||
'?' . http_build_query($request->getQueryParams())
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
$response->getBody()->write($e->getMessage());
|
||||
|
@ -76,8 +78,8 @@ class DownloadController extends BaseController
|
|||
|
||||
$response = $response->withHeader(
|
||||
'Content-Disposition',
|
||||
'attachment; filename="'.
|
||||
$this->video->getFileNameWithExtension('mp3').'"'
|
||||
'attachment; filename="' .
|
||||
$this->video->getFileNameWithExtension('mp3') . '"'
|
||||
);
|
||||
$response = $response->withHeader('Content-Type', 'audio/mpeg');
|
||||
|
||||
|
@ -153,15 +155,15 @@ class DownloadController extends BaseController
|
|||
$response = $response->withHeader('Content-Type', 'application/zip');
|
||||
$response = $response->withHeader(
|
||||
'Content-Disposition',
|
||||
'attachment; filename="'.$this->video->title.'.zip"'
|
||||
'attachment; filename="' . $this->video->title . '.zip"'
|
||||
);
|
||||
|
||||
return $response->withBody($stream);
|
||||
} elseif ($this->video->protocol == 'rtmp') {
|
||||
$response = $response->withHeader('Content-Type', 'video/'.$this->video->ext);
|
||||
$response = $response->withHeader('Content-Type', 'video/' . $this->video->ext);
|
||||
$body = new Stream($this->video->getRtmpStream());
|
||||
} elseif ($this->video->protocol == 'm3u8' || $this->video->protocol == 'm3u8_native') {
|
||||
$response = $response->withHeader('Content-Type', 'video/'.$this->video->ext);
|
||||
$response = $response->withHeader('Content-Type', 'video/' . $this->video->ext);
|
||||
$body = new Stream($this->video->getM3uStream());
|
||||
} else {
|
||||
$headers = (array) $this->video->http_headers;
|
||||
|
@ -192,8 +194,8 @@ class DownloadController extends BaseController
|
|||
}
|
||||
$response = $response->withHeader(
|
||||
'Content-Disposition',
|
||||
'attachment; filename="'.
|
||||
$this->video->getFilename().'"'
|
||||
'attachment; filename="' .
|
||||
$this->video->getFilename() . '"'
|
||||
);
|
||||
|
||||
return $response;
|
||||
|
@ -220,7 +222,7 @@ class DownloadController extends BaseController
|
|||
|
||||
return $response->withHeader(
|
||||
'Content-Disposition',
|
||||
'attachment; filename="'.$this->video->getFileNameWithExtension('mkv')
|
||||
'attachment; filename="' . $this->video->getFileNameWithExtension('mkv')
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -269,10 +271,10 @@ class DownloadController extends BaseController
|
|||
{
|
||||
$response = $response->withHeader(
|
||||
'Content-Disposition',
|
||||
'attachment; filename="'.
|
||||
$this->video->getFileNameWithExtension($request->getQueryParam('customFormat')).'"'
|
||||
'attachment; filename="' .
|
||||
$this->video->getFileNameWithExtension($request->getQueryParam('customFormat')) . '"'
|
||||
);
|
||||
$response = $response->withHeader('Content-Type', 'video/'.$request->getQueryParam('customFormat'));
|
||||
$response = $response->withHeader('Content-Type', 'video/' . $request->getQueryParam('customFormat'));
|
||||
|
||||
if ($request->isGet() || $request->isPost()) {
|
||||
$process = $this->video->getConvertedStream(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue