Use https://github.com/slimphp/Slim/pull/1872 in order to support popen streams in Slim

This commit is contained in:
Pierre Rudloff 2016-05-25 18:39:48 +02:00
parent fd3aa1d4aa
commit 3370695e9e
3 changed files with 49 additions and 116 deletions

View file

@ -7,15 +7,14 @@
"require": { "require": {
"smarty/smarty": "~3.1.29", "smarty/smarty": "~3.1.29",
"rg3/youtube-dl": "2016.04.13", "rg3/youtube-dl": "2016.04.13",
"slim/slim": "~3.4.2", "slim/slim": "1838.x-dev as 3.3.0",
"mathmarques/smarty-view": "~1.1.0", "mathmarques/smarty-view": "~1.1.0",
"symfony/yaml": "~3.0.0", "symfony/yaml": "~3.0.0",
"symfony/process": "~3.0.0", "symfony/process": "~3.0.0",
"ptachoire/process-builder-chain": "~1.2.0", "ptachoire/process-builder-chain": "~1.2.0",
"ffmpeg/ffmpeg": "dev-release", "ffmpeg/ffmpeg": "dev-release",
"rudloff/smarty-plugin-noscheme": "~0.1.0", "rudloff/smarty-plugin-noscheme": "~0.1.0",
"rudloff/rtmpdump-bin": "~2.3", "rudloff/rtmpdump-bin": "~2.3"
"rudloff/psr7-process-stream": "~0.1.0"
}, },
"require-dev": { "require-dev": {
"symfony/var-dumper": "~3.0.0" "symfony/var-dumper": "~3.0.0"
@ -51,6 +50,9 @@
"ffmpeg" "ffmpeg"
] ]
} }
}, {
"type": "vcs",
"url": "https://github.com/llvdl/Slim.git"
}], }],
"authors": [{ "authors": [{
"name": "Pierre Rudloff", "name": "Pierre Rudloff",

153
composer.lock generated
View file

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "a030be591c13e040baf3e3ec52716722", "hash": "6e64354dc4d656c303e0cd83b4ccfda6",
"content-hash": "9ca31c631675ba466325c5a04bff17c1", "content-hash": "4418cbfe45cf745f1f170c49746bfdfd",
"packages": [ "packages": [
{ {
"name": "container-interop/container-interop", "name": "container-interop/container-interop",
@ -48,64 +48,6 @@
], ],
"type": "library" "type": "library"
}, },
{
"name": "guzzlehttp/psr7",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "31382fef2889136415751badebbd1cb022a4ed72"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/31382fef2889136415751badebbd1cb022a4ed72",
"reference": "31382fef2889136415751badebbd1cb022a4ed72",
"shasum": ""
},
"require": {
"php": ">=5.4.0",
"psr/http-message": "~1.0"
},
"provide": {
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "PSR-7 message implementation",
"keywords": [
"http",
"message",
"stream",
"uri"
],
"time": "2016-04-13 19:56:01"
},
{ {
"name": "jeremykendall/php-domain-parser", "name": "jeremykendall/php-domain-parser",
"version": "3.0.0", "version": "3.0.0",
@ -466,39 +408,6 @@
}, },
"type": "library" "type": "library"
}, },
{
"name": "rudloff/psr7-process-stream",
"version": "0.1.0",
"source": {
"type": "git",
"url": "https://github.com/Rudloff/psr7-process-stream.git",
"reference": "055ecbdadee9b43904aed75d5a548c277cac10a8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Rudloff/psr7-process-stream/zipball/055ecbdadee9b43904aed75d5a548c277cac10a8",
"reference": "055ecbdadee9b43904aed75d5a548c277cac10a8",
"shasum": ""
},
"require": {
"guzzlehttp/psr7": "~1.3.0"
},
"require-dev": {
"symfony/var-dumper": "~3.0.0"
},
"type": "library",
"autoload": {
"psr-4": {
"ProcessStream\\": "classes/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-3.0"
],
"description": "PSR-7 stream implementation that can be used to manage processes",
"time": "2016-04-14 10:36:10"
},
{ {
"name": "rudloff/rtmpdump-bin", "name": "rudloff/rtmpdump-bin",
"version": "2.3", "version": "2.3",
@ -570,16 +479,16 @@
}, },
{ {
"name": "slim/slim", "name": "slim/slim",
"version": "3.4.2", "version": "1838.x-dev",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/slimphp/Slim.git", "url": "https://github.com/llvdl/Slim.git",
"reference": "a132385f736063d00632b52b3f8a389fe66fe4fa" "reference": "388272244ab335f2309448e881fb838abed425f1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/slimphp/Slim/zipball/a132385f736063d00632b52b3f8a389fe66fe4fa", "url": "https://api.github.com/repos/llvdl/Slim/zipball/388272244ab335f2309448e881fb838abed425f1",
"reference": "a132385f736063d00632b52b3f8a389fe66fe4fa", "reference": "388272244ab335f2309448e881fb838abed425f1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -602,30 +511,41 @@
"Slim\\": "Slim" "Slim\\": "Slim"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "scripts": {
"test": [
"@phpunit",
"@phpcs"
],
"phpunit": [
"php vendor/bin/phpunit"
],
"phpcs": [
"php vendor/bin/phpcs"
]
},
"license": [ "license": [
"MIT" "MIT"
], ],
"authors": [ "authors": [
{
"name": "Rob Allen",
"email": "rob@akrabat.com",
"homepage": "http://akrabat.com"
},
{ {
"name": "Josh Lockhart", "name": "Josh Lockhart",
"email": "hello@joshlockhart.com", "email": "hello@joshlockhart.com",
"homepage": "https://joshlockhart.com" "homepage": "https://joshlockhart.com"
}, },
{
"name": "Gabriel Manricks",
"email": "gmanricks@me.com",
"homepage": "http://gabrielmanricks.com"
},
{ {
"name": "Andrew Smith", "name": "Andrew Smith",
"email": "a.smith@silentworks.co.uk", "email": "a.smith@silentworks.co.uk",
"homepage": "http://silentworks.co.uk" "homepage": "http://silentworks.co.uk"
},
{
"name": "Rob Allen",
"email": "rob@akrabat.com",
"homepage": "http://akrabat.com"
},
{
"name": "Gabriel Manricks",
"email": "gmanricks@me.com",
"homepage": "http://gabrielmanricks.com"
} }
], ],
"description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs",
@ -636,7 +556,10 @@
"micro", "micro",
"router" "router"
], ],
"time": "2016-05-25 11:23:38" "support": {
"source": "https://github.com/llvdl/Slim/tree/1838"
},
"time": "2016-05-19 08:36:13"
}, },
{ {
"name": "smarty/smarty", "name": "smarty/smarty",
@ -916,9 +839,17 @@
"time": "2016-04-25 11:17:47" "time": "2016-04-25 11:17:47"
} }
], ],
"aliases": [], "aliases": [
{
"alias": "3.3.0",
"alias_normalized": "3.3.0.0",
"version": "1838.9999999.9999999.9999999-dev",
"package": "slim/slim"
}
],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": { "stability-flags": {
"slim/slim": 20,
"ffmpeg/ffmpeg": 20 "ffmpeg/ffmpeg": 20
}, },
"prefer-stable": false, "prefer-stable": false,

View file

@ -16,7 +16,7 @@ use Alltube\VideoDownload;
use Alltube\Config; use Alltube\Config;
use Symfony\Component\Process\ProcessBuilder; use Symfony\Component\Process\ProcessBuilder;
use Chain\Chain; use Chain\Chain;
use ProcessStream\PopenStream; use Slim\Http\Stream;
/** /**
* Main controller * Main controller
@ -200,7 +200,7 @@ class FrontController
$chain->add('|', $avconvProc); $chain->add('|', $avconvProc);
} }
if ($request->isGet()) { if ($request->isGet()) {
$response = $response->withBody(new PopenStream($chain->getProcess()->getCommandLine())); $response = $response->withBody(new Stream(popen($chain->getProcess()->getCommandLine(), 'r')));
} }
return $response; return $response;
} }