From e5631dbd2bcf230496bcefb0b84a70a142a4789d Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sun, 11 Sep 2016 19:11:57 +0200 Subject: [PATCH 01/20] 0.5.2 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fcaf214..894e62f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "alltube", "description": "HTML GUI for youtube-dl", - "version": "0.5.0", + "version": "0.5.2", "author": "Pierre Rudloff", "bugs": "https://github.com/Rudloff/alltube/issues", "dependencies": { From fc04f6f34c0b41f09d3edc623f77c59308dc3557 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 15 Sep 2016 01:33:17 +0200 Subject: [PATCH 02/20] phpcs update --- composer.json | 2 +- composer.lock | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 7350def..635283f 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ }, "require-dev": { "symfony/var-dumper": "~3.1.0", - "squizlabs/php_codesniffer": "~2.6.2", + "squizlabs/php_codesniffer": "~2.7.0", "phpunit/phpunit": "~5.5.2" }, "extra": { diff --git a/composer.lock b/composer.lock index d782024..cb68ecb 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": "a0f80c6bc52ec374622802fb83f64122", - "content-hash": "8d944e2e3dfabcc3c311c954932321f1", + "hash": "02cf80c6d4373a564269fea77fcd50a5", + "content-hash": "efbcfe87c3855d9559551638e85519f3", "packages": [ { "name": "container-interop/container-interop", @@ -759,16 +759,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.5.2", + "version": "1.5.3", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "da8529775f14f4fdae33f916eb0cf65f6afbddbc" + "reference": "94e5ca3e90aa5b34663780393e10914f7438f991" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/da8529775f14f4fdae33f916eb0cf65f6afbddbc", - "reference": "da8529775f14f4fdae33f916eb0cf65f6afbddbc", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/94e5ca3e90aa5b34663780393e10914f7438f991", + "reference": "94e5ca3e90aa5b34663780393e10914f7438f991", "shasum": "" }, "require": { @@ -797,7 +797,7 @@ "object", "object graph" ], - "time": "2016-09-06 16:07:05" + "time": "2016-09-07 15:34:10" }, { "name": "phpdocumentor/reflection-common", @@ -1903,16 +1903,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "2.6.2", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "4edb770cb853def6e60c93abb088ad5ac2010c83" + "reference": "571e27b6348e5b3a637b2abc82ac0d01e6d7bbed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/4edb770cb853def6e60c93abb088ad5ac2010c83", - "reference": "4edb770cb853def6e60c93abb088ad5ac2010c83", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/571e27b6348e5b3a637b2abc82ac0d01e6d7bbed", + "reference": "571e27b6348e5b3a637b2abc82ac0d01e6d7bbed", "shasum": "" }, "require": { @@ -1977,7 +1977,7 @@ "phpcs", "standards" ], - "time": "2016-07-13 23:29:13" + "time": "2016-09-01 23:53:02" }, { "name": "symfony/polyfill-mbstring", From acfbef4a0ab9081f9f6ae7f960e285880dfa282e Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 19 Sep 2016 12:02:14 +0200 Subject: [PATCH 03/20] myclabs/deep-copy update --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index cb68ecb..85c84c7 100644 --- a/composer.lock +++ b/composer.lock @@ -759,16 +759,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.5.3", + "version": "1.5.4", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "94e5ca3e90aa5b34663780393e10914f7438f991" + "reference": "ea74994a3dc7f8d2f65a06009348f2d63c81e61f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/94e5ca3e90aa5b34663780393e10914f7438f991", - "reference": "94e5ca3e90aa5b34663780393e10914f7438f991", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/ea74994a3dc7f8d2f65a06009348f2d63c81e61f", + "reference": "ea74994a3dc7f8d2f65a06009348f2d63c81e61f", "shasum": "" }, "require": { @@ -797,7 +797,7 @@ "object", "object graph" ], - "time": "2016-09-07 15:34:10" + "time": "2016-09-16 13:37:59" }, { "name": "phpdocumentor/reflection-common", From 5b2cd81420b5338f15d20c52da2b4990bb3ea340 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 26 Sep 2016 01:25:00 +0200 Subject: [PATCH 04/20] phpunit update --- composer.lock | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/composer.lock b/composer.lock index 85c84c7..02d9d36 100644 --- a/composer.lock +++ b/composer.lock @@ -1253,24 +1253,24 @@ }, { "name": "phpunit/phpunit", - "version": "5.5.4", + "version": "5.5.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3e6e88e56c912133de6e99b87728cca7ed70c5f5" + "reference": "a57126dc681b08289fef6ac96a48e30656f84350" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6e88e56c912133de6e99b87728cca7ed70c5f5", - "reference": "3e6e88e56c912133de6e99b87728cca7ed70c5f5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a57126dc681b08289fef6ac96a48e30656f84350", + "reference": "a57126dc681b08289fef6ac96a48e30656f84350", "shasum": "" }, "require": { "ext-dom": "*", "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", "myclabs/deep-copy": "~1.3", "php": "^5.6 || ^7.0", "phpspec/prophecy": "^1.3.1", @@ -1292,7 +1292,12 @@ "conflict": { "phpdocumentor/reflection-docblock": "3.0.2" }, + "require-dev": { + "ext-pdo": "*" + }, "suggest": { + "ext-tidy": "*", + "ext-xdebug": "*", "phpunit/php-invoker": "~1.1" }, "bin": [ @@ -1327,7 +1332,7 @@ "testing", "xunit" ], - "time": "2016-08-26 07:11:44" + "time": "2016-09-21 14:40:13" }, { "name": "phpunit/phpunit-mock-objects", From 9010effc31810a794c6dbe95a2a497aa05aab55d Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sun, 2 Oct 2016 20:15:16 +0200 Subject: [PATCH 05/20] One too many middot --- templates/inc/footer.tpl | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/inc/footer.tpl b/templates/inc/footer.tpl index cdbb327..222dc1d 100644 --- a/templates/inc/footer.tpl +++ b/templates/inc/footer.tpl @@ -14,7 +14,6 @@ Get the code · Based on youtube-dl - · From 74278c8b29892956c50319d78891e8f1367f224f Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Wed, 5 Oct 2016 01:44:22 +0200 Subject: [PATCH 06/20] Dependencies update --- composer.lock | 60 +++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/composer.lock b/composer.lock index 02d9d36..fb050c7 100644 --- a/composer.lock +++ b/composer.lock @@ -605,16 +605,16 @@ }, { "name": "symfony/process", - "version": "v3.1.4", + "version": "v3.1.5", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "e64e93041c80e77197ace5ab9385dedb5a143697" + "reference": "66de154ae86b1a07001da9fbffd620206e4faf94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/e64e93041c80e77197ace5ab9385dedb5a143697", - "reference": "e64e93041c80e77197ace5ab9385dedb5a143697", + "url": "https://api.github.com/repos/symfony/process/zipball/66de154ae86b1a07001da9fbffd620206e4faf94", + "reference": "66de154ae86b1a07001da9fbffd620206e4faf94", "shasum": "" }, "require": { @@ -650,20 +650,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-08-16 14:58:24" + "time": "2016-09-29 14:13:09" }, { "name": "symfony/yaml", - "version": "v3.1.4", + "version": "v3.1.5", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "f291ed25eb1435bddbe8a96caaef16469c2a092d" + "reference": "368b9738d4033c8b93454cb0dbd45d305135a6d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/f291ed25eb1435bddbe8a96caaef16469c2a092d", - "reference": "f291ed25eb1435bddbe8a96caaef16469c2a092d", + "url": "https://api.github.com/repos/symfony/yaml/zipball/368b9738d4033c8b93454cb0dbd45d305135a6d3", + "reference": "368b9738d4033c8b93454cb0dbd45d305135a6d3", "shasum": "" }, "require": { @@ -699,7 +699,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-09-02 02:12:52" + "time": "2016-09-25 08:27:07" } ], "packages-dev": [ @@ -855,16 +855,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.1.0", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "9270140b940ff02e58ec577c237274e92cd40cdd" + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9270140b940ff02e58ec577c237274e92cd40cdd", - "reference": "9270140b940ff02e58ec577c237274e92cd40cdd", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", "shasum": "" }, "require": { @@ -896,7 +896,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-06-10 09:48:41" + "time": "2016-09-30 07:12:33" }, { "name": "phpdocumentor/type-resolver", @@ -1253,16 +1253,16 @@ }, { "name": "phpunit/phpunit", - "version": "5.5.5", + "version": "5.5.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a57126dc681b08289fef6ac96a48e30656f84350" + "reference": "146e0fe0bb7f44d1cefade0c93e86fe0b206dd79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a57126dc681b08289fef6ac96a48e30656f84350", - "reference": "a57126dc681b08289fef6ac96a48e30656f84350", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/146e0fe0bb7f44d1cefade0c93e86fe0b206dd79", + "reference": "146e0fe0bb7f44d1cefade0c93e86fe0b206dd79", "shasum": "" }, "require": { @@ -1332,20 +1332,20 @@ "testing", "xunit" ], - "time": "2016-09-21 14:40:13" + "time": "2016-10-03 07:48:45" }, { "name": "phpunit/phpunit-mock-objects", - "version": "3.2.7", + "version": "3.3.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "546898a2c0c356ef2891b39dd7d07f5d82c8ed0a" + "reference": "03500345483e1e17b52e2e4d34a89c9408ab2902" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/546898a2c0c356ef2891b39dd7d07f5d82c8ed0a", - "reference": "546898a2c0c356ef2891b39dd7d07f5d82c8ed0a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/03500345483e1e17b52e2e4d34a89c9408ab2902", + "reference": "03500345483e1e17b52e2e4d34a89c9408ab2902", "shasum": "" }, "require": { @@ -1391,7 +1391,7 @@ "mock", "xunit" ], - "time": "2016-09-06 16:07:45" + "time": "2016-10-04 11:03:26" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -2045,16 +2045,16 @@ }, { "name": "symfony/var-dumper", - "version": "v3.1.4", + "version": "v3.1.5", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "62ee73706c421654a4c840028954510277f7dfc8" + "reference": "70bfe927b86ba9999aeebd829715b0bb2cd39a10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/62ee73706c421654a4c840028954510277f7dfc8", - "reference": "62ee73706c421654a4c840028954510277f7dfc8", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/70bfe927b86ba9999aeebd829715b0bb2cd39a10", + "reference": "70bfe927b86ba9999aeebd829715b0bb2cd39a10", "shasum": "" }, "require": { @@ -2104,7 +2104,7 @@ "debug", "dump" ], - "time": "2016-08-31 09:05:42" + "time": "2016-09-29 14:13:09" }, { "name": "webmozart/assert", From fe6dc616f6b1fda2f7b0450092a8c80555bb1da8 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Wed, 5 Oct 2016 17:08:46 +0200 Subject: [PATCH 07/20] Lint --- FAQ.md | 9 +++++++++ README.md | 20 ++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/FAQ.md b/FAQ.md index 52c7ed6..4408477 100644 --- a/FAQ.md +++ b/FAQ.md @@ -1,12 +1,17 @@ # Frequently asked questions + + ## My browser plays the video. How do I download it? + Most recent browsers automatically play a video if it is a format they know how to play. You can ususally download the video by doing *File > Save to* or *ctrl + S*. ## How do I change config parameters? + You need to create a YAML file called `config.yml` at the root of your project. Here are the parameters that you can set: + * youtubedl: path to your youtube-dl binary * python: path to your python binary * params: an array of parameters to pass to youtube-dl @@ -18,12 +23,16 @@ Here are the parameters that you can set: See [config.example.yml](config.example.yml) for default values. ## How do I enable audio conversion? + In order to enable audio conversion, you need to add this to your `config.yml` file: + ```yaml convert: true avconv: path/to/avconv ``` + You will also need to install `avconv` and `curl` on your server: + ```bash sudo apt-get install libav-tools curl ``` diff --git a/README.md b/README.md index 483b269..b659c3d 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,21 @@ -Alltube Download -======= +# Alltube Download -HTML GUI for youtube-dl (http://alltubedownload.net/) +HTML GUI for youtube-dl ([alltubedownload.net](http://alltubedownload.net/)) ![Screenshot](img/screenshot.png "Alltube GUI screenshot") ## Setup ### From a release package + You can download the latest release package [here](https://github.com/Rudloff/alltube/releases). You just have to unzip it on your server and it should be ready to use. ### From Git + In order to get AllTube working, you need to use [npm](https://www.npmjs.com/) and [Composer](https://getcomposer.org/): + ```bash npm install composer install @@ -24,6 +26,7 @@ This will download all the required dependencies. (Note that it will download the ffmpeg binary for 64-bits Linux. If you are on another platform, you might want to specify the path to avconv/ffmpeg in your config file.) You should also ensure that the *templates_c* folder has the right permissions: + ```bash chmod 777 templates_c/ ``` @@ -33,19 +36,24 @@ If your web server is Apache, you need to set the `AllowOverride` setting to `Al ## Config If you want to use a custom config, you need to create a config file: + ```bash cp config.example.yml config.yml ``` ## Web server configuration + ### Apache + You will need the following modules: * mod_mime * mod_rewrite ### Nginx + Here is an exemple Nginx configuration: + ```nginx server { server_name localhost; @@ -94,16 +102,20 @@ server { ``` ## License + This software is available under the [GNU General Public License](http://www.gnu.org/licenses/gpl.html). -__Please use a different name and logo if you run it on a public server.__ +Please __use a different name and logo__ if you run it on a public server. ## Other dependencies + You need [avconv](https://libav.org/avconv.html), [rtmpdump](http://rtmpdump.mplayerhq.hu/) and [curl](https://curl.haxx.se/) in order to enable conversions. If you don't want to enable conversions, you can disable it in *config.yml*. On Debian-based systems: + ```bash sudo apt-get install libav-tools rtmpdump curl ``` + You also probably need to edit the *avconv* variable in *config.yml* so that it points to your ffmpeg/avconv binary (*/usr/bin/avconv* on Debian/Ubuntu). From 99c51b6fcc39c79a218073f50d8b731b08c5beb2 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Wed, 5 Oct 2016 17:16:28 +0200 Subject: [PATCH 08/20] Add Heroku instructions to FAQ --- FAQ.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/FAQ.md b/FAQ.md index 4408477..276dfc5 100644 --- a/FAQ.md +++ b/FAQ.md @@ -36,3 +36,12 @@ You will also need to install `avconv` and `curl` on your server: ```bash sudo apt-get install libav-tools curl ``` + +## How do I deploy Alltube on Heroku? + +Create a dyno with the following buildpacks: + +* `heroku/php` +* `https://github.com/heroku/heroku-buildpack-nodejs` + +Then push the code to Heroku and it should work out of the box. From 11f15cb4bea76dfe43f7bd0dc1940f5dfafdf898 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Wed, 5 Oct 2016 23:27:35 +0200 Subject: [PATCH 09/20] Gzip fonts --- .htaccess | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.htaccess b/.htaccess index 8fc5b69..8ccd69c 100644 --- a/.htaccess +++ b/.htaccess @@ -24,4 +24,4 @@ RewriteRule ^ index.php [QSA,L] Redirect permanent /api.php /video Redirect permanent /extractors.php /extractors -AddOutputFilterByType DEFLATE text/css text/html application/javascript +AddOutputFilterByType DEFLATE text/css text/html application/javascript font/truetype From a4eb9ba2fedceb275e775896884d3cdb30661045 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sun, 9 Oct 2016 11:41:09 +0200 Subject: [PATCH 10/20] Add PHP requirements in README --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index b659c3d..50e5de7 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,15 @@ If you want to use a custom config, you need to create a config file: cp config.example.yml config.yml ``` +## PHP requirements + +You will need PHP 5.5 (or higher) and the following PHP modules: + +* fileinfo +* intl +* mbstring +* curl + ## Web server configuration ### Apache From 4276a3b553b932cf7f4f7cd1030deff4fca8f957 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 10 Oct 2016 17:05:36 +0200 Subject: [PATCH 11/20] Add info about feature/stream branch in FAQ --- FAQ.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/FAQ.md b/FAQ.md index 276dfc5..1bfb336 100644 --- a/FAQ.md +++ b/FAQ.md @@ -45,3 +45,13 @@ Create a dyno with the following buildpacks: * `https://github.com/heroku/heroku-buildpack-nodejs` Then push the code to Heroku and it should work out of the box. + +## Why can't I download videos from some websites (e.g. Dailymotion) + +Some websites generate an unique video URL for each IP address. When using Alltube, the URL is generated for our server's IP address and your computer is not allowed to use it. + +There are two known workarounds: + +* You can run Alltube locally on your computer. +* You can use the experimental `feature/stream` branch which streams the video through the server in order to bypass IP restrictions. + Please note that this can use a lot of resources on the server (which is why we won't enable it on alltubedownload.net). From 793aa9f5349ad03e0a4b484b179e435165ba1ea5 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 10 Oct 2016 17:07:19 +0200 Subject: [PATCH 12/20] Add link to FAQ in README Use ` instead of * in markdown --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 50e5de7..63fea97 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ Please __use a different name and logo__ if you run it on a public server. ## Other dependencies You need [avconv](https://libav.org/avconv.html), [rtmpdump](http://rtmpdump.mplayerhq.hu/) and [curl](https://curl.haxx.se/) in order to enable conversions. -If you don't want to enable conversions, you can disable it in *config.yml*. +If you don't want to enable conversions, you can disable it in `config.yml`. On Debian-based systems: @@ -127,4 +127,8 @@ On Debian-based systems: sudo apt-get install libav-tools rtmpdump curl ``` -You also probably need to edit the *avconv* variable in *config.yml* so that it points to your ffmpeg/avconv binary (*/usr/bin/avconv* on Debian/Ubuntu). +You also probably need to edit the `avconv` variable in `config.yml` so that it points to your ffmpeg/avconv binary (`/usr/bin/avconv` on Debian/Ubuntu). + +## FAQ + +Please read the [FAQ](FAQ.md) before reporting any issue. From 1b5054159cec4124da530141902f7143678ab7a3 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 10 Oct 2016 21:30:07 +0200 Subject: [PATCH 13/20] Cast bool because getenv always returns string --- classes/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Config.php b/classes/Config.php index 208e85b..674717b 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -100,7 +100,7 @@ class Config } } if (getenv('CONVERT')) { - $this->convert = getenv('CONVERT'); + $this->convert = (bool) getenv('CONVERT'); } } From 6db29d325ea22f0623bac7eb3d3ab1e667c5eed9 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 10 Oct 2016 21:32:07 +0200 Subject: [PATCH 14/20] Undeclared class properties --- classes/VideoDownload.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/classes/VideoDownload.php b/classes/VideoDownload.php index e497113..c7aba78 100644 --- a/classes/VideoDownload.php +++ b/classes/VideoDownload.php @@ -12,6 +12,9 @@ use Symfony\Component\Process\ProcessBuilder; */ class VideoDownload { + private $config; + private $procBuilder; + /** * VideoDownload constructor. */ From 7746d7d26a5d2094c3c36c0edbe300fa7f4d8ced Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 10 Oct 2016 21:34:38 +0200 Subject: [PATCH 15/20] addSlimPlugins is deprecated --- index.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 0653081..f9fdd7d 100644 --- a/index.php +++ b/index.php @@ -13,7 +13,10 @@ $container = $app->getContainer(); $container['view'] = function ($c) { $view = new \Slim\Views\Smarty(__DIR__.'/templates/'); - $view->addSlimPlugins($c['router'], $c['request']->getUri()); + $smartyPlugins = new \Slim\Views\SmartyPlugins($c['router'], $c['request']->getUri()); + $view->registerPlugin('function', 'path_for', [$smartyPlugins, 'pathFor']); + $view->registerPlugin('function', 'base_url', [$smartyPlugins, 'baseUrl']); + $view->registerPlugin('modifier', 'noscheme', 'Smarty_Modifier_noscheme'); From 98839d277e7ea9efe2ca12555122b003968c84e6 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 13 Oct 2016 14:41:47 +0200 Subject: [PATCH 16/20] We need npm 3 (see #72) --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 894e62f..eb8b13b 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,9 @@ "grunt-phpdocumentor": "~0.4.1", "grunt-phpunit": "~0.3.6" }, + "engines": { + "npm": "~3" + }, "homepage": "https://www.alltubedownload.net/", "keywords": [ "alltube", From 5de8e9d8cc9e1f59996fc87d3004b6d34597103f Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 13 Oct 2016 16:34:57 +0200 Subject: [PATCH 17/20] Use interface instead of concrete classe --- controllers/FrontController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 2348db8..5b36dbb 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -6,7 +6,7 @@ namespace Alltube\Controller; use Alltube\Config; use Alltube\VideoDownload; -use Slim\Container; +use Interop\Container\ContainerInterface; use Slim\Http\Request; use Slim\Http\Response; use Slim\Http\Stream; @@ -42,7 +42,7 @@ class FrontController * * @param Container $container Slim dependency container */ - public function __construct(Container $container) + public function __construct(ContainerInterface $container) { $this->config = Config::getInstance(); $this->download = new VideoDownload(); From 9ad024888ab2273734f71d214e811ad6a2d960d5 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 13 Oct 2016 16:40:19 +0200 Subject: [PATCH 18/20] Refactor getter classes --- classes/VideoDownload.php | 83 ++++++++++++++------------------------- 1 file changed, 29 insertions(+), 54 deletions(-) diff --git a/classes/VideoDownload.php b/classes/VideoDownload.php index c7aba78..39fa401 100644 --- a/classes/VideoDownload.php +++ b/classes/VideoDownload.php @@ -48,47 +48,11 @@ class VideoDownload return explode(PHP_EOL, trim($process->getOutput())); } - /** - * Get all information about a video. - * - * @param string $url URL of page - * @param string $format Format to use for the video - * - * @return object Decoded JSON - * */ - public function getJSON($url, $format = null) + private function getProp($url, $format = null, $prop = 'dump-json') { $this->procBuilder->setArguments( [ - '--dump-json', - $url, - ] - ); - if (isset($format)) { - $this->procBuilder->add('-f '.$format); - } - $process = $this->procBuilder->getProcess(); - $process->run(); - if (!$process->isSuccessful()) { - throw new \Exception($process->getErrorOutput()); - } else { - return json_decode($process->getOutput()); - } - } - - /** - * Get URL of video from URL of page. - * - * @param string $url URL of page - * @param string $format Format to use for the video - * - * @return string URL of video - * */ - public function getURL($url, $format = null) - { - $this->procBuilder->setArguments( - [ - '--get-url', + '--'.$prop, $url, ] ); @@ -104,6 +68,32 @@ class VideoDownload } } + /** + * Get all information about a video. + * + * @param string $url URL of page + * @param string $format Format to use for the video + * + * @return object Decoded JSON + * */ + public function getJSON($url, $format = null) + { + return json_decode($this->getProp($url, $format, 'dump-json')); + } + + /** + * Get URL of video from URL of page. + * + * @param string $url URL of page + * @param string $format Format to use for the video + * + * @return string URL of video + * */ + public function getURL($url, $format = null) + { + return $this->getProp($url, $format, 'get-url'); + } + /** * Get filename of video file from URL of page. * @@ -114,22 +104,7 @@ class VideoDownload * */ public function getFilename($url, $format = null) { - $this->procBuilder->setArguments( - [ - '--get-filename', - $url, - ] - ); - if (isset($format)) { - $this->procBuilder->add('-f '.$format); - } - $process = $this->procBuilder->getProcess(); - $process->run(); - if (!$process->isSuccessful()) { - throw new \Exception($process->getErrorOutput()); - } else { - return trim($process->getOutput()); - } + return trim($this->getProp($url, $format, 'get-filename')); } /** From 41b9be34c5653a99020c8f6f92f595adb1e85fc8 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 13 Oct 2016 16:53:23 +0200 Subject: [PATCH 19/20] Wrong class in doc comment --- controllers/FrontController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 5b36dbb..0a6bdf1 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -33,7 +33,7 @@ class FrontController /** * Slim dependency container. * - * @var Container + * @var ContainerInterface */ private $container; From 3a31cc0008f2cf5daa4852c14f287cb78ef44aed Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 13 Oct 2016 17:02:41 +0200 Subject: [PATCH 20/20] Check that we have a Slim container --- controllers/FrontController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 0a6bdf1..aabd740 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -7,6 +7,7 @@ namespace Alltube\Controller; use Alltube\Config; use Alltube\VideoDownload; use Interop\Container\ContainerInterface; +use Slim\Container; use Slim\Http\Request; use Slim\Http\Response; use Slim\Http\Stream; @@ -46,7 +47,9 @@ class FrontController { $this->config = Config::getInstance(); $this->download = new VideoDownload(); - $this->container = $container; + if ($container instanceof Container) { + $this->container = $container; + } } /**