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;
|
||||
|
||||
/**
|
||||
* Generic formats supported by youtube-dl.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $genericFormats = [];
|
||||
|
||||
/**
|
||||
* Config constructor.
|
||||
*
|
||||
|
@ -135,6 +142,42 @@ class Config
|
|||
{
|
||||
$this->applyOptions($options);
|
||||
$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]) {
|
||||
$rangeEnd = $rangeStart + $video->downloader_options->http_chunk_size;
|
||||
if ($rangeEnd > $contentLenghtHeader[0]) {
|
||||
if ($rangeEnd >= $contentLenghtHeader[0]) {
|
||||
$rangeEnd = $contentLenghtHeader[0] - 1;
|
||||
}
|
||||
$response = $video->getHttpResponse(['Range' => 'bytes='.$rangeStart.'-'.$rangeEnd]);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
"phpunit/phpunit": "~6.5.2",
|
||||
"doctrine/instantiator": "~1.0.0",
|
||||
"ffmpeg/ffmpeg": "4.0.3",
|
||||
"rg3/youtube-dl": "2019.04.24",
|
||||
"rg3/youtube-dl": "2019.06.08",
|
||||
"heroku/heroku-buildpack-php": "*",
|
||||
"anam/phantomjs-linux-x86-binary": "~2.1.1",
|
||||
"phpstan/phpstan": "~0.9.2"
|
||||
|
@ -40,10 +40,10 @@
|
|||
"type": "package",
|
||||
"package": {
|
||||
"name": "rg3/youtube-dl",
|
||||
"version": "2019.04.24",
|
||||
"version": "2019.06.08",
|
||||
"dist": {
|
||||
"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
|
||||
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);
|
||||
} catch (Exception $e) {
|
||||
// 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);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
namespace Alltube\Controller;
|
||||
|
||||
use Alltube\Config;
|
||||
use Alltube\Exception\PasswordException;
|
||||
use Alltube\Locale;
|
||||
use Alltube\LocaleManager;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "alltube",
|
||||
"description": "HTML GUI for youtube-dl",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.2",
|
||||
"author": "Pierre Rudloff",
|
||||
"bugs": "https://github.com/Rudloff/alltube/issues",
|
||||
"dependencies": {
|
||||
|
@ -11,7 +11,7 @@
|
|||
"open-sans-fontface": "~1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt-contrib-compress": "~1.4.1",
|
||||
"grunt-contrib-compress": "~1.5.0",
|
||||
"grunt-contrib-csslint": "~2.0.0",
|
||||
"grunt-contrib-watch": "~1.0.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.
|
||||
When using AllTube, the URL is generated for our server's IP address
|
||||
and your computer is not allowed to use it.
|
||||
(This is also known to happen with Vevo YouTube videos.)
|
||||
|
||||
There are two known workarounds:
|
||||
|
||||
|
@ -171,3 +172,15 @@ convertAdvancedFormats: [mp3, avi, flv, wav]
|
|||
|
||||
This will add new inputs on the download page
|
||||
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}
|
||||
<select name="format" id="format" class="formats monospace">
|
||||
<optgroup label="{t}Generic formats{/t}">
|
||||
<option value="{$defaultFormat}">
|
||||
{strip}
|
||||
{t}Best{/t} ({$video->ext})
|
||||
{/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>
|
||||
{foreach $config->genericFormats as $format => $name}
|
||||
<option value="{$format}">{t}{$name}{/t}</option>
|
||||
{/foreach}
|
||||
</optgroup>
|
||||
<optgroup label="{t}Detailed formats{/t}" class="monospace">
|
||||
{foreach $video->formats as $format}
|
||||
|
@ -81,7 +71,7 @@
|
|||
</optgroup>
|
||||
</select><br/><br/>
|
||||
{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>
|
||||
<br/><br/>
|
||||
{/if}
|
||||
|
|
|
@ -169,7 +169,7 @@ class VideoTest extends BaseTest
|
|||
}
|
||||
|
||||
/**
|
||||
* Provides M3U8 URLs for tests.
|
||||
* Provides URLs for remux tests.
|
||||
*
|
||||
* @return array[]
|
||||
*/
|
||||
|
@ -186,7 +186,7 @@ class VideoTest extends BaseTest
|
|||
}
|
||||
|
||||
/**
|
||||
* Provides URLs for remux tests.
|
||||
* Provides M3U8 URLs for tests.
|
||||
*
|
||||
* @return array[]
|
||||
*/
|
||||
|
|
12
yarn.lock
12
yarn.lock
|
@ -770,10 +770,10 @@ grunt-cli@~1.2.0:
|
|||
nopt "~3.0.6"
|
||||
resolve "~1.1.0"
|
||||
|
||||
grunt-contrib-compress@~1.4.1:
|
||||
version "1.4.3"
|
||||
resolved "https://registry.yarnpkg.com/grunt-contrib-compress/-/grunt-contrib-compress-1.4.3.tgz#01ceffb9c637f52e7081f463750983d0a3b0fa73"
|
||||
integrity sha1-Ac7/ucY39S5wgfRjdQmD0KOw+nM=
|
||||
grunt-contrib-compress@~1.5.0:
|
||||
version "1.5.0"
|
||||
resolved "https://registry.yarnpkg.com/grunt-contrib-compress/-/grunt-contrib-compress-1.5.0.tgz#ba5f80e22acf192897ce43cb60250cab2cb1f09b"
|
||||
integrity sha512-RcCyetnvTJ7jvnDCSm05wOndAd00HWZTHeVGDVVmCM+K/PEivL0yx8vKyi8uzy0492l2dJgtzR0Ucid7roKg6A==
|
||||
dependencies:
|
||||
archiver "^1.3.0"
|
||||
chalk "^1.1.1"
|
||||
|
@ -781,7 +781,7 @@ grunt-contrib-compress@~1.4.1:
|
|||
pretty-bytes "^4.0.2"
|
||||
stream-buffers "^2.1.0"
|
||||
optionalDependencies:
|
||||
iltorb "^1.0.13"
|
||||
iltorb "^1.3.10"
|
||||
|
||||
grunt-contrib-csslint@~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"
|
||||
integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==
|
||||
|
||||
iltorb@^1.0.13:
|
||||
iltorb@^1.3.10:
|
||||
version "1.3.10"
|
||||
resolved "https://registry.yarnpkg.com/iltorb/-/iltorb-1.3.10.tgz#a0d9e4e7d52bf510741442236cbe0cc4230fc9f8"
|
||||
integrity sha512-nyB4+ru1u8CQqQ6w7YjasboKN3NQTN8GH/V/eEssNRKhW6UbdxdWhB9fJ5EEdjJfezKY0qPrcwLyIcgjL8hHxA==
|
||||
|
|
Loading…
Reference in a new issue