diff --git a/.htaccess b/.htaccess index 5591820..83d9799 100644 --- a/.htaccess +++ b/.htaccess @@ -11,3 +11,6 @@ FileETag None RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [QSA,L] + +Redirect permanent /api.php /video +Redirect permanent /extractors.php /extractors diff --git a/README.md b/README.md index ea68dbf..32071af 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ You should also ensure that the *templates_c* folder has the right permissions: chmod 777 templates_c/ +If your web server is Apache, you need to set the `AllowOverride` setting to `All` or `FileInfo`. + ##Config If you want to use a custom config, you need to create a config file: @@ -37,4 +39,6 @@ If you don't want to enable conversions, you can disable it in *config.yml*. On Debian-based systems: - sudo apt-get install libavcodec-extra rtmpdump + sudo apt-get install libav-tools rtmpdump + +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). diff --git a/classes/Config.php b/classes/Config.php index a003624..2e2bf11 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -32,6 +32,7 @@ Class Config public $params = '--no-playlist --no-warnings -f best'; public $convert = false; public $avconv = 'vendor/bin/ffmpeg'; + public $curl_params = ''; /** * Config constructor @@ -56,6 +57,7 @@ Class Config /** * Get singleton instance + * * @return Config */ public static function getInstance() diff --git a/classes/VideoDownload.php b/classes/VideoDownload.php index 3d18990..9e2b435 100644 --- a/classes/VideoDownload.php +++ b/classes/VideoDownload.php @@ -32,8 +32,12 @@ Class VideoDownload static function getUA() { $config = Config::getInstance(); + $cmd = escapeshellcmd( + $config->python.' '.escapeshellarg($config->youtubedl). + ' '.$config->params + ); exec( - $config->python.' '.$config->youtubedl.' --dump-user-agent', + $cmd.' --dump-user-agent', $version ); return $version[0]; @@ -47,8 +51,12 @@ Class VideoDownload static function listExtractors() { $config = Config::getInstance(); + $cmd = escapeshellcmd( + $config->python.' '.escapeshellarg($config->youtubedl). + ' '.$config->params + ); exec( - $config->python.' '.$config->youtubedl.' --list-extractors', + $cmd.' --list-extractors', $extractors ); return $extractors; @@ -65,7 +73,10 @@ Class VideoDownload static function getFilename($url, $format=null) { $config = Config::getInstance(); - $cmd=$config->python.' '.$config->youtubedl; + $cmd = escapeshellcmd( + $config->python.' '.escapeshellarg($config->youtubedl). + ' '.$config->params + ); if (isset($format)) { $cmd .= ' -f '.escapeshellarg($format); } @@ -88,7 +99,10 @@ Class VideoDownload static function getJSON($url, $format=null) { $config = Config::getInstance(); - $cmd=$config->python.' '.$config->youtubedl.' '.$config->params; + $cmd = escapeshellcmd( + $config->python.' '.escapeshellarg($config->youtubedl). + ' '.$config->params + ); if (isset($format)) { $cmd .= ' -f '.escapeshellarg($format); } @@ -114,7 +128,10 @@ Class VideoDownload static function getURL($url, $format=null) { $config = Config::getInstance(); - $cmd=$config->python.' '.$config->youtubedl.' '.$config->params; + $cmd = escapeshellcmd( + $config->python.' '.escapeshellarg($config->youtubedl). + ' '.$config->params + ); if (isset($format)) { $cmd .= ' -f '.escapeshellarg($format); } diff --git a/composer.json b/composer.json index 86888ad..dc5d1cf 100644 --- a/composer.json +++ b/composer.json @@ -1,68 +1,71 @@ { - "name": "rudloff/alltube", - "description": "HTML GUI for youtube-dl", - "license": "GPL-3.0", - "homepage": "http://alltubedownload.net/", - "type": "project", - "require": { - "smarty/smarty": "~3.1", - "rg3/youtube-dl": "2015.12.29", - "slim/slim": "~2.6.2", - "slim/views": "~0.1.3", - "rudloff/smarty-plugin-noscheme": "~0.1.0", - "symfony/yaml": "~3.0.0", - "ffmpeg/ffmpeg": "~2.8.2" - }, - "require-dev": { - "symfony/var-dumper": "~3.0.0" - }, - "extra": { - "paas": { - "nginx-includes": [ - "nginx.conf" - ] - } - }, - "repositories": [ - { - "type": "package", - "package": { - "name": "rg3/youtube-dl", - "version": "2015.12.29", - "source": { - "url": "https://github.com/rg3/youtube-dl.git", - "type": "git", - "reference": "2015.12.29" - } - } - }, - { - "type": "package", - "package": { - "name": "ffmpeg/ffmpeg", - "version": "2.8.2", - "dist": { - "url": "http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz", - "type": "xz" - }, - "bin": [ - "ffmpeg" - ] - } - } - ], - "authors": [ - { - "name": "Pierre Rudloff", - "email": "contact@rudloff.pro", - "homepage": "https://rudloff.pro/", - "role": "Developer" - } - ], - "autoload": { - "psr-4": { - "Alltube\\": "classes/", - "Alltube\\Controller\\": "controllers/" - } - } + "name": "rudloff/alltube", + "description": "HTML GUI for youtube-dl", + "license": "GPL-3.0", + "homepage": "http://alltubedownload.net/", + "type": "project", + "require": { + "smarty/smarty": "~3.1.29", + "rg3/youtube-dl": "2016.03.14", + "slim/slim": "~2.6.2", + "slim/views": "~0.1.3", + "rudloff/smarty-plugin-noscheme": "~0.1.0", + "symfony/yaml": "~3.0.0", + "ffmpeg/ffmpeg": "~2.8.2" + }, + "require-dev": { + "symfony/var-dumper": "~3.0.0" + }, + "extra": { + "paas": { + "nginx-includes": [ + "nginx.conf" + ] + } + }, + "repositories": [{ + "type": "package", + "package": { + "name": "rg3/youtube-dl", + "version": "2016.03.14", + "source": { + "url": "https://github.com/rg3/youtube-dl.git", + "type": "git", + "reference": "2016.03.14" + } + } + }, { + "type": "package", + "package": { + "name": "ffmpeg/ffmpeg", + "version": "2.8.4", + "dist": { + "url": "http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz", + "type": "xz" + }, + "bin": [ + "ffmpeg" + ] + } + }], + "authors": [{ + "name": "Pierre Rudloff", + "email": "contact@rudloff.pro", + "homepage": "https://rudloff.pro/", + "role": "Developer" + }, { + "name": "Olivier Haquette", + "email": "contact@olivierhaquette.fr", + "homepage": "http://olivierhaquette.fr/", + "role": "Designer" + }], + "autoload": { + "psr-4": { + "Alltube\\": "classes/", + "Alltube\\Controller\\": "controllers/" + } + }, + "config": { + "secure-http": false + } } diff --git a/composer.lock b/composer.lock index d47734f..d4fa979 100644 --- a/composer.lock +++ b/composer.lock @@ -4,12 +4,12 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "4ab91a81eeb4af64b1c2385f00c96135", - "content-hash": "e9a52d9ff3660f110122e1ab8b784bba", + "hash": "d4b9e76dbda3af97316a38bfe163ac00", + "content-hash": "6eb27104cc39af34f798d35fb3f381ac", "packages": [ { "name": "ffmpeg/ffmpeg", - "version": "2.8.2", + "version": "2.8.4", "dist": { "type": "xz", "url": "http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz", @@ -85,16 +85,16 @@ }, { "name": "league/uri", - "version": "4.0.1", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/thephpleague/uri.git", - "reference": "671150fbd1d4120746195d6bec1aa78b95b14104" + "reference": "a4f0ea3323745214c955af2f6451d7743f30a076" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri/zipball/671150fbd1d4120746195d6bec1aa78b95b14104", - "reference": "671150fbd1d4120746195d6bec1aa78b95b14104", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/a4f0ea3323745214c955af2f6451d7743f30a076", + "reference": "a4f0ea3323745214c955af2f6451d7743f30a076", "shasum": "" }, "require": { @@ -112,7 +112,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -128,8 +128,7 @@ { "name": "Ignace Nyamagana Butera", "email": "nyamsprod@gmail.com", - "homepage": "https://github.com/nyamsprod/", - "role": "Developer" + "homepage": "https://nyamsprod.com" } ], "description": "URI manipulation library", @@ -146,7 +145,7 @@ "url", "ws" ], - "time": "2015-11-03 07:54:30" + "time": "2016-02-18 14:46:01" }, { "name": "psr/http-message", @@ -199,11 +198,11 @@ }, { "name": "rg3/youtube-dl", - "version": "2015.12.29", + "version": "2016.03.14", "source": { "type": "git", "url": "https://github.com/rg3/youtube-dl.git", - "reference": "2015.12.29" + "reference": "2016.03.14" }, "type": "library" }, @@ -399,16 +398,16 @@ }, { "name": "symfony/yaml", - "version": "v3.0.1", + "version": "v3.0.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "3df409958a646dad2bc5046c3fb671ee24a1a691" + "reference": "b5ba64cd67ecd6887f63868fa781ca094bd1377c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/3df409958a646dad2bc5046c3fb671ee24a1a691", - "reference": "3df409958a646dad2bc5046c3fb671ee24a1a691", + "url": "https://api.github.com/repos/symfony/yaml/zipball/b5ba64cd67ecd6887f63868fa781ca094bd1377c", + "reference": "b5ba64cd67ecd6887f63868fa781ca094bd1377c", "shasum": "" }, "require": { @@ -444,22 +443,22 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-12-26 13:39:53" + "time": "2016-02-23 15:16:06" } ], "packages-dev": [ { "name": "symfony/polyfill-mbstring", - "version": "v1.0.1", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "49ff736bd5d41f45240cec77b44967d76e0c3d25" + "reference": "1289d16209491b584839022f29257ad859b8532d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/49ff736bd5d41f45240cec77b44967d76e0c3d25", - "reference": "49ff736bd5d41f45240cec77b44967d76e0c3d25", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/1289d16209491b584839022f29257ad859b8532d", + "reference": "1289d16209491b584839022f29257ad859b8532d", "shasum": "" }, "require": { @@ -471,7 +470,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.1-dev" } }, "autoload": { @@ -505,20 +504,20 @@ "portable", "shim" ], - "time": "2015-11-20 09:19:13" + "time": "2016-01-20 09:13:37" }, { "name": "symfony/var-dumper", - "version": "v3.0.1", + "version": "v3.0.3", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "87db8700deb12ba2b65e858f656a1f885530bcb0" + "reference": "9a6a883c48acb215d4825ce9de61dccf93d62074" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/87db8700deb12ba2b65e858f656a1f885530bcb0", - "reference": "87db8700deb12ba2b65e858f656a1f885530bcb0", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/9a6a883c48acb215d4825ce9de61dccf93d62074", + "reference": "9a6a883c48acb215d4825ce9de61dccf93d62074", "shasum": "" }, "require": { @@ -568,7 +567,7 @@ "debug", "dump" ], - "time": "2015-12-05 11:13:14" + "time": "2016-02-13 09:23:44" } ], "aliases": [], diff --git a/composer.phar b/composer.phar index d8ea524..185064f 100755 Binary files a/composer.phar and b/composer.phar differ diff --git a/config.example.yml b/config.example.yml index b0c7301..0734d4d 100644 --- a/config.example.yml +++ b/config.example.yml @@ -1,5 +1,6 @@ youtubedl: vendor/rg3/youtube-dl/youtube_dl/__main__.py python: /usr/bin/python params: --no-playlist --no-warnings -f best +curl_params: convert: false avconv: vendor/bin/ffmpeg diff --git a/controllers/FrontController.php b/controllers/FrontController.php index de3a8c3..8a1074f 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -29,6 +29,7 @@ class FrontController /** * Display index page + * * @return void */ static function index() @@ -55,6 +56,7 @@ class FrontController /** * Display a list of extractors + * * @return void */ static function extractors() @@ -79,6 +81,7 @@ class FrontController /** * Dislay information about the video + * * @return void */ static function video() @@ -130,7 +133,8 @@ class FrontController ); header("Content-Type: audio/mpeg"); passthru( - 'curl --user-agent '.escapeshellarg($UA). + 'curl '.$config->curl_params. + ' --user-agent '.escapeshellarg($UA). ' '.escapeshellarg($video->url). ' | '.$config->avconv. ' -v quiet -i - -f mp3 -vn pipe:1' @@ -180,6 +184,7 @@ class FrontController /** * Redirect to video file + * * @return void */ static function redirect() @@ -198,6 +203,7 @@ class FrontController /** * Output JSON info about the video + * * @return void */ static function json() diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..57256cf --- /dev/null +++ b/manifest.json @@ -0,0 +1,29 @@ +{ + "short_name": "AllTube", + "name": "AllTube Download", + "display": "minimal-ui", + "icons": [{ + "src": "img/favicon.png", + "sizes": "32x32", + "type": "image/png" + }, { + "src": "img/logo_60.png", + "sizes": "60x60", + "type": "image/png" + }, { + "src": "img/logo_90.png", + "sizes": "90x60", + "type": "image/png" + }, { + "src": "img/logo_app.png", + "sizes": "243x243", + "type": "image/png" + }, { + "src": "img/logo_250.png", + "sizes": "250x250", + "type": "image/png" + }], + "lang": "en", + "start_url": "./index.php", + "theme_color": "#4F4F4F" +} diff --git a/package.json b/package.json index 80ad990..5aafc35 100644 --- a/package.json +++ b/package.json @@ -1,21 +1,18 @@ { "name": "alltube", - "version": "0.4.4", + "version": "0.4.5", "license": "GPL-3.0", "dependencies": { "grunt": "~0.4.5", "grunt-cli": "~0.1.13", - "grunt-contrib-cssmin": "~0.14.0", - "grunt-contrib-uglify": "~0.11.0", + "grunt-contrib-cssmin": "~1.0.0", + "grunt-contrib-uglify": "~1.0.0", "grunt-contrib-watch": "~0.6.1", "grunt-phpcs": "~0.4.0", "grunt-phpunit": "~0.3.6", - "grunt-contrib-compress": "~0.14.0", + "grunt-contrib-compress": "~1.1.1", "bower": "~1.7.1" }, - "engines": { - "node": "~0.10.29" - }, "repository": { "type": "git", "url": "https://github.com/Rudloff/alltube.git" diff --git a/templates/head.tpl b/templates/head.tpl index 42ffa1e..175293c 100644 --- a/templates/head.tpl +++ b/templates/head.tpl @@ -4,27 +4,29 @@ - + AllTube Download - + - + - + - + + + diff --git a/templates/index.tpl b/templates/index.tpl index ce0964d..b6bdf87 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -1,5 +1,5 @@
-