diff --git a/classes/Config.php b/classes/Config.php index e302bf7..4587082 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -126,6 +126,13 @@ class Config */ private $file; + /** + * Generic formats supported by youtube-dl. + * + * @var array + */ + public $genericFormats = []; + /** * Config constructor. * @@ -135,6 +142,42 @@ class Config { $this->applyOptions($options); $this->getEnv(); + + if (empty($this->genericFormats)) { + // We don't put this in the class definition so it can be detected by xgettext. + $this->genericFormats = [ + 'best' => _('Best'), + 'bestvideo+bestaudio' => _('Remux best video with best audio'), + 'worst' => _('Worst'), + ]; + } + + foreach ($this->genericFormats as $format => $name) { + if (strpos($format, '+') !== false) { + if (!$this->remux) { + // Disable combined formats if remux mode is not enabled. + unset($this->genericFormats[$format]); + } + } elseif (!$this->stream) { + // Force HTTP if stream is not enabled. + $this->replaceGenericFormat($format, $format.'[protocol=https]/'.$format.'[protocol=http]'); + } + } + } + + /** + * Replace a format key. + * + * @param string $oldFormat Old format + * @param string $newFormat New format + * + * @return void + */ + private function replaceGenericFormat($oldFormat, $newFormat) + { + $keys = array_keys($this->genericFormats); + $keys[array_search($oldFormat, $keys)] = $newFormat; + $this->genericFormats = array_combine($keys, $this->genericFormats); } /** diff --git a/classes/streams/YoutubeStream.php b/classes/streams/YoutubeStream.php index 9c413aa..ad03432 100644 --- a/classes/streams/YoutubeStream.php +++ b/classes/streams/YoutubeStream.php @@ -29,7 +29,7 @@ class YoutubeStream extends AppendStream while ($rangeStart < $contentLenghtHeader[0]) { $rangeEnd = $rangeStart + $video->downloader_options->http_chunk_size; - if ($rangeEnd > $contentLenghtHeader[0]) { + if ($rangeEnd >= $contentLenghtHeader[0]) { $rangeEnd = $contentLenghtHeader[0] - 1; } $response = $video->getHttpResponse(['Range' => 'bytes='.$rangeStart.'-'.$rangeEnd]); diff --git a/composer.json b/composer.json index b20218c..b0cfd52 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "phpunit/phpunit": "~6.5.2", "doctrine/instantiator": "~1.0.0", "ffmpeg/ffmpeg": "4.0.3", - "rg3/youtube-dl": "2019.04.24", + "rg3/youtube-dl": "2019.06.08", "heroku/heroku-buildpack-php": "*", "anam/phantomjs-linux-x86-binary": "~2.1.1", "phpstan/phpstan": "~0.9.2" @@ -40,10 +40,10 @@ "type": "package", "package": { "name": "rg3/youtube-dl", - "version": "2019.04.24", + "version": "2019.06.08", "dist": { "type": "zip", - "url": "https://github.com/rg3/youtube-dl/archive/2019.04.24.zip" + "url": "https://github.com/rg3/youtube-dl/archive/2019.06.08.zip" } } }, diff --git a/composer.lock b/composer.lock index 7caa1ab..1e7da22 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "443a32df39c89bd4e58525b41a2de772", + "content-hash": "f3bddc2f05cda62b6b39205b028293fd", "packages": [ { "name": "aura/session", @@ -533,16 +533,16 @@ }, { "name": "php-mock/php-mock", - "version": "2.1.1", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/php-mock/php-mock.git", - "reference": "e2eea560cb01502148ca895221f0b58806c5a4df" + "reference": "35379d7b382b787215617f124662d9ead72c15e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-mock/php-mock/zipball/e2eea560cb01502148ca895221f0b58806c5a4df", - "reference": "e2eea560cb01502148ca895221f0b58806c5a4df", + "url": "https://api.github.com/repos/php-mock/php-mock/zipball/35379d7b382b787215617f124662d9ead72c15e3", + "reference": "35379d7b382b787215617f124662d9ead72c15e3", "shasum": "" }, "require": { @@ -565,10 +565,7 @@ "classes/", "tests/" ] - }, - "files": [ - "autoload.php" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -593,7 +590,7 @@ "test", "test double" ], - "time": "2019-04-05T22:15:19+00:00" + "time": "2019-06-05T20:10:01+00:00" }, { "name": "php-mock/php-mock-integration", @@ -1245,16 +1242,16 @@ }, { "name": "symfony/process", - "version": "v3.4.26", + "version": "v3.4.28", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "a9c4dfbf653023b668c282e4e02609d131f4057a" + "reference": "afe411c2a6084f25cff55a01d0d4e1474c97ff13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/a9c4dfbf653023b668c282e4e02609d131f4057a", - "reference": "a9c4dfbf653023b668c282e4e02609d131f4057a", + "url": "https://api.github.com/repos/symfony/process/zipball/afe411c2a6084f25cff55a01d0d4e1474c97ff13", + "reference": "afe411c2a6084f25cff55a01d0d4e1474c97ff13", "shasum": "" }, "require": { @@ -1290,11 +1287,11 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-04-08T16:15:54+00:00" + "time": "2019-05-22T12:54:11+00:00" }, { "name": "symfony/yaml", - "version": "v3.4.26", + "version": "v3.4.28", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -1495,7 +1492,9 @@ "version": "4.0.3", "dist": { "type": "xz", - "url": "https://www.johnvansickle.com/ffmpeg/old-releases/ffmpeg-4.0.3-64bit-static.tar.xz" + "url": "https://www.johnvansickle.com/ffmpeg/old-releases/ffmpeg-4.0.3-64bit-static.tar.xz", + "reference": null, + "shasum": null }, "bin": [ "ffmpeg" @@ -1504,16 +1503,16 @@ }, { "name": "heroku/heroku-buildpack-php", - "version": "v154", + "version": "v157", "source": { "type": "git", "url": "https://github.com/heroku/heroku-buildpack-php.git", - "reference": "2625279c4b3caf5e2937308d07d4357b411d04d0" + "reference": "62a691bf5937d35a7236c581734352208037d710" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/heroku/heroku-buildpack-php/zipball/2625279c4b3caf5e2937308d07d4357b411d04d0", - "reference": "2625279c4b3caf5e2937308d07d4357b411d04d0", + "url": "https://api.github.com/repos/heroku/heroku-buildpack-php/zipball/62a691bf5937d35a7236c581734352208037d710", + "reference": "62a691bf5937d35a7236c581734352208037d710", "shasum": "" }, "bin": [ @@ -1544,7 +1543,7 @@ "nginx", "php" ], - "time": "2019-04-04T22:05:24+00:00" + "time": "2019-06-13T20:23:59+00:00" }, { "name": "jean85/pretty-package-versions", @@ -1599,25 +1598,28 @@ }, { "name": "myclabs/deep-copy", - "version": "1.7.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" }, "require-dev": { "doctrine/collections": "^1.0", "doctrine/common": "^2.6", - "phpunit/phpunit": "^4.1" + "phpunit/phpunit": "^7.1" }, "type": "library", "autoload": { @@ -1640,43 +1642,40 @@ "object", "object graph" ], - "time": "2017-10-19T19:58:43+00:00" + "time": "2019-04-07T13:18:21+00:00" }, { "name": "nette/bootstrap", - "version": "v2.4.6", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/nette/bootstrap.git", - "reference": "268816e3f1bb7426c3a4ceec2bd38a036b532543" + "reference": "e1075af05c211915e03e0c86542f3ba5433df4a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/bootstrap/zipball/268816e3f1bb7426c3a4ceec2bd38a036b532543", - "reference": "268816e3f1bb7426c3a4ceec2bd38a036b532543", + "url": "https://api.github.com/repos/nette/bootstrap/zipball/e1075af05c211915e03e0c86542f3ba5433df4a3", + "reference": "e1075af05c211915e03e0c86542f3ba5433df4a3", "shasum": "" }, "require": { - "nette/di": "~2.4.7", - "nette/utils": "~2.4", - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" + "nette/di": "^3.0", + "nette/utils": "^3.0", + "php": ">=7.1" }, "require-dev": { - "latte/latte": "~2.2", - "nette/application": "~2.3", - "nette/caching": "~2.3", - "nette/database": "~2.3", - "nette/forms": "~2.3", - "nette/http": "~2.4.0", - "nette/mail": "~2.3", - "nette/robot-loader": "^2.4.2 || ^3.0", - "nette/safe-stream": "~2.2", - "nette/security": "~2.3", - "nette/tester": "~2.0", - "tracy/tracy": "^2.4.1" + "latte/latte": "^2.2", + "nette/application": "^3.0", + "nette/caching": "^3.0", + "nette/database": "^3.0", + "nette/forms": "^3.0", + "nette/http": "^3.0", + "nette/mail": "^3.0", + "nette/robot-loader": "^3.0", + "nette/safe-stream": "^2.2", + "nette/security": "^3.0", + "nette/tester": "^2.0", + "tracy/tracy": "^2.6" }, "suggest": { "nette/robot-loader": "to use Configurator::createRobotLoader()", @@ -1685,7 +1684,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1709,53 +1708,57 @@ "homepage": "https://nette.org/contributors" } ], - "description": "? Nette Bootstrap: the simple way to configure and bootstrap your Nette application.", + "description": "🅱 Nette Bootstrap: the simple way to configure and bootstrap your Nette application.", "homepage": "https://nette.org", "keywords": [ "bootstrapping", "configurator", "nette" ], - "time": "2018-05-17T12:52:20+00:00" + "time": "2019-03-26T12:59:07+00:00" }, { "name": "nette/di", - "version": "v2.4.15", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/nette/di.git", - "reference": "d0561b8f77e8ef2ed6d83328860e16c81a5a8649" + "reference": "19d83539245aaacb59470828919182411061841f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/di/zipball/d0561b8f77e8ef2ed6d83328860e16c81a5a8649", - "reference": "d0561b8f77e8ef2ed6d83328860e16c81a5a8649", + "url": "https://api.github.com/repos/nette/di/zipball/19d83539245aaacb59470828919182411061841f", + "reference": "19d83539245aaacb59470828919182411061841f", "shasum": "" }, "require": { "ext-tokenizer": "*", - "nette/neon": "^2.3.3 || ~3.0.0", - "nette/php-generator": "^2.6.1 || ^3.0.0", - "nette/utils": "^2.5.0 || ~3.0.0", - "php": ">=5.6.0" + "nette/neon": "^3.0", + "nette/php-generator": "^3.2.2", + "nette/robot-loader": "^3.2", + "nette/schema": "^1.0", + "nette/utils": "^3.0", + "php": ">=7.1" }, "conflict": { - "nette/bootstrap": "<2.4", - "nette/nette": "<2.2" + "nette/bootstrap": "<3.0" }, "require-dev": { - "nette/tester": "^2.0", + "nette/tester": "^2.2", "tracy/tracy": "^2.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "3.0-dev" } }, "autoload": { "classmap": [ "src/" + ], + "files": [ + "src/compatibility.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1774,7 +1777,7 @@ "homepage": "https://nette.org/contributors" } ], - "description": "? Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new PHP 7.1 features.", + "description": "💎 Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new PHP 7.1 features.", "homepage": "https://nette.org", "keywords": [ "compiled", @@ -1785,37 +1788,37 @@ "nette", "static" ], - "time": "2019-01-30T13:26:05+00:00" + "time": "2019-04-03T19:35:46+00:00" }, { "name": "nette/finder", - "version": "v2.4.2", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/nette/finder.git", - "reference": "ee951a656cb8ac622e5dd33474a01fd2470505a0" + "reference": "6be1b83ea68ac558aff189d640abe242e0306fe2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/finder/zipball/ee951a656cb8ac622e5dd33474a01fd2470505a0", - "reference": "ee951a656cb8ac622e5dd33474a01fd2470505a0", + "url": "https://api.github.com/repos/nette/finder/zipball/6be1b83ea68ac558aff189d640abe242e0306fe2", + "reference": "6be1b83ea68ac558aff189d640abe242e0306fe2", "shasum": "" }, "require": { - "nette/utils": "~2.4", - "php": ">=5.6.0" + "nette/utils": "^2.4 || ~3.0.0", + "php": ">=7.1" }, "conflict": { "nette/nette": "<2.2" }, "require-dev": { - "nette/tester": "~2.0", + "nette/tester": "^2.0", "tracy/tracy": "^2.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -1847,7 +1850,7 @@ "iterator", "nette" ], - "time": "2018-06-28T11:49:23+00:00" + "time": "2019-02-28T18:13:25+00:00" }, { "name": "nette/neon", @@ -1912,24 +1915,21 @@ }, { "name": "nette/php-generator", - "version": "v3.0.5", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/nette/php-generator.git", - "reference": "ea90209c2e8a7cd087b2742ca553c047a8df5eff" + "reference": "acff8b136fad84b860a626d133e791f95781f9f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/php-generator/zipball/ea90209c2e8a7cd087b2742ca553c047a8df5eff", - "reference": "ea90209c2e8a7cd087b2742ca553c047a8df5eff", + "url": "https://api.github.com/repos/nette/php-generator/zipball/acff8b136fad84b860a626d133e791f95781f9f5", + "reference": "acff8b136fad84b860a626d133e791f95781f9f5", "shasum": "" }, "require": { "nette/utils": "^2.4.2 || ~3.0.0", - "php": ">=7.0" - }, - "conflict": { - "nette/nette": "<2.2" + "php": ">=7.1" }, "require-dev": { "nette/tester": "^2.0", @@ -1938,7 +1938,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1962,7 +1962,7 @@ "homepage": "https://nette.org/contributors" } ], - "description": "? Nette PHP Generator: generates neat PHP code for you. Supports new PHP 7.2 features.", + "description": "🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 7.3 features.", "homepage": "https://nette.org", "keywords": [ "code", @@ -1970,30 +1970,27 @@ "php", "scaffolding" ], - "time": "2018-08-09T14:32:27+00:00" + "time": "2019-03-15T03:41:13+00:00" }, { "name": "nette/robot-loader", - "version": "v3.1.1", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/nette/robot-loader.git", - "reference": "3e8d75d6d976e191bdf46752ca40a286671219d2" + "reference": "0712a0e39ae7956d6a94c0ab6ad41aa842544b5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/robot-loader/zipball/3e8d75d6d976e191bdf46752ca40a286671219d2", - "reference": "3e8d75d6d976e191bdf46752ca40a286671219d2", + "url": "https://api.github.com/repos/nette/robot-loader/zipball/0712a0e39ae7956d6a94c0ab6ad41aa842544b5c", + "reference": "0712a0e39ae7956d6a94c0ab6ad41aa842544b5c", "shasum": "" }, "require": { "ext-tokenizer": "*", - "nette/finder": "^2.3 || ^3.0", - "nette/utils": "^2.4 || ^3.0", - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" + "nette/finder": "^2.5", + "nette/utils": "^3.0", + "php": ">=7.1" }, "require-dev": { "nette/tester": "^2.0", @@ -2002,7 +1999,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -2035,52 +2032,39 @@ "nette", "trait" ], - "time": "2019-03-01T20:23:02+00:00" + "time": "2019-03-08T21:57:24+00:00" }, { - "name": "nette/utils", - "version": "v2.5.3", + "name": "nette/schema", + "version": "v1.0.0", "source": { "type": "git", - "url": "https://github.com/nette/utils.git", - "reference": "17b9f76f2abd0c943adfb556e56f2165460b15ce" + "url": "https://github.com/nette/schema.git", + "reference": "6241d8d4da39e825dd6cb5bfbe4242912f4d7e4d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/17b9f76f2abd0c943adfb556e56f2165460b15ce", - "reference": "17b9f76f2abd0c943adfb556e56f2165460b15ce", + "url": "https://api.github.com/repos/nette/schema/zipball/6241d8d4da39e825dd6cb5bfbe4242912f4d7e4d", + "reference": "6241d8d4da39e825dd6cb5bfbe4242912f4d7e4d", "shasum": "" }, "require": { - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" + "nette/utils": "^3.0.1", + "php": ">=7.1" }, "require-dev": { - "nette/tester": "~2.0", + "nette/tester": "^2.2", "tracy/tracy": "^2.3" }, - "suggest": { - "ext-gd": "to use Image", - "ext-iconv": "to use Strings::webalize() and toAscii()", - "ext-intl": "for script transliteration in Strings::webalize() and toAscii()", - "ext-json": "to use Nette\\Utils\\Json", - "ext-mbstring": "to use Strings::lower() etc...", - "ext-xml": "to use Strings::length() etc. when mbstring is not available" - }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "1.0-dev" } }, "autoload": { "classmap": [ "src/" - ], - "files": [ - "src/loader.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2099,7 +2083,71 @@ "homepage": "https://nette.org/contributors" } ], - "description": "? Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", + "description": "📐 Nette Schema: validating data structures against a given Schema.", + "homepage": "https://nette.org", + "keywords": [ + "config", + "nette" + ], + "time": "2019-04-03T15:53:25+00:00" + }, + { + "name": "nette/utils", + "version": "v3.0.1", + "source": { + "type": "git", + "url": "https://github.com/nette/utils.git", + "reference": "bd961f49b211997202bda1d0fbc410905be370d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/utils/zipball/bd961f49b211997202bda1d0fbc410905be370d4", + "reference": "bd961f49b211997202bda1d0fbc410905be370d4", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "suggest": { + "ext-gd": "to use Image", + "ext-iconv": "to use Strings::webalize() and toAscii()", + "ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()", + "ext-json": "to use Nette\\Utils\\Json", + "ext-mbstring": "to use Strings::lower() etc...", + "ext-xml": "to use Strings::length() etc. when mbstring is not available" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", "homepage": "https://nette.org", "keywords": [ "array", @@ -2117,7 +2165,7 @@ "utility", "validation" ], - "time": "2018-09-18T10:22:16+00:00" + "time": "2019-03-22T01:00:30+00:00" }, { "name": "nikic/php-parser", @@ -2172,27 +2220,28 @@ }, { "name": "ocramius/package-versions", - "version": "1.2.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/Ocramius/PackageVersions.git", - "reference": "ad8a245decad4897cc6b432743913dad0d69753c" + "reference": "a4d4b60d0e60da2487bd21a2c6ac089f85570dbb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/ad8a245decad4897cc6b432743913dad0d69753c", - "reference": "ad8a245decad4897cc6b432743913dad0d69753c", + "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/a4d4b60d0e60da2487bd21a2c6ac089f85570dbb", + "reference": "a4d4b60d0e60da2487bd21a2c6ac089f85570dbb", "shasum": "" }, "require": { - "composer-plugin-api": "^1.0", - "php": "~7.0" + "composer-plugin-api": "^1.0.0", + "php": "^7.1.0" }, "require-dev": { - "composer/composer": "^1.3", + "composer/composer": "^1.6.3", + "doctrine/coding-standard": "^5.0.1", "ext-zip": "*", - "humbug/humbug": "dev-master", - "phpunit/phpunit": "^6.4" + "infection/infection": "^0.7.1", + "phpunit/phpunit": "^7.0.0" }, "type": "composer-plugin", "extra": { @@ -2217,7 +2266,7 @@ } ], "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "time": "2017-11-24T11:07:03+00:00" + "time": "2019-02-21T12:16:21+00:00" }, { "name": "phar-io/manifest", @@ -2377,16 +2426,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.0", + "version": "4.3.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", + "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", "shasum": "" }, "require": { @@ -2424,7 +2473,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": "2017-11-30T07:14:17+00:00" + "time": "2019-04-30T17:48:53+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -2475,16 +2524,16 @@ }, { "name": "phpspec/prophecy", - "version": "1.8.0", + "version": "1.8.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" + "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/1927e75f4ed19131ec9bcc3b002e07fb1173ee76", + "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76", "shasum": "" }, "require": { @@ -2505,8 +2554,8 @@ } }, "autoload": { - "psr-0": { - "Prophecy\\": "src/" + "psr-4": { + "Prophecy\\": "src/Prophecy" } }, "notification-url": "https://packagist.org/downloads/", @@ -2534,7 +2583,7 @@ "spy", "stub" ], - "time": "2018-08-05T17:53:17+00:00" + "time": "2019-06-13T12:50:23+00:00" }, { "name": "phpstan/phpdoc-parser", @@ -2996,59 +3045,14 @@ "abandoned": true, "time": "2018-08-09T05:50:03+00:00" }, - { - "name": "psr/log", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2018-11-20T15:27:04+00:00" - }, { "name": "rg3/youtube-dl", - "version": "2019.04.24", + "version": "2019.06.08", "dist": { "type": "zip", - "url": "https://github.com/rg3/youtube-dl/archive/2019.04.24.zip" + "url": "https://github.com/rg3/youtube-dl/archive/2019.06.08.zip", + "reference": null, + "shasum": null }, "type": "library" }, @@ -3664,25 +3668,27 @@ }, { "name": "symfony/console", - "version": "v3.4.26", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "15a9104356436cb26e08adab97706654799d31d8" + "reference": "d50bbeeb0e17e6dd4124ea391eff235e932cbf64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/15a9104356436cb26e08adab97706654799d31d8", - "reference": "15a9104356436cb26e08adab97706654799d31d8", + "url": "https://api.github.com/repos/symfony/console/zipball/d50bbeeb0e17e6dd4124ea391eff235e932cbf64", + "reference": "d50bbeeb0e17e6dd4124ea391eff235e932cbf64", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0|~4.0", - "symfony/polyfill-mbstring": "~1.0" + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/service-contracts": "^1.1" }, "conflict": { "symfony/dependency-injection": "<3.4", + "symfony/event-dispatcher": "<4.3", "symfony/process": "<3.3" }, "provide": { @@ -3690,11 +3696,12 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.3|~4.0", + "symfony/config": "~3.4|~4.0", "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/event-dispatcher": "^4.3", "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.3|~4.0" + "symfony/process": "~3.4|~4.0", + "symfony/var-dumper": "^4.3" }, "suggest": { "psr/log": "For using the console logger", @@ -3705,7 +3712,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -3732,85 +3739,29 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-04-08T09:29:13+00:00" - }, - { - "name": "symfony/debug", - "version": "v3.4.26", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "681afbb26488903c5ac15e63734f1d8ac430c9b9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/681afbb26488903c5ac15e63734f1d8ac430c9b9", - "reference": "681afbb26488903c5ac15e63734f1d8ac430c9b9", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" - }, - "require-dev": { - "symfony/http-kernel": "~2.8|~3.0|~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", - "time": "2019-04-11T09:48:14+00:00" + "time": "2019-06-05T13:25:51+00:00" }, { "name": "symfony/finder", - "version": "v3.4.26", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "61af5ce0b34b942d414fe8f1b11950d0e9a90e98" + "reference": "b3d4f4c0e4eadfdd8b296af9ca637cfbf51d8176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/61af5ce0b34b942d414fe8f1b11950d0e9a90e98", - "reference": "61af5ce0b34b942d414fe8f1b11950d0e9a90e98", + "url": "https://api.github.com/repos/symfony/finder/zipball/b3d4f4c0e4eadfdd8b296af9ca637cfbf51d8176", + "reference": "b3d4f4c0e4eadfdd8b296af9ca637cfbf51d8176", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -3837,7 +3788,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2019-04-02T19:54:57+00:00" + "time": "2019-05-26T20:47:49+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -3899,17 +3850,133 @@ "time": "2019-02-06T07:57:58+00:00" }, { - "name": "symfony/var-dumper", - "version": "v3.4.26", + "name": "symfony/polyfill-php73", + "version": "v1.11.0", "source": { "type": "git", - "url": "https://github.com/symfony/var-dumper.git", - "reference": "f0883812642a6d6583a9e2ae6aec4ba134436f40" + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "d1fb4abcc0c47be136208ad9d68bf59f1ee17abd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/f0883812642a6d6583a9e2ae6aec4ba134436f40", - "reference": "f0883812642a6d6583a9e2ae6aec4ba134436f40", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/d1fb4abcc0c47be136208ad9d68bf59f1ee17abd", + "reference": "d1fb4abcc0c47be136208ad9d68bf59f1ee17abd", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-02-06T07:57:58+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v1.1.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "191afdcb5804db960d26d8566b7e9a2843cab3a0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/191afdcb5804db960d26d8566b7e9a2843cab3a0", + "reference": "191afdcb5804db960d26d8566b7e9a2843cab3a0", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "suggest": { + "psr/container": "", + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2019-05-28T07:50:59+00:00" + }, + { + "name": "symfony/var-dumper", + "version": "v3.4.28", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "ca5fef348a0440411bbca0f9ec14e9a11625bd6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/ca5fef348a0440411bbca0f9ec14e9a11625bd6a", + "reference": "ca5fef348a0440411bbca0f9ec14e9a11625bd6a", "shasum": "" }, "require": { @@ -3965,20 +4032,20 @@ "debug", "dump" ], - "time": "2019-04-16T13:58:17+00:00" + "time": "2019-05-01T09:52:10+00:00" }, { "name": "theseer/tokenizer", - "version": "1.1.2", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "1c42705be2b6c1de5904f8afacef5895cab44bf8" + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/1c42705be2b6c1de5904f8afacef5895cab44bf8", - "reference": "1c42705be2b6c1de5904f8afacef5895cab44bf8", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", "shasum": "" }, "require": { @@ -4005,7 +4072,7 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2019-04-04T09:56:43+00:00" + "time": "2019-06-13T22:48:21+00:00" }, { "name": "webmozart/assert", diff --git a/config/config.example.yml b/config/config.example.yml index 9d1c4f4..3cd1fe0 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -45,3 +45,9 @@ audioBitrate: 128 # App name appName: AllTube Download + +# Generic formats supported by youtube-dl +genericFormats: + best: Best + bestvideo+bestaudio: Remux best video with best audio + worst: Worst diff --git a/controllers/DownloadController.php b/controllers/DownloadController.php index ddd83b3..7917171 100644 --- a/controllers/DownloadController.php +++ b/controllers/DownloadController.php @@ -128,7 +128,7 @@ class DownloadController extends BaseController return $frontController->password($request, $response); } catch (Exception $e) { // If MP3 is not available, we convert it. - $this->video = $this->video->withFormat($this->defaultFormat); + $this->video = $this->video->withFormat('bestaudio'); return $this->getConvertedAudioResponse($request, $response); } diff --git a/controllers/FrontController.php b/controllers/FrontController.php index c89cad4..6376b85 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -5,7 +5,6 @@ namespace Alltube\Controller; -use Alltube\Config; use Alltube\Exception\PasswordException; use Alltube\Locale; use Alltube\LocaleManager; diff --git a/package.json b/package.json index a792473..a00ca6b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "alltube", "description": "HTML GUI for youtube-dl", - "version": "2.0.1", + "version": "2.0.2", "author": "Pierre Rudloff", "bugs": "https://github.com/Rudloff/alltube/issues", "dependencies": { @@ -11,7 +11,7 @@ "open-sans-fontface": "~1.4.0" }, "devDependencies": { - "grunt-contrib-compress": "~1.4.1", + "grunt-contrib-compress": "~1.5.0", "grunt-contrib-csslint": "~2.0.0", "grunt-contrib-watch": "~1.0.0", "grunt-fixpack": "~0.1.0", diff --git a/resources/FAQ.md b/resources/FAQ.md index db29166..110b44b 100644 --- a/resources/FAQ.md +++ b/resources/FAQ.md @@ -64,6 +64,7 @@ Then push the code to Heroku and it should work out of the box. 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. +(This is also known to happen with Vevo YouTube videos.) There are two known workarounds: @@ -171,3 +172,15 @@ convertAdvancedFormats: [mp3, avi, flv, wav] This will add new inputs on the download page that allow users to converted videos to other formats. + +## Use other youtube-dl generic formats (e.g. `bestaudio`) + +You can add new formats by using the `genericFormats` option, +for example: + +```yaml +genericFormats: + bestaudio: Best audio +``` + +These will be available on every video page. diff --git a/templates/info.tpl b/templates/info.tpl index 54847ef..23bf5c1 100644 --- a/templates/info.tpl +++ b/templates/info.tpl @@ -27,19 +27,9 @@ {/if}

{if $config->stream} - +

{/if} diff --git a/tests/VideoTest.php b/tests/VideoTest.php index c726fd4..80f2959 100644 --- a/tests/VideoTest.php +++ b/tests/VideoTest.php @@ -169,7 +169,7 @@ class VideoTest extends BaseTest } /** - * Provides M3U8 URLs for tests. + * Provides URLs for remux tests. * * @return array[] */ @@ -186,7 +186,7 @@ class VideoTest extends BaseTest } /** - * Provides URLs for remux tests. + * Provides M3U8 URLs for tests. * * @return array[] */ diff --git a/yarn.lock b/yarn.lock index 0f68ccc..c0fec72 100644 --- a/yarn.lock +++ b/yarn.lock @@ -770,10 +770,10 @@ grunt-cli@~1.2.0: nopt "~3.0.6" resolve "~1.1.0" -grunt-contrib-compress@~1.4.1: - version "1.4.3" - resolved "https://registry.yarnpkg.com/grunt-contrib-compress/-/grunt-contrib-compress-1.4.3.tgz#01ceffb9c637f52e7081f463750983d0a3b0fa73" - integrity sha1-Ac7/ucY39S5wgfRjdQmD0KOw+nM= +grunt-contrib-compress@~1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/grunt-contrib-compress/-/grunt-contrib-compress-1.5.0.tgz#ba5f80e22acf192897ce43cb60250cab2cb1f09b" + integrity sha512-RcCyetnvTJ7jvnDCSm05wOndAd00HWZTHeVGDVVmCM+K/PEivL0yx8vKyi8uzy0492l2dJgtzR0Ucid7roKg6A== dependencies: archiver "^1.3.0" chalk "^1.1.1" @@ -781,7 +781,7 @@ grunt-contrib-compress@~1.4.1: pretty-bytes "^4.0.2" stream-buffers "^2.1.0" optionalDependencies: - iltorb "^1.0.13" + iltorb "^1.3.10" grunt-contrib-csslint@~2.0.0: version "2.0.0" @@ -1026,7 +1026,7 @@ ieee754@^1.1.4: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg== -iltorb@^1.0.13: +iltorb@^1.3.10: version "1.3.10" resolved "https://registry.yarnpkg.com/iltorb/-/iltorb-1.3.10.tgz#a0d9e4e7d52bf510741442236cbe0cc4230fc9f8" integrity sha512-nyB4+ru1u8CQqQ6w7YjasboKN3NQTN8GH/V/eEssNRKhW6UbdxdWhB9fJ5EEdjJfezKY0qPrcwLyIcgjL8hHxA==