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: params:
- --no-playlist - --no-playlist
- --no-warnings - --no-warnings
- -f best - -f best[protocol^=http]
curl_params: curl_params:
convert: false convert: false
avconv: vendor/bin/ffmpeg avconv: vendor/bin/ffmpeg

View file

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

View file

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

View file

@ -26,25 +26,65 @@
<h3><label for="format">Available formats:</label></h3> <h3><label for="format">Available formats:</label></h3>
<form action="{path_for name="redirect"}"> <form action="{path_for name="redirect"}">
<input type="hidden" name="url" value="{$video->webpage_url}" /> <input type="hidden" name="url" value="{$video->webpage_url}" />
<select name="format" id="format"> <select name="format" id="format" class="monospace">
<option value="best"> <optgroup label="Generic formats">
Best ({$video->ext}) <option value="best[protocol^=http]">
{strip}
Best ({$video->ext}
{if isset($video->filesize)}
{$video->filesize}
{/if}
)
{/strip}
</option> </option>
<option value="worst"> <option value="worst[protocol^=http]">
Worst Worst
</option> </option>
<optgroup label="Other formats"> </optgroup>
<optgroup label="Detailed formats" class="monospace">
{foreach $video->formats as $format} {foreach $video->formats as $format}
{$format->protocol}
{if $format->protocol|in_array:array('http', 'https')}
{strip}
<option value="{$format->format_id}"> <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> </option>
{/strip}
{/if}
{/foreach} {/foreach}
</optgroup> </optgroup>
</select><br/><br/> </select><br/><br/>
<input class="downloadBtn" type="submit" value="Download" /><br/> <input class="downloadBtn" type="submit" value="Download" /><br/>
</form> </form>
{else} {else}
<input type="hidden" name="format" value="best" /> <input type="hidden" name="format" value="best[protocol^=http]" />
<a class="downloadBtn" <a class="downloadBtn"
href="{$video->url|escape}">Download</a><br/> href="{$video->url|escape}">Download</a><br/>
{/if} {/if}