Merge branch 'develop' into feature/stream

Conflicts:
	composer.lock
This commit is contained in:
Pierre Rudloff 2016-10-13 17:07:00 +02:00
commit 6e73398369
11 changed files with 163 additions and 119 deletions

View file

@ -24,4 +24,4 @@ RewriteRule ^ index.php [QSA,L]
Redirect permanent /api.php /video Redirect permanent /api.php /video
Redirect permanent /extractors.php /extractors Redirect permanent /extractors.php /extractors
AddOutputFilterByType DEFLATE text/css text/html application/javascript AddOutputFilterByType DEFLATE text/css text/html application/javascript font/truetype

28
FAQ.md
View file

@ -1,12 +1,17 @@
# Frequently asked questions # Frequently asked questions
<!-- markdownlint-disable MD026 -->
## My browser plays the video. How do I download it? ## 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. 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*. You can ususally download the video by doing *File > Save to* or *ctrl + S*.
## How do I change config parameters? ## How do I change config parameters?
You need to create a YAML file called `config.yml` at the root of your project. You need to create a YAML file called `config.yml` at the root of your project.
Here are the parameters that you can set: Here are the parameters that you can set:
* youtubedl: path to your youtube-dl binary * youtubedl: path to your youtube-dl binary
* python: path to your python binary * python: path to your python binary
* params: an array of parameters to pass to youtube-dl * params: an array of parameters to pass to youtube-dl
@ -18,12 +23,35 @@ Here are the parameters that you can set:
See [config.example.yml](config.example.yml) for default values. See [config.example.yml](config.example.yml) for default values.
## How do I enable audio conversion? ## How do I enable audio conversion?
In order to enable audio conversion, you need to add this to your `config.yml` file: In order to enable audio conversion, you need to add this to your `config.yml` file:
```yaml ```yaml
convert: true convert: true
avconv: path/to/avconv avconv: path/to/avconv
``` ```
You will also need to install `avconv` and `curl` on your server: You will also need to install `avconv` and `curl` on your server:
```bash ```bash
sudo apt-get install libav-tools curl 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.
## 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).

View file

@ -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") ![Screenshot](img/screenshot.png "Alltube GUI screenshot")
## Setup ## Setup
### From a release package ### From a release package
You can download the latest release package [here](https://github.com/Rudloff/alltube/releases). 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. You just have to unzip it on your server and it should be ready to use.
### From Git ### From Git
In order to get AllTube working, you need to use [npm](https://www.npmjs.com/) and [Composer](https://getcomposer.org/): In order to get AllTube working, you need to use [npm](https://www.npmjs.com/) and [Composer](https://getcomposer.org/):
```bash ```bash
npm install npm install
composer 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.) (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: You should also ensure that the *templates_c* folder has the right permissions:
```bash ```bash
chmod 777 templates_c/ chmod 777 templates_c/
``` ```
@ -33,19 +36,33 @@ If your web server is Apache, you need to set the `AllowOverride` setting to `Al
## Config ## Config
If you want to use a custom config, you need to create a config file: If you want to use a custom config, you need to create a config file:
```bash ```bash
cp config.example.yml config.yml 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 ## Web server configuration
### Apache ### Apache
You will need the following modules: You will need the following modules:
* mod_mime * mod_mime
* mod_rewrite * mod_rewrite
### Nginx ### Nginx
Here is an exemple Nginx configuration: Here is an exemple Nginx configuration:
```nginx ```nginx
server { server {
server_name localhost; server_name localhost;
@ -94,16 +111,24 @@ server {
``` ```
## License ## License
This software is available under the [GNU General Public License](http://www.gnu.org/licenses/gpl.html). 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 ## 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. 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: On Debian-based systems:
```bash ```bash
sudo apt-get install libav-tools rtmpdump curl 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.

View file

@ -100,7 +100,7 @@ class Config
} }
} }
if (getenv('CONVERT')) { if (getenv('CONVERT')) {
$this->convert = getenv('CONVERT'); $this->convert = (bool) getenv('CONVERT');
} }
} }

View file

@ -12,6 +12,9 @@ use Symfony\Component\Process\ProcessBuilder;
*/ */
class VideoDownload class VideoDownload
{ {
private $config;
private $procBuilder;
/** /**
* VideoDownload constructor. * VideoDownload constructor.
*/ */
@ -45,47 +48,11 @@ class VideoDownload
return explode(PHP_EOL, trim($process->getOutput())); return explode(PHP_EOL, trim($process->getOutput()));
} }
/** private function getProp($url, $format = null, $prop = 'dump-json')
* 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)
{ {
$this->procBuilder->setArguments( $this->procBuilder->setArguments(
[ [
'--dump-json', '--'.$prop,
$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',
$url, $url,
] ]
); );
@ -101,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. * Get filename of video file from URL of page.
* *
@ -111,22 +104,7 @@ class VideoDownload
* */ * */
public function getFilename($url, $format = null) public function getFilename($url, $format = null)
{ {
$this->procBuilder->setArguments( return trim($this->getProp($url, $format, 'get-filename'));
[
'--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());
}
} }
/** /**

View file

@ -19,7 +19,7 @@
}, },
"require-dev": { "require-dev": {
"symfony/var-dumper": "~3.1.0", "symfony/var-dumper": "~3.1.0",
"squizlabs/php_codesniffer": "~2.6.2", "squizlabs/php_codesniffer": "~2.7.0",
"phpunit/phpunit": "~5.5.2" "phpunit/phpunit": "~5.5.2"
}, },
"extra": { "extra": {

105
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": "086ca596eeeb4c2a0e5d27976b21e4d2", "hash": "619ed10d49b90725061dfd851d994432",
"content-hash": "ec541955f4eb561e1b37b3bbb081af09", "content-hash": "dac044b232222cd1af6f62f3ad24d231",
"packages": [ "packages": [
{ {
"name": "container-interop/container-interop", "name": "container-interop/container-interop",
@ -50,16 +50,16 @@
}, },
{ {
"name": "guzzlehttp/guzzle", "name": "guzzlehttp/guzzle",
"version": "6.2.1", "version": "6.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/guzzle.git", "url": "https://github.com/guzzle/guzzle.git",
"reference": "3f808fba627f2c5b69e2501217bf31af349c1427" "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/3f808fba627f2c5b69e2501217bf31af349c1427", "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ebf29dee597f02f09f4d5bbecc68230ea9b08f60",
"reference": "3f808fba627f2c5b69e2501217bf31af349c1427", "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -108,7 +108,7 @@
"rest", "rest",
"web service" "web service"
], ],
"time": "2016-07-15 17:22:37" "time": "2016-10-08 15:01:37"
}, },
{ {
"name": "guzzlehttp/promises", "name": "guzzlehttp/promises",
@ -776,16 +776,16 @@
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
"version": "v3.1.4", "version": "v3.1.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/process.git", "url": "https://github.com/symfony/process.git",
"reference": "e64e93041c80e77197ace5ab9385dedb5a143697" "reference": "66de154ae86b1a07001da9fbffd620206e4faf94"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/e64e93041c80e77197ace5ab9385dedb5a143697", "url": "https://api.github.com/repos/symfony/process/zipball/66de154ae86b1a07001da9fbffd620206e4faf94",
"reference": "e64e93041c80e77197ace5ab9385dedb5a143697", "reference": "66de154ae86b1a07001da9fbffd620206e4faf94",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -821,20 +821,20 @@
], ],
"description": "Symfony Process Component", "description": "Symfony Process Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-08-16 14:58:24" "time": "2016-09-29 14:13:09"
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v3.1.4", "version": "v3.1.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",
"reference": "f291ed25eb1435bddbe8a96caaef16469c2a092d" "reference": "368b9738d4033c8b93454cb0dbd45d305135a6d3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/f291ed25eb1435bddbe8a96caaef16469c2a092d", "url": "https://api.github.com/repos/symfony/yaml/zipball/368b9738d4033c8b93454cb0dbd45d305135a6d3",
"reference": "f291ed25eb1435bddbe8a96caaef16469c2a092d", "reference": "368b9738d4033c8b93454cb0dbd45d305135a6d3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -870,7 +870,7 @@
], ],
"description": "Symfony Yaml Component", "description": "Symfony Yaml Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-09-02 02:12:52" "time": "2016-09-25 08:27:07"
} }
], ],
"packages-dev": [ "packages-dev": [
@ -930,16 +930,16 @@
}, },
{ {
"name": "myclabs/deep-copy", "name": "myclabs/deep-copy",
"version": "1.5.2", "version": "1.5.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/myclabs/DeepCopy.git", "url": "https://github.com/myclabs/DeepCopy.git",
"reference": "da8529775f14f4fdae33f916eb0cf65f6afbddbc" "reference": "ea74994a3dc7f8d2f65a06009348f2d63c81e61f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/da8529775f14f4fdae33f916eb0cf65f6afbddbc", "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/ea74994a3dc7f8d2f65a06009348f2d63c81e61f",
"reference": "da8529775f14f4fdae33f916eb0cf65f6afbddbc", "reference": "ea74994a3dc7f8d2f65a06009348f2d63c81e61f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -968,7 +968,7 @@
"object", "object",
"object graph" "object graph"
], ],
"time": "2016-09-06 16:07:05" "time": "2016-09-16 13:37:59"
}, },
{ {
"name": "phpdocumentor/reflection-common", "name": "phpdocumentor/reflection-common",
@ -1026,16 +1026,16 @@
}, },
{ {
"name": "phpdocumentor/reflection-docblock", "name": "phpdocumentor/reflection-docblock",
"version": "3.1.0", "version": "3.1.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "9270140b940ff02e58ec577c237274e92cd40cdd" "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9270140b940ff02e58ec577c237274e92cd40cdd", "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e",
"reference": "9270140b940ff02e58ec577c237274e92cd40cdd", "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1067,7 +1067,7 @@
} }
], ],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "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", "name": "phpdocumentor/type-resolver",
@ -1424,24 +1424,24 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "5.5.4", "version": "5.5.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "3e6e88e56c912133de6e99b87728cca7ed70c5f5" "reference": "3f67cee782c9abfaee5e32fd2f57cdd54bc257ba"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6e88e56c912133de6e99b87728cca7ed70c5f5", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3f67cee782c9abfaee5e32fd2f57cdd54bc257ba",
"reference": "3e6e88e56c912133de6e99b87728cca7ed70c5f5", "reference": "3f67cee782c9abfaee5e32fd2f57cdd54bc257ba",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-dom": "*", "ext-dom": "*",
"ext-json": "*", "ext-json": "*",
"ext-pcre": "*", "ext-libxml": "*",
"ext-reflection": "*", "ext-mbstring": "*",
"ext-spl": "*", "ext-xml": "*",
"myclabs/deep-copy": "~1.3", "myclabs/deep-copy": "~1.3",
"php": "^5.6 || ^7.0", "php": "^5.6 || ^7.0",
"phpspec/prophecy": "^1.3.1", "phpspec/prophecy": "^1.3.1",
@ -1463,7 +1463,12 @@
"conflict": { "conflict": {
"phpdocumentor/reflection-docblock": "3.0.2" "phpdocumentor/reflection-docblock": "3.0.2"
}, },
"require-dev": {
"ext-pdo": "*"
},
"suggest": { "suggest": {
"ext-tidy": "*",
"ext-xdebug": "*",
"phpunit/php-invoker": "~1.1" "phpunit/php-invoker": "~1.1"
}, },
"bin": [ "bin": [
@ -1498,20 +1503,20 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2016-08-26 07:11:44" "time": "2016-10-03 13:04:15"
}, },
{ {
"name": "phpunit/phpunit-mock-objects", "name": "phpunit/phpunit-mock-objects",
"version": "3.2.7", "version": "3.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "546898a2c0c356ef2891b39dd7d07f5d82c8ed0a" "reference": "238d7a2723bce689c79eeac9c7d5e1d623bb9dc2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/546898a2c0c356ef2891b39dd7d07f5d82c8ed0a", "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/238d7a2723bce689c79eeac9c7d5e1d623bb9dc2",
"reference": "546898a2c0c356ef2891b39dd7d07f5d82c8ed0a", "reference": "238d7a2723bce689c79eeac9c7d5e1d623bb9dc2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1557,7 +1562,7 @@
"mock", "mock",
"xunit" "xunit"
], ],
"time": "2016-09-06 16:07:45" "time": "2016-10-09 07:01:45"
}, },
{ {
"name": "sebastian/code-unit-reverse-lookup", "name": "sebastian/code-unit-reverse-lookup",
@ -2074,16 +2079,16 @@
}, },
{ {
"name": "squizlabs/php_codesniffer", "name": "squizlabs/php_codesniffer",
"version": "2.6.2", "version": "2.7.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "4edb770cb853def6e60c93abb088ad5ac2010c83" "reference": "571e27b6348e5b3a637b2abc82ac0d01e6d7bbed"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/4edb770cb853def6e60c93abb088ad5ac2010c83", "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/571e27b6348e5b3a637b2abc82ac0d01e6d7bbed",
"reference": "4edb770cb853def6e60c93abb088ad5ac2010c83", "reference": "571e27b6348e5b3a637b2abc82ac0d01e6d7bbed",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2148,7 +2153,7 @@
"phpcs", "phpcs",
"standards" "standards"
], ],
"time": "2016-07-13 23:29:13" "time": "2016-09-01 23:53:02"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
@ -2211,16 +2216,16 @@
}, },
{ {
"name": "symfony/var-dumper", "name": "symfony/var-dumper",
"version": "v3.1.4", "version": "v3.1.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/var-dumper.git", "url": "https://github.com/symfony/var-dumper.git",
"reference": "62ee73706c421654a4c840028954510277f7dfc8" "reference": "70bfe927b86ba9999aeebd829715b0bb2cd39a10"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/62ee73706c421654a4c840028954510277f7dfc8", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/70bfe927b86ba9999aeebd829715b0bb2cd39a10",
"reference": "62ee73706c421654a4c840028954510277f7dfc8", "reference": "70bfe927b86ba9999aeebd829715b0bb2cd39a10",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2270,7 +2275,7 @@
"debug", "debug",
"dump" "dump"
], ],
"time": "2016-08-31 09:05:42" "time": "2016-09-29 14:13:09"
}, },
{ {
"name": "webmozart/assert", "name": "webmozart/assert",

View file

@ -6,6 +6,7 @@ namespace Alltube\Controller;
use Alltube\Config; use Alltube\Config;
use Alltube\VideoDownload; use Alltube\VideoDownload;
use Interop\Container\ContainerInterface;
use Slim\Container; use Slim\Container;
use Slim\Http\Request; use Slim\Http\Request;
use Slim\Http\Response; use Slim\Http\Response;
@ -33,7 +34,7 @@ class FrontController
/** /**
* Slim dependency container. * Slim dependency container.
* *
* @var Container * @var ContainerInterface
*/ */
private $container; private $container;
@ -42,11 +43,13 @@ class FrontController
* *
* @param Container $container Slim dependency container * @param Container $container Slim dependency container
*/ */
public function __construct(Container $container) public function __construct(ContainerInterface $container)
{ {
$this->config = Config::getInstance(); $this->config = Config::getInstance();
$this->download = new VideoDownload(); $this->download = new VideoDownload();
$this->container = $container; if ($container instanceof Container) {
$this->container = $container;
}
} }
/** /**

View file

@ -13,7 +13,10 @@ $container = $app->getContainer();
$container['view'] = function ($c) { $container['view'] = function ($c) {
$view = new \Slim\Views\Smarty(__DIR__.'/templates/'); $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'); $view->registerPlugin('modifier', 'noscheme', 'Smarty_Modifier_noscheme');

View file

@ -1,7 +1,7 @@
{ {
"name": "alltube", "name": "alltube",
"description": "HTML GUI for youtube-dl", "description": "HTML GUI for youtube-dl",
"version": "0.5.0", "version": "0.5.2",
"author": "Pierre Rudloff", "author": "Pierre Rudloff",
"bugs": "https://github.com/Rudloff/alltube/issues", "bugs": "https://github.com/Rudloff/alltube/issues",
"dependencies": { "dependencies": {
@ -22,6 +22,9 @@
"grunt-phpdocumentor": "~0.4.1", "grunt-phpdocumentor": "~0.4.1",
"grunt-phpunit": "~0.3.6" "grunt-phpunit": "~0.3.6"
}, },
"engines": {
"npm": "~3"
},
"homepage": "https://www.alltubedownload.net/", "homepage": "https://www.alltubedownload.net/",
"keywords": [ "keywords": [
"alltube", "alltube",

View file

@ -14,7 +14,6 @@
<a href="https://github.com/Rudloff/alltube">Get the code</a> <a href="https://github.com/Rudloff/alltube">Get the code</a>
&middot; &middot;
Based on <a href="http://rg3.github.io/youtube-dl/">youtube-dl</a> Based on <a href="http://rg3.github.io/youtube-dl/">youtube-dl</a>
&middot;
</div> </div>
</footer> </footer>
<script src="{base_url|noscheme}/dist/main.js"></script> <script src="{base_url|noscheme}/dist/main.js"></script>