Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release-0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rudloff committed Oct 19, 2016
2 parents 11f15cb + e575e16 commit 51ee352
Show file tree
Hide file tree
Showing 14 changed files with 500 additions and 271 deletions.
17 changes: 16 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
language: php
php:
- 5.6
install:
- composer install --no-dev
- composer install
before_install:
- composer selfupdate
- npm install -g npm@3
after_success:
- bash <(curl -s https://codecov.io/bash)
before_deploy:
- npm install
- ./node_modules/.bin/grunt doc
deploy:
provider: surge
project: ./docs/
domain: alltube.surge.sh
skip_cleanup: true
env:
global:
- SURGE_LOGIN=contact@rudloff.pro
- secure: Icw8UqAilq0+neZsdXn7pny5OrDin1tTN0H3HGPFDBawHWBEffettRsURljnBlm0IcAE8HPvl0DlaGFMedM3ZlYjvp7OqMqe84p7dY22JMvirV4MsMz546FKEYI+g3txawAMDFPCorE+fgkDrL1eUoozGVJxc5c4w4nBVm84QvjxRvCvEKbfevd4giaie1Xuo927lKAwTaVFZryYNotPyJVB2pBBndxfl2EJczJ4DXQc3VczFXkTmuE/QLa2tQVJm5vnVPwOi1xmvgh6g1ChEOw0zAks1Mf5+UvxtVV7qTicVAWK0fVVBL9mHPpNzSNb4pPqHPWQjhAPdCW+WPn6+DhqS5BHeSfQit/OtLMpUWO1IceVDRwU3jkXmMgnKwz1t9yDh6VBZRvGPkXfU3cjQ9SFpmnnu/4JLgwA/zSU2Pzl7/+gsHQBazkXh8HYAbOjF2w1IBXOpZ8Yv7D5axRIDduS/TUQ6oNK3KYmRMBcg8ZzVzIdz+55NchaDtihcp5akaHhKxR7GMPrfi66b+wARSw3OsYmCGLNFF8zj/6zo3/zB02+oVMlXXySOAKKi0A2OvH9xV4W4Jl0TGua/27XOWr9c5btrZrykk3PXfKe5YgT46Q8CtK8yN97bDKbwbAp6gNEyMFFatdHKlEndZYsVDQ16htd0b/303SZfXYMvO0=
36 changes: 36 additions & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# Frequently asked questions

<!-- markdownlint-disable MD026 -->

## 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
Expand All @@ -18,12 +23,43 @@ 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
```

## 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).

## CSS and JavaScript files are missing

You probably don't have the minified files (in the `dist` folder).
You need to either:

* Use a [release package](https://github.com/Rudloff/alltube/releases)
* Run `npm install` (see detailed instructions in the [README](README.md#from-git))
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module.exports = function (grunt) {
options: {
archive: 'alltube-<%= githash.main.tag %>.zip'
},
src: ['*.php', '!config.yml', 'dist/**', '.htaccess', 'img/**', 'LICENSE', 'README.md', 'robots.txt', 'sitemap.xml', 'templates/**', 'templates_c/', 'vendor/**', 'classes/**', 'controllers/**', 'bower_components/**', '!vendor/ffmpeg/**', '!vendor/bin/ffmpeg']
src: ['*.php', '!config.yml', 'dist/**', '.htaccess', 'img/**', 'LICENSE', 'README.md', 'robots.txt', 'sitemap.xml', 'templates/**', 'templates_c/', 'vendor/**', 'classes/**', 'controllers/**', 'bower_components/**', '!vendor/ffmpeg/**', '!vendor/bin/ffmpeg', '!vendor/phpunit/**', '!vendor/squizlabs/**']
}
},
phpdocumentor: {
Expand Down
78 changes: 68 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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/
```
Expand All @@ -33,19 +36,33 @@ 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
```

## PHP requirements

You will need PHP 5.5 (or higher) and the following PHP modules:

* fileinfo
* intl
* mbstring
* curl

## 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;
Expand Down Expand Up @@ -93,17 +110,58 @@ 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.__

## 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:

```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).

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).

## Use as library

Alltube can also be used as a library to extract a video URL from a webpage.

You can install it with:

```bash
composer require rudloff/alltube
```

You can then use it in your PHP code:

```php
use Alltube\Config;
use Alltube\VideoDownload;

require_once __DIR__.'/vendor/autoload.php';

$downloader = new VideoDownload(
new Config(
[
'youtubedl' => '/usr/local/bin/youtube-dl',
]
)
);

$downloader->getURL('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
```

The library documentation is available on [alltube.surge.sh](https://alltube.surge.sh/classes/Alltube.VideoDownload.html).

You can also have a look at this [example project](https://github.com/Rudloff/alltube-example-project).

## FAQ

Please read the [FAQ](FAQ.md) before reporting any issue.

## 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.
46 changes: 32 additions & 14 deletions classes/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,38 +84,56 @@ class Config
/**
* Config constructor.
*
* @param string $yamlfile YAML config file path
* Available options:
* * youtubedl: youtube-dl binary path
* * python: Python binary path
* * avconv: avconv or ffmpeg binary path
* * rtmpdump: rtmpdump binary path
* * curl: curl binary path
* * params: Array of youtube-dl parameters
* * curl_params: Array of curl parameters
* * convert: Enable conversion?
*
* @param array $options Options
*/
private function __construct($yamlfile)
public function __construct(array $options)
{
$this->file = $yamlfile;
if (is_file($yamlfile)) {
$yaml = Yaml::parse(file_get_contents($yamlfile));
if (isset($yaml) && is_array($yaml)) {
foreach ($yaml as $param => $value) {
if (isset($this->$param) && isset($value)) {
$this->$param = $value;
}
if (isset($options) && is_array($options)) {
foreach ($options as $option => $value) {
if (isset($this->$option) && isset($value)) {
$this->$option = $value;
}
}
}
if (getenv('CONVERT')) {
$this->convert = getenv('CONVERT');
$this->convert = (bool) getenv('CONVERT');
}
}

/**
* Get singleton instance.
* Get Config singleton instance from YAML config file.
*
* @param string $yamlfile YAML config file name
*
* @return Config
*/
public static function getInstance($yamlfile = 'config.yml')
{
$yamlfile = __DIR__.'/../'.$yamlfile;
$yamlPath = __DIR__.'/../'.$yamlfile;
if (is_null(self::$instance) || self::$instance->file != $yamlfile) {
self::$instance = new self($yamlfile);
if (is_file($yamlfile)) {
$options = Yaml::parse(file_get_contents($yamlPath));
} elseif ($yamlfile == 'config.yml') {
/*
Allow for the default file to be missing in order to
not surprise users that did not create a config file
*/
$options = [];
} else {
throw new \Exception("Can't find config file at ".$yamlPath);
}
self::$instance = new self($options);
self::$instance->file = $yamlfile;
}

return self::$instance;
Expand Down
Loading

0 comments on commit 51ee352

Please sign in to comment.