feat: Use ZIP files for playlist archives
It is more widely supported and could be later used for #194
This commit is contained in:
parent
226f1b8380
commit
e93ab7ed13
3 changed files with 6 additions and 6 deletions
|
@ -5,16 +5,16 @@
|
|||
|
||||
namespace Alltube;
|
||||
|
||||
use Barracuda\ArchiveStream\TarArchive;
|
||||
use Barracuda\ArchiveStream\ZipArchive;
|
||||
use GuzzleHttp\Psr7\Stream;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
|
||||
/**
|
||||
* Class used to create a Tar archive from playlists and stream it to the browser.
|
||||
* Class used to create a Zip archive from playlists and stream it to the browser.
|
||||
*
|
||||
* @link https://github.com/php-fig/http-message/blob/master/src/StreamInterface.php
|
||||
*/
|
||||
class PlaylistArchiveStream extends TarArchive implements StreamInterface
|
||||
class PlaylistArchiveStream extends ZipArchive implements StreamInterface
|
||||
{
|
||||
/**
|
||||
* videos to add in the archive.
|
||||
|
|
|
@ -380,10 +380,10 @@ class FrontController
|
|||
{
|
||||
if (isset($this->video->entries)) {
|
||||
$stream = new PlaylistArchiveStream($this->video);
|
||||
$response = $response->withHeader('Content-Type', 'application/x-tar');
|
||||
$response = $response->withHeader('Content-Type', 'application/zip');
|
||||
$response = $response->withHeader(
|
||||
'Content-Disposition',
|
||||
'attachment; filename="'.$this->video->title.'.tar"'
|
||||
'attachment; filename="'.$this->video->title.'.zip"'
|
||||
);
|
||||
|
||||
return $response->withBody($stream);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
parameters:
|
||||
ignoreErrors:
|
||||
# The Archive constructor messes up the output buffering.
|
||||
- '#Alltube\\PlaylistArchiveStream::__construct\(\) does not call parent constructor from Barracuda\\ArchiveStream\\TarArchive\.#'
|
||||
- '#Alltube\\PlaylistArchiveStream::__construct\(\) does not call parent constructor from Barracuda\\ArchiveStream\\ZipArchive\.#'
|
||||
|
|
Loading…
Reference in a new issue