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-0.11.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rudloff committed Dec 23, 2017
2 parents 3c182ad + 49b139d commit 3ae961c
Show file tree
Hide file tree
Showing 32 changed files with 1,431 additions and 596 deletions.
20 changes: 20 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
install:
- sc config wuauserv start= auto
- net start wuauserv
- cinst php composer ffmpeg
- refreshenv
- copy C:\tools\php72\php.ini-development C:\tools\php72\php.ini
- echo extension=C:\tools\php72\ext\php_gmp.dll >> C:\tools\php72\php.ini
- echo extension=C:\tools\php72\ext\php_gettext.dll >> C:\tools\php72\php.ini
- echo extension=C:\tools\php72\ext\php_intl.dll >> C:\tools\php72\php.ini
- echo extension=C:\tools\php72\ext\php_openssl.dll >> C:\tools\php72\php.ini
- echo extension=C:\tools\php72\ext\php_mbstring.dll >> C:\tools\php72\php.ini
- composer install --no-dev
- composer global require phpunit/phpunit
- C:\Python36\python.exe -m pip install youtube-dl

test_script:
- phpunit

build: "off"
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
language: php
php: 7
php: 7.1
addons:
apt:
packages:
- language-pack-fr
install:
- composer install
script: vendor/bin/phpunit
script: composer exec -v phpunit
after_success:
- bash <(curl -s https://codecov.io/bash)
before_deploy:
- yarn install --ignore-scripts
- ./node_modules/.bin/grunt doc
- yarn grunt doc
deploy:
provider: surge
project: ./docs/
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ Before opening a new issue, make sure that:

## Translation

If you want to help translating Alltube in your language, you can join our [POEditor project](https://poeditor.com/join/project/GJmE0wN7Xw).
If you want to help translating Alltube in your language,
you can join our [POEditor project](https://poeditor.com/join/project/GJmE0wN7Xw).
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ RUN curl -sS https://getcomposer.org/installer | php
COPY resources/php.ini /usr/local/etc/php/
COPY . /var/www/html/
RUN php composer.phar install --prefer-dist
RUN yarn install
RUN yarn install --prod
RUN ./node_modules/.bin/grunt
ENV CONVERT=1
12 changes: 9 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = function (grunt) {
},
phpunit: {
options: {
bin: 'php -dzend_extension=xdebug.so ./vendor/bin/phpunit',
bin: 'vendor/bin/phpunit',
stopOnError: true,
stopOnFailure: true,
followOutput: true
Expand Down Expand Up @@ -111,7 +111,12 @@ module.exports = function (grunt) {
css: {
src: 'css/*'
}
}
},
markdownlint: {
doc: {
src: ['README.md', 'CONTRIBUTING.md', 'resources/*.md']
}
}
}
);

Expand All @@ -128,9 +133,10 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-fixpack');
grunt.loadNpmTasks('grunt-potomo');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-markdownlint');

grunt.registerTask('default', ['cssmin', 'potomo']);
grunt.registerTask('lint', ['csslint', 'fixpack', 'jsonlint', 'phpcs']);
grunt.registerTask('lint', ['csslint', 'fixpack', 'jsonlint', 'markdownlint', 'phpcs']);
grunt.registerTask('test', ['phpunit']);
grunt.registerTask('doc', ['phpdocumentor']);
grunt.registerTask('release', ['default', 'githash', 'compress']);
Expand Down
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ 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 [Yarn](https://yarnpkg.com/) and [Composer](https://getcomposer.org/):
In order to get AllTube working,
you need to use [Yarn](https://yarnpkg.com/) and [Composer](https://getcomposer.org/):

```bash
yarn install
Expand All @@ -23,23 +24,26 @@ 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.)
(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/
```

If your web server is Apache, you need to set the `AllowOverride` setting to `All` or `FileInfo`.
If your web server is Apache,
you need to set the `AllowOverride` setting to `All` or `FileInfo`.

#### Update

When updating from Git, you need to run yarn and Composer again:

```bash
git pull
yarn install
yarn install --prod
composer install
```

Expand Down Expand Up @@ -126,16 +130,18 @@ server {

## Other dependencies

You need [avconv](https://libav.org/avconv.html) and [rtmpdump](http://rtmpdump.mplayerhq.hu/) in order to enable conversions.
You need [avconv](https://libav.org/avconv.html)
in order to enable conversions.
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
sudo apt-get install libav-tools
```

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

Expand Down
23 changes: 15 additions & 8 deletions classes/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ class Config
*/
public $avconv = 'vendor/bin/ffmpeg';

/**
* rtmpdump binary path.
*
* @var string
*/
public $rtmpdump = 'vendor/bin/rtmpdump';

/**
* Disable URL rewriting.
*
Expand All @@ -82,6 +75,21 @@ class Config
*/
public $remux = false;

/**
* MP3 bitrate when converting (in kbit/s).
*
* @var int
*/
public $audioBitrate = 128;

/**
* avconv/ffmpeg logging level.
* Must be one of these: quiet, panic, fatal, error, warning, info, verbose, debug.
*
* @var string
*/
public $avconvVerbosity = 'error';

/**
* YAML config file path.
*
Expand All @@ -96,7 +104,6 @@ class Config
* * youtubedl: youtube-dl binary path
* * python: Python binary path
* * avconv: avconv or ffmpeg binary path
* * rtmpdump: rtmpdump binary path
* * params: Array of youtube-dl parameters
* * convert: Enable conversion?
*
Expand Down
2 changes: 1 addition & 1 deletion classes/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function getIso3166()
/**
* Get country information from locale.
*
* @return \Rinvex\Country\Country
* @return \Rinvex\Country\Country|array
*/
public function getCountry()
{
Expand Down
15 changes: 11 additions & 4 deletions classes/LocaleManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Alltube;

use Symfony\Component\Process\ProcessBuilder;
use Symfony\Component\Process\Process;

/**
* Class used to manage locales.
Expand Down Expand Up @@ -42,7 +42,6 @@ public function __construct(array $cookies = [])
{
$session_factory = new \Aura\Session\SessionFactory();
$session = $session_factory->newInstance($cookies);
$session->setCookieParams(['httponly' => true]);
$this->sessionSegment = $session->getSegment('Alltube\LocaleManager');
$cookieLocale = $this->sessionSegment->get('locale');
if (isset($cookieLocale)) {
Expand All @@ -58,8 +57,7 @@ public function __construct(array $cookies = [])
public function getSupportedLocales()
{
$return = [];
$builder = new ProcessBuilder(['locale', '-a']);
$process = $builder->getProcess();
$process = new Process(['locale', '-a']);
$process->run();
$installedLocales = explode(PHP_EOL, trim($process->getOutput()));
foreach ($this->supportedLocales as $supportedLocale) {
Expand Down Expand Up @@ -95,4 +93,13 @@ public function setLocale(Locale $locale)
$this->curLocale = $locale;
$this->sessionSegment->set('locale', $locale);
}

/**
* Unset the current locale.
*/
public function unsetLocale()
{
$this->curLocale = null;
$this->sessionSegment->clear();
}
}
17 changes: 11 additions & 6 deletions classes/PlaylistArchiveStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ class PlaylistArchiveStream extends TarArchive
/**
* PlaylistArchiveStream constructor.
*/
public function __construct()
public function __construct(Config $config = null)
{
$this->client = new \GuzzleHttp\Client();
$this->download = new VideoDownload();
$this->download = new VideoDownload($config);
}

/**
Expand All @@ -78,7 +78,9 @@ protected function send($data)
{
$pos = ftell($this->buffer);
fwrite($this->buffer, $data);
fseek($this->buffer, $pos);
if ($pos !== false) {
fseek($this->buffer, $pos);
}
}

/**
Expand All @@ -91,7 +93,10 @@ protected function send($data)
public function stream_open($path)
{
$this->format = ltrim(parse_url($path, PHP_URL_PATH), '/');
$this->buffer = fopen('php://temp', 'r+');
$buffer = fopen('php://temp', 'r+');
if ($buffer !== false) {
$this->buffer = $buffer;
}
foreach (explode(';', parse_url($path, PHP_URL_HOST)) as $url) {
$this->files[] = [
'url' => urldecode($url),
Expand Down Expand Up @@ -131,7 +136,7 @@ public function stream_stat()
/**
* Called when ftell() is used on the stream.
*
* @return int
* @return int|false
*/
public function stream_tell()
{
Expand Down Expand Up @@ -171,7 +176,7 @@ public function stream_eof()
*
* @param int $count Number of bytes to read
*
* @return string
* @return string|false
*/
public function stream_read($count)
{
Expand Down
Loading

0 comments on commit 3ae961c

Please sign in to comment.