More info about formats

Only HTTP formats
This commit is contained in:
Pierre Rudloff 2016-04-11 01:21:01 +02:00
parent c6c2214567
commit 7d548c06b6
4 changed files with 104 additions and 60 deletions

View File

@ -3,7 +3,7 @@ python: /usr/bin/python
params:
- --no-playlist
- --no-warnings
- -f best
- -f best[protocol^=http]
curl_params:
convert: false
avconv: vendor/bin/ffmpeg

View File

@ -113,7 +113,7 @@ class FrontController
if (isset($params['audio'])) {
try {
try {
$url = $this->download->getURL($params["url"], 'bestaudio');
$url = $this->download->getURL($params["url"], 'bestaudio[protocol^=http]');
return $response->withRedirect($url);
} catch (\Exception $e) {
$video = $this->download->getJSON($params["url"]);

View File

@ -565,6 +565,10 @@ h1 {
margin-bottom: 1em;
}
.monospace {
font-family:monospace;
}
@media (max-width: 640px) {
.thumb {
width:90%;

View File

@ -26,25 +26,65 @@
<h3><label for="format">Available formats:</label></h3>
<form action="{path_for name="redirect"}">
<input type="hidden" name="url" value="{$video->webpage_url}" />
<select name="format" id="format">
<option value="best">
Best ({$video->ext})
<select name="format" id="format" class="monospace">
<optgroup label="Generic formats">
<option value="best[protocol^=http]">
{strip}
Best ({$video->ext}
{if isset($video->filesize)}
{$video->filesize}
{/if}
)
{/strip}
</option>
<option value="worst">
<option value="worst[protocol^=http]">
Worst
</option>
<optgroup label="Other formats">
</optgroup>
<optgroup label="Detailed formats" class="monospace">
{foreach $video->formats as $format}
{$format->protocol}
{if $format->protocol|in_array:array('http', 'https')}
{strip}
<option value="{$format->format_id}">
{$format->format} ({$format->ext})
{$format->ext}
{for $foo=1 to (5 - ($format->ext|strlen))}
&nbsp;
{/for}
{if isset($format->width)}
{$format->width}x{$format->height}
{for $foo=1 to (10 - (("{$format->width}x{$format->height}")|strlen))}
&nbsp;
{/for}
{else}
{for $foo=1 to 10}
&nbsp;
{/for}
{/if}
{if isset($format->filesize)}
{($format->filesize/1000000)|round:2} MB
{for $foo=1 to (7 - (($format->filesize/1000000)|round:2|strlen))}
&nbsp;
{/for}
{else}
{for $foo=1 to 10}
&nbsp;
{/for}
{/if}
{if isset($format->format_note)}
{$format->format_note}
{/if}
&nbsp;({$format->format_id})
</option>
{/strip}
{/if}
{/foreach}
</optgroup>
</select><br/><br/>
<input class="downloadBtn" type="submit" value="Download" /><br/>
</form>
{else}
<input type="hidden" name="format" value="best" />
<input type="hidden" name="format" value="best[protocol^=http]" />
<a class="downloadBtn"
href="{$video->url|escape}">Download</a><br/>
{/if}