Merge branch 'release/2.0.2'
This commit is contained in:
commit
b139e6edab
12 changed files with 431 additions and 313 deletions
|
@ -126,6 +126,13 @@ class Config
|
||||||
*/
|
*/
|
||||||
private $file;
|
private $file;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic formats supported by youtube-dl.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $genericFormats = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Config constructor.
|
* Config constructor.
|
||||||
*
|
*
|
||||||
|
@ -135,6 +142,42 @@ class Config
|
||||||
{
|
{
|
||||||
$this->applyOptions($options);
|
$this->applyOptions($options);
|
||||||
$this->getEnv();
|
$this->getEnv();
|
||||||
|
|
||||||
|
if (empty($this->genericFormats)) {
|
||||||
|
// We don't put this in the class definition so it can be detected by xgettext.
|
||||||
|
$this->genericFormats = [
|
||||||
|
'best' => _('Best'),
|
||||||
|
'bestvideo+bestaudio' => _('Remux best video with best audio'),
|
||||||
|
'worst' => _('Worst'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->genericFormats as $format => $name) {
|
||||||
|
if (strpos($format, '+') !== false) {
|
||||||
|
if (!$this->remux) {
|
||||||
|
// Disable combined formats if remux mode is not enabled.
|
||||||
|
unset($this->genericFormats[$format]);
|
||||||
|
}
|
||||||
|
} elseif (!$this->stream) {
|
||||||
|
// Force HTTP if stream is not enabled.
|
||||||
|
$this->replaceGenericFormat($format, $format.'[protocol=https]/'.$format.'[protocol=http]');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace a format key.
|
||||||
|
*
|
||||||
|
* @param string $oldFormat Old format
|
||||||
|
* @param string $newFormat New format
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function replaceGenericFormat($oldFormat, $newFormat)
|
||||||
|
{
|
||||||
|
$keys = array_keys($this->genericFormats);
|
||||||
|
$keys[array_search($oldFormat, $keys)] = $newFormat;
|
||||||
|
$this->genericFormats = array_combine($keys, $this->genericFormats);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -29,7 +29,7 @@ class YoutubeStream extends AppendStream
|
||||||
|
|
||||||
while ($rangeStart < $contentLenghtHeader[0]) {
|
while ($rangeStart < $contentLenghtHeader[0]) {
|
||||||
$rangeEnd = $rangeStart + $video->downloader_options->http_chunk_size;
|
$rangeEnd = $rangeStart + $video->downloader_options->http_chunk_size;
|
||||||
if ($rangeEnd > $contentLenghtHeader[0]) {
|
if ($rangeEnd >= $contentLenghtHeader[0]) {
|
||||||
$rangeEnd = $contentLenghtHeader[0] - 1;
|
$rangeEnd = $contentLenghtHeader[0] - 1;
|
||||||
}
|
}
|
||||||
$response = $video->getHttpResponse(['Range' => 'bytes='.$rangeStart.'-'.$rangeEnd]);
|
$response = $video->getHttpResponse(['Range' => 'bytes='.$rangeStart.'-'.$rangeEnd]);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
"phpunit/phpunit": "~6.5.2",
|
"phpunit/phpunit": "~6.5.2",
|
||||||
"doctrine/instantiator": "~1.0.0",
|
"doctrine/instantiator": "~1.0.0",
|
||||||
"ffmpeg/ffmpeg": "4.0.3",
|
"ffmpeg/ffmpeg": "4.0.3",
|
||||||
"rg3/youtube-dl": "2019.04.24",
|
"rg3/youtube-dl": "2019.06.08",
|
||||||
"heroku/heroku-buildpack-php": "*",
|
"heroku/heroku-buildpack-php": "*",
|
||||||
"anam/phantomjs-linux-x86-binary": "~2.1.1",
|
"anam/phantomjs-linux-x86-binary": "~2.1.1",
|
||||||
"phpstan/phpstan": "~0.9.2"
|
"phpstan/phpstan": "~0.9.2"
|
||||||
|
@ -40,10 +40,10 @@
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"package": {
|
"package": {
|
||||||
"name": "rg3/youtube-dl",
|
"name": "rg3/youtube-dl",
|
||||||
"version": "2019.04.24",
|
"version": "2019.06.08",
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://github.com/rg3/youtube-dl/archive/2019.04.24.zip"
|
"url": "https://github.com/rg3/youtube-dl/archive/2019.06.08.zip"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
633
composer.lock
generated
633
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -45,3 +45,9 @@ audioBitrate: 128
|
||||||
|
|
||||||
# App name
|
# App name
|
||||||
appName: AllTube Download
|
appName: AllTube Download
|
||||||
|
|
||||||
|
# Generic formats supported by youtube-dl
|
||||||
|
genericFormats:
|
||||||
|
best: Best
|
||||||
|
bestvideo+bestaudio: Remux best video with best audio
|
||||||
|
worst: Worst
|
||||||
|
|
|
@ -128,7 +128,7 @@ class DownloadController extends BaseController
|
||||||
return $frontController->password($request, $response);
|
return $frontController->password($request, $response);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// If MP3 is not available, we convert it.
|
// If MP3 is not available, we convert it.
|
||||||
$this->video = $this->video->withFormat($this->defaultFormat);
|
$this->video = $this->video->withFormat('bestaudio');
|
||||||
|
|
||||||
return $this->getConvertedAudioResponse($request, $response);
|
return $this->getConvertedAudioResponse($request, $response);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
namespace Alltube\Controller;
|
namespace Alltube\Controller;
|
||||||
|
|
||||||
use Alltube\Config;
|
|
||||||
use Alltube\Exception\PasswordException;
|
use Alltube\Exception\PasswordException;
|
||||||
use Alltube\Locale;
|
use Alltube\Locale;
|
||||||
use Alltube\LocaleManager;
|
use Alltube\LocaleManager;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "alltube",
|
"name": "alltube",
|
||||||
"description": "HTML GUI for youtube-dl",
|
"description": "HTML GUI for youtube-dl",
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"author": "Pierre Rudloff",
|
"author": "Pierre Rudloff",
|
||||||
"bugs": "https://github.com/Rudloff/alltube/issues",
|
"bugs": "https://github.com/Rudloff/alltube/issues",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
"open-sans-fontface": "~1.4.0"
|
"open-sans-fontface": "~1.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt-contrib-compress": "~1.4.1",
|
"grunt-contrib-compress": "~1.5.0",
|
||||||
"grunt-contrib-csslint": "~2.0.0",
|
"grunt-contrib-csslint": "~2.0.0",
|
||||||
"grunt-contrib-watch": "~1.0.0",
|
"grunt-contrib-watch": "~1.0.0",
|
||||||
"grunt-fixpack": "~0.1.0",
|
"grunt-fixpack": "~0.1.0",
|
||||||
|
|
|
@ -64,6 +64,7 @@ Then push the code to Heroku and it should work out of the box.
|
||||||
Some websites generate an unique video URL for each IP address.
|
Some websites generate an unique video URL for each IP address.
|
||||||
When using AllTube, the URL is generated for our server's IP address
|
When using AllTube, the URL is generated for our server's IP address
|
||||||
and your computer is not allowed to use it.
|
and your computer is not allowed to use it.
|
||||||
|
(This is also known to happen with Vevo YouTube videos.)
|
||||||
|
|
||||||
There are two known workarounds:
|
There are two known workarounds:
|
||||||
|
|
||||||
|
@ -171,3 +172,15 @@ convertAdvancedFormats: [mp3, avi, flv, wav]
|
||||||
|
|
||||||
This will add new inputs on the download page
|
This will add new inputs on the download page
|
||||||
that allow users to converted videos to other formats.
|
that allow users to converted videos to other formats.
|
||||||
|
|
||||||
|
## Use other youtube-dl generic formats (e.g. `bestaudio`)
|
||||||
|
|
||||||
|
You can add new formats by using the `genericFormats` option,
|
||||||
|
for example:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
genericFormats:
|
||||||
|
bestaudio: Best audio
|
||||||
|
```
|
||||||
|
|
||||||
|
These will be available on every video page.
|
||||||
|
|
|
@ -27,19 +27,9 @@
|
||||||
{/if}
|
{/if}
|
||||||
<select name="format" id="format" class="formats monospace">
|
<select name="format" id="format" class="formats monospace">
|
||||||
<optgroup label="{t}Generic formats{/t}">
|
<optgroup label="{t}Generic formats{/t}">
|
||||||
<option value="{$defaultFormat}">
|
{foreach $config->genericFormats as $format => $name}
|
||||||
{strip}
|
<option value="{$format}">{t}{$name}{/t}</option>
|
||||||
{t}Best{/t} ({$video->ext})
|
{/foreach}
|
||||||
{/strip}
|
|
||||||
</option>
|
|
||||||
{if $config->remux}
|
|
||||||
<option value="bestvideo+bestaudio">
|
|
||||||
{t}Remux best video with best audio{/t}
|
|
||||||
</option>
|
|
||||||
{/if}
|
|
||||||
<option value="{$defaultFormat|replace:best:worst}">
|
|
||||||
{t}Worst{/t}
|
|
||||||
</option>
|
|
||||||
</optgroup>
|
</optgroup>
|
||||||
<optgroup label="{t}Detailed formats{/t}" class="monospace">
|
<optgroup label="{t}Detailed formats{/t}" class="monospace">
|
||||||
{foreach $video->formats as $format}
|
{foreach $video->formats as $format}
|
||||||
|
@ -81,7 +71,7 @@
|
||||||
</optgroup>
|
</optgroup>
|
||||||
</select><br/><br/>
|
</select><br/><br/>
|
||||||
{if $config->stream}
|
{if $config->stream}
|
||||||
<input type="checkbox" name="stream" id="stream"/>
|
<input type="checkbox" checked name="stream" id="stream"/>
|
||||||
<label for="stream">{t}Stream the video through the server{/t}</label>
|
<label for="stream">{t}Stream the video through the server{/t}</label>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -169,7 +169,7 @@ class VideoTest extends BaseTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides M3U8 URLs for tests.
|
* Provides URLs for remux tests.
|
||||||
*
|
*
|
||||||
* @return array[]
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
|
@ -186,7 +186,7 @@ class VideoTest extends BaseTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides URLs for remux tests.
|
* Provides M3U8 URLs for tests.
|
||||||
*
|
*
|
||||||
* @return array[]
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
|
|
12
yarn.lock
12
yarn.lock
|
@ -770,10 +770,10 @@ grunt-cli@~1.2.0:
|
||||||
nopt "~3.0.6"
|
nopt "~3.0.6"
|
||||||
resolve "~1.1.0"
|
resolve "~1.1.0"
|
||||||
|
|
||||||
grunt-contrib-compress@~1.4.1:
|
grunt-contrib-compress@~1.5.0:
|
||||||
version "1.4.3"
|
version "1.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/grunt-contrib-compress/-/grunt-contrib-compress-1.4.3.tgz#01ceffb9c637f52e7081f463750983d0a3b0fa73"
|
resolved "https://registry.yarnpkg.com/grunt-contrib-compress/-/grunt-contrib-compress-1.5.0.tgz#ba5f80e22acf192897ce43cb60250cab2cb1f09b"
|
||||||
integrity sha1-Ac7/ucY39S5wgfRjdQmD0KOw+nM=
|
integrity sha512-RcCyetnvTJ7jvnDCSm05wOndAd00HWZTHeVGDVVmCM+K/PEivL0yx8vKyi8uzy0492l2dJgtzR0Ucid7roKg6A==
|
||||||
dependencies:
|
dependencies:
|
||||||
archiver "^1.3.0"
|
archiver "^1.3.0"
|
||||||
chalk "^1.1.1"
|
chalk "^1.1.1"
|
||||||
|
@ -781,7 +781,7 @@ grunt-contrib-compress@~1.4.1:
|
||||||
pretty-bytes "^4.0.2"
|
pretty-bytes "^4.0.2"
|
||||||
stream-buffers "^2.1.0"
|
stream-buffers "^2.1.0"
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
iltorb "^1.0.13"
|
iltorb "^1.3.10"
|
||||||
|
|
||||||
grunt-contrib-csslint@~2.0.0:
|
grunt-contrib-csslint@~2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
|
@ -1026,7 +1026,7 @@ ieee754@^1.1.4:
|
||||||
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84"
|
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84"
|
||||||
integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==
|
integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==
|
||||||
|
|
||||||
iltorb@^1.0.13:
|
iltorb@^1.3.10:
|
||||||
version "1.3.10"
|
version "1.3.10"
|
||||||
resolved "https://registry.yarnpkg.com/iltorb/-/iltorb-1.3.10.tgz#a0d9e4e7d52bf510741442236cbe0cc4230fc9f8"
|
resolved "https://registry.yarnpkg.com/iltorb/-/iltorb-1.3.10.tgz#a0d9e4e7d52bf510741442236cbe0cc4230fc9f8"
|
||||||
integrity sha512-nyB4+ru1u8CQqQ6w7YjasboKN3NQTN8GH/V/eEssNRKhW6UbdxdWhB9fJ5EEdjJfezKY0qPrcwLyIcgjL8hHxA==
|
integrity sha512-nyB4+ru1u8CQqQ6w7YjasboKN3NQTN8GH/V/eEssNRKhW6UbdxdWhB9fJ5EEdjJfezKY0qPrcwLyIcgjL8hHxA==
|
||||||
|
|
Loading…
Reference in a new issue