feat: Use ZIP files for playlist archives

It is more widely supported and could be later used for #194
This commit is contained in:
Pierre Rudloff 2019-04-21 22:34:45 +02:00
parent 226f1b8380
commit e93ab7ed13
3 changed files with 6 additions and 6 deletions

View File

@ -5,16 +5,16 @@
namespace Alltube; namespace Alltube;
use Barracuda\ArchiveStream\TarArchive; use Barracuda\ArchiveStream\ZipArchive;
use GuzzleHttp\Psr7\Stream; use GuzzleHttp\Psr7\Stream;
use Psr\Http\Message\StreamInterface; 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 * @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. * videos to add in the archive.

View File

@ -380,10 +380,10 @@ class FrontController
{ {
if (isset($this->video->entries)) { if (isset($this->video->entries)) {
$stream = new PlaylistArchiveStream($this->video); $stream = new PlaylistArchiveStream($this->video);
$response = $response->withHeader('Content-Type', 'application/x-tar'); $response = $response->withHeader('Content-Type', 'application/zip');
$response = $response->withHeader( $response = $response->withHeader(
'Content-Disposition', 'Content-Disposition',
'attachment; filename="'.$this->video->title.'.tar"' 'attachment; filename="'.$this->video->title.'.zip"'
); );
return $response->withBody($stream); return $response->withBody($stream);

View File

@ -1,4 +1,4 @@
parameters: parameters:
ignoreErrors: ignoreErrors:
# The Archive constructor messes up the output buffering. # 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\.#'