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

Commit

Permalink
Merge branch 'release-3.0.0-beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rudloff committed Jun 23, 2020
2 parents 440063c + 00e1d57 commit 9c1cb78
Show file tree
Hide file tree
Showing 47 changed files with 1,427 additions and 1,745 deletions.
9 changes: 1 addition & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
youtube-dl
dist/
node_modules/
config.php
vendor/
templates_c/
ffmpeg.tar.xz
ffmpeg-*/
alltube-*.zip
coverage/
bower_components/
config/config.yml
docs/
clover.xml
i18n/*/LC_MESSAGES/*.mo
.phpunit.result.cache
.git/
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ addons:
- language-pack-fr
install: composer install --no-progress
script:
- composer check-platform-reqs
- composer lint
- composer test
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
FROM php:7.3-apache
RUN apt-get update
RUN apt-get install -y libicu-dev xz-utils git zlib1g-dev python libgmp-dev gettext libzip-dev
RUN apt-get install -y libicu-dev xz-utils git python libgmp-dev unzip ffmpeg
RUN docker-php-ext-install mbstring
RUN docker-php-ext-install intl
RUN docker-php-ext-install zip
RUN docker-php-ext-install gmp
RUN docker-php-ext-install gettext
RUN a2enmod rewrite
RUN curl -sS https://getcomposer.org/installer | php
RUN curl -sS https://getcomposer.org/installer | php -- --quiet
COPY resources/php.ini /usr/local/etc/php/
COPY . /var/www/html/
RUN php composer.phar install --prefer-dist --no-progress
RUN php composer.phar check-platform-reqs --no-dev
RUN php composer.phar install --prefer-dist --no-progress --no-dev --optimize-autoloader
ENV CONVERT=1
52 changes: 13 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ composer install

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
Expand Down Expand Up @@ -66,19 +62,22 @@ cp config/config.example.yml config/config.yml

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

* fileinfo
* intl
* mbstring
* curl
* gmp

## Web server configuration

### Apache

You will need the following modules:
The following modules are recommended:

* mod_mime
* mod_rewrite
* mod_expires
* mod_filter
* mod_deflate
* mod_headers

### Nginx

Expand Down Expand Up @@ -133,47 +132,22 @@ server {

## Other dependencies

You need [avconv](https://libav.org/avconv.html)
You need [ffmpeg](https://ffmpeg.org/)
in order to enable conversions.
If you don't want to enable conversions, you can disable it in `config.yml`.
(Conversions are disabled by default.)

On Debian-based systems:

```bash
sudo apt-get install libav-tools
sudo apt-get install ffmpeg
```

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.
If your ffmpeg binary is not installed at `/usr/bin/ffmpeg`, you also need to edit the `ffmpeg` variable in `config.yml`.

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\Video;

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

Config::setOptions(
[
'youtubedl' => '/usr/local/bin/youtube-dl',
]
);
$video = new Video('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
$video->getUrl();
```
## Use as a library

You can also have a look at this [example project](https://github.com/Rudloff/alltube-example-project).
The `Video` class is now available as [a separate package](https://packagist.org/packages/rudloff/alltube-library)
so that you can reuse it in your projects.

## JSON API

Expand Down
61 changes: 21 additions & 40 deletions RoboFile.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

use Robo\Tasks;
use Symfony\Component\Finder\Finder;

/**
* Manage robo tasks.
Expand All @@ -15,51 +14,33 @@ class RoboFile extends Tasks
*/
public function release()
{
$this->stopOnFail();

$result = $this->taskExec('git')
->args('describe')
->printOutput(false)
->arg('describe')
->run();
$result->provideOutputdata();
$tag = $result->getOutputData();

// We don't want the whole vendor directory.
$finder = new Finder();
$finder->files()
->in(__DIR__ . '/vendor/')
->exclude(
[
'ffmpeg/',
'bin/',
'anam/phantomjs-linux-x86-binary/',
'phpunit/',
'squizlabs/',
'rinvex/countries/resources/geodata/',
'rinvex/countries/resources/flags/'
]
);
$tmpDir = $this->_tmpDir();

$filename = 'alltube-' . trim($result->getOutputData()) . '.zip';

$zipTask = $this->taskPack('alltube-' . $tag . '.zip')
->add('index.php')
->add('config/config.example.yml')
->add('.htaccess')
->add('img')
->add('LICENSE')
->add('README.md')
->add('robots.txt')
->add('resources')
->add('templates')
->add('templates_c/')
->add('classes')
->add('controllers')
->add('css')
->add('i18n');
$this->taskFilesystemStack()
->remove($filename)
->run();

foreach ($finder as $file) {
if ($path = $file->getRelativePathname()) {
$zipTask->add('vendor/' . $path);
}
}
$this->taskGitStack()
->cloneRepo(__DIR__, $tmpDir)
->run();

$zipTask->run();
$this->taskComposerInstall()
->dir($tmpDir)
->optimizeAutoloader()
->noDev()
->run();

$this->taskPack($filename)
->addDir('alltube', $tmpDir)
->run();
}
}
4 changes: 0 additions & 4 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
}
],
"env": {
"CONVERT": {
"description": "Enable audio conversion",
"value": "true"
},
"PYTHON": {
"description": "Path to python binary",
"value": "/app/.heroku/python/bin/python"
Expand Down
Loading

0 comments on commit 9c1cb78

Please sign in to comment.