From 3370695e9e94cf82947e1c4f16739c7fbcc7793d Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Wed, 25 May 2016 18:39:48 +0200 Subject: [PATCH 1/2] Use https://github.com/slimphp/Slim/pull/1872 in order to support popen streams in Slim --- composer.json | 8 +- composer.lock | 153 +++++++++----------------------- controllers/FrontController.php | 4 +- 3 files changed, 49 insertions(+), 116 deletions(-) diff --git a/composer.json b/composer.json index a5262bd..f2ae385 100644 --- a/composer.json +++ b/composer.json @@ -7,15 +7,14 @@ "require": { "smarty/smarty": "~3.1.29", "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", "symfony/yaml": "~3.0.0", "symfony/process": "~3.0.0", "ptachoire/process-builder-chain": "~1.2.0", "ffmpeg/ffmpeg": "dev-release", "rudloff/smarty-plugin-noscheme": "~0.1.0", - "rudloff/rtmpdump-bin": "~2.3", - "rudloff/psr7-process-stream": "~0.1.0" + "rudloff/rtmpdump-bin": "~2.3" }, "require-dev": { "symfony/var-dumper": "~3.0.0" @@ -51,6 +50,9 @@ "ffmpeg" ] } + }, { + "type": "vcs", + "url": "https://github.com/llvdl/Slim.git" }], "authors": [{ "name": "Pierre Rudloff", diff --git a/composer.lock b/composer.lock index 94b927c..888d03b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "a030be591c13e040baf3e3ec52716722", - "content-hash": "9ca31c631675ba466325c5a04bff17c1", + "hash": "6e64354dc4d656c303e0cd83b4ccfda6", + "content-hash": "4418cbfe45cf745f1f170c49746bfdfd", "packages": [ { "name": "container-interop/container-interop", @@ -48,64 +48,6 @@ ], "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", "version": "3.0.0", @@ -466,39 +408,6 @@ }, "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", "version": "2.3", @@ -570,16 +479,16 @@ }, { "name": "slim/slim", - "version": "3.4.2", + "version": "1838.x-dev", "source": { "type": "git", - "url": "https://github.com/slimphp/Slim.git", - "reference": "a132385f736063d00632b52b3f8a389fe66fe4fa" + "url": "https://github.com/llvdl/Slim.git", + "reference": "388272244ab335f2309448e881fb838abed425f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slimphp/Slim/zipball/a132385f736063d00632b52b3f8a389fe66fe4fa", - "reference": "a132385f736063d00632b52b3f8a389fe66fe4fa", + "url": "https://api.github.com/repos/llvdl/Slim/zipball/388272244ab335f2309448e881fb838abed425f1", + "reference": "388272244ab335f2309448e881fb838abed425f1", "shasum": "" }, "require": { @@ -602,30 +511,41 @@ "Slim\\": "Slim" } }, - "notification-url": "https://packagist.org/downloads/", + "scripts": { + "test": [ + "@phpunit", + "@phpcs" + ], + "phpunit": [ + "php vendor/bin/phpunit" + ], + "phpcs": [ + "php vendor/bin/phpcs" + ] + }, "license": [ "MIT" ], "authors": [ - { - "name": "Rob Allen", - "email": "rob@akrabat.com", - "homepage": "http://akrabat.com" - }, { "name": "Josh Lockhart", "email": "hello@joshlockhart.com", "homepage": "https://joshlockhart.com" }, - { - "name": "Gabriel Manricks", - "email": "gmanricks@me.com", - "homepage": "http://gabrielmanricks.com" - }, { "name": "Andrew Smith", "email": "a.smith@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", @@ -636,7 +556,10 @@ "micro", "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", @@ -916,9 +839,17 @@ "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", "stability-flags": { + "slim/slim": 20, "ffmpeg/ffmpeg": 20 }, "prefer-stable": false, diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 15e00bb..1c8939a 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -16,7 +16,7 @@ use Alltube\VideoDownload; use Alltube\Config; use Symfony\Component\Process\ProcessBuilder; use Chain\Chain; -use ProcessStream\PopenStream; +use Slim\Http\Stream; /** * Main controller @@ -200,7 +200,7 @@ class FrontController $chain->add('|', $avconvProc); } if ($request->isGet()) { - $response = $response->withBody(new PopenStream($chain->getProcess()->getCommandLine())); + $response = $response->withBody(new Stream(popen($chain->getProcess()->getCommandLine(), 'r'))); } return $response; } From c10115f9af6d0d8ba496730b50ca8a76c55688b9 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 26 May 2016 18:27:30 +0200 Subject: [PATCH 2/2] popen streams have been merged in upstream Slim --- composer.json | 5 +---- composer.lock | 61 +++++++++++++++++---------------------------------- 2 files changed, 21 insertions(+), 45 deletions(-) diff --git a/composer.json b/composer.json index f2ae385..bf9dcd0 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "require": { "smarty/smarty": "~3.1.29", "rg3/youtube-dl": "2016.04.13", - "slim/slim": "1838.x-dev as 3.3.0", + "slim/slim": "3.x-dev", "mathmarques/smarty-view": "~1.1.0", "symfony/yaml": "~3.0.0", "symfony/process": "~3.0.0", @@ -50,9 +50,6 @@ "ffmpeg" ] } - }, { - "type": "vcs", - "url": "https://github.com/llvdl/Slim.git" }], "authors": [{ "name": "Pierre Rudloff", diff --git a/composer.lock b/composer.lock index 888d03b..e8224f9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "6e64354dc4d656c303e0cd83b4ccfda6", - "content-hash": "4418cbfe45cf745f1f170c49746bfdfd", + "hash": "e173fa909efaf932dcbc99c365645eaf", + "content-hash": "54da2bfd3a8f04d66a1cd4465ec0a261", "packages": [ { "name": "container-interop/container-interop", @@ -479,16 +479,16 @@ }, { "name": "slim/slim", - "version": "1838.x-dev", + "version": "3.x-dev", "source": { "type": "git", - "url": "https://github.com/llvdl/Slim.git", - "reference": "388272244ab335f2309448e881fb838abed425f1" + "url": "https://github.com/slimphp/Slim.git", + "reference": "30cfe3c07dac28ec1129c0577e64b90ba11a54c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/llvdl/Slim/zipball/388272244ab335f2309448e881fb838abed425f1", - "reference": "388272244ab335f2309448e881fb838abed425f1", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/30cfe3c07dac28ec1129c0577e64b90ba11a54c4", + "reference": "30cfe3c07dac28ec1129c0577e64b90ba11a54c4", "shasum": "" }, "require": { @@ -511,41 +511,30 @@ "Slim\\": "Slim" } }, - "scripts": { - "test": [ - "@phpunit", - "@phpcs" - ], - "phpunit": [ - "php vendor/bin/phpunit" - ], - "phpcs": [ - "php vendor/bin/phpcs" - ] - }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "Josh Lockhart", - "email": "hello@joshlockhart.com", - "homepage": "https://joshlockhart.com" - }, - { - "name": "Andrew Smith", - "email": "a.smith@silentworks.co.uk", - "homepage": "http://silentworks.co.uk" - }, { "name": "Rob Allen", "email": "rob@akrabat.com", "homepage": "http://akrabat.com" }, + { + "name": "Josh Lockhart", + "email": "hello@joshlockhart.com", + "homepage": "https://joshlockhart.com" + }, { "name": "Gabriel Manricks", "email": "gmanricks@me.com", "homepage": "http://gabrielmanricks.com" + }, + { + "name": "Andrew Smith", + "email": "a.smith@silentworks.co.uk", + "homepage": "http://silentworks.co.uk" } ], "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", @@ -556,10 +545,7 @@ "micro", "router" ], - "support": { - "source": "https://github.com/llvdl/Slim/tree/1838" - }, - "time": "2016-05-19 08:36:13" + "time": "2016-05-26 08:20:33" }, { "name": "smarty/smarty", @@ -839,14 +825,7 @@ "time": "2016-04-25 11:17:47" } ], - "aliases": [ - { - "alias": "3.3.0", - "alias_normalized": "3.3.0.0", - "version": "1838.9999999.9999999.9999999-dev", - "package": "slim/slim" - } - ], + "aliases": [], "minimum-stability": "stable", "stability-flags": { "slim/slim": 20,