refactor: Use a StreamInterface for PlaylistArchiveStream
It is much cleaner
This commit is contained in:
parent
5cb8bc30b3
commit
f9bf3b8d47
9 changed files with 267 additions and 157 deletions
|
@ -481,30 +481,6 @@ class VideoDownload
|
|||
return $stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Tar stream containing every video in the playlist piped through the server.
|
||||
*
|
||||
* @param stdClass $video Video object returned by youtube-dl
|
||||
* @param string $format Requested format
|
||||
*
|
||||
* @throws Exception If the popen stream was not created correctly
|
||||
*
|
||||
* @return resource
|
||||
*/
|
||||
public function getPlaylistArchiveStream(stdClass $video, $format)
|
||||
{
|
||||
$playlistItems = [];
|
||||
foreach ($video->entries as $entry) {
|
||||
$playlistItems[] = urlencode($entry->url);
|
||||
}
|
||||
$stream = fopen('playlist://'.implode(';', $playlistItems).'/'.$format, 'r');
|
||||
if (!is_resource($stream)) {
|
||||
throw new Exception(_('Could not open fopen stream.'));
|
||||
}
|
||||
|
||||
return $stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stream of a converted video.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue