New video UI
This commit is contained in:
parent
7a97303854
commit
6b1ea94078
@ -329,11 +329,10 @@ def stream():
|
|||||||
ydl = YoutubeDL()
|
ydl = YoutubeDL()
|
||||||
data = ydl.extract_info("{id}".format(id=id), download=False)
|
data = ydl.extract_info("{id}".format(id=id), download=False)
|
||||||
req = requests.get(data['formats'][-1]['url'], stream = True)
|
req = requests.get(data['formats'][-1]['url'], stream = True)
|
||||||
return Response(req.iter_content(chunk_size=10*1024), content_type = req.headers['Content-Type'])
|
return Response(req.iter_content(chunk_size=10*1024), mimetype=req.headers['Content-Type'], direct_passthrough=True, content_type=req.headers['Content-Type'])
|
||||||
else:
|
else:
|
||||||
flash("Something went wrong loading the video... Try again.")
|
flash("Something went wrong loading the video... Try again.")
|
||||||
return redirect(url_for('youtube'))
|
return redirect(url_for('youtube'))
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
#### General Logic ######
|
#### General Logic ######
|
||||||
#########################
|
#########################
|
||||||
|
@ -3,51 +3,45 @@
|
|||||||
</head>
|
</head>
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div style="margin-top: 2em;" class="ui one column centered grid">
|
<div class="ui text container">
|
||||||
<video class="video-js vjs-default-skin"
|
<video class="video-js vjs-default-skin"
|
||||||
data-setup='{ "playbackRates": [0.5, 1, 1.25,1.5, 2] }'
|
data-setup='{ "playbackRates": [0.5, 1, 1.25,1.5, 2] }'
|
||||||
width="720" height="420"
|
width="720" height="420"
|
||||||
controls
|
controls
|
||||||
preload="auto">
|
preload="auto">
|
||||||
|
|
||||||
<source src="/stream?v={{video.id}}" type="video/mp4">
|
<source src="/stream?v={{video.id}}" type="video/mp4">
|
||||||
</video>
|
</video>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="margin-top: 2em;" class="ui one column center aligned grid">
|
<div class="ui segments">
|
||||||
<h2 class="ui header">{{video.title}}</h2></a>
|
<div class="ui segment">
|
||||||
</div>
|
<h2 class="ui header">{{video.title}}</h2>
|
||||||
|
|
||||||
<div style="margin-top: 2em;" class="ui center aligned grid">
|
|
||||||
<div class="two wide column">
|
|
||||||
<a target="_blank" href="{{ url_for('channel', id=video.channelId)}}" class="ui label">
|
|
||||||
{%if video.author.__len__() > 8%}
|
|
||||||
<i class="user icon"></i> {{video.author[0:10]+'...'}}
|
|
||||||
{%else%}
|
|
||||||
<i class="user icon"></i> {{video.author}}
|
|
||||||
{%endif%}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="two wide column">
|
|
||||||
<div class="ui label">
|
|
||||||
<i class="eye icon"></i>{{video.viewCount}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="ui horizontal segments">
|
||||||
<div class="two wide column">
|
<div class="center aligned ui segment">
|
||||||
<div class="para-light-grey">
|
<a target="_blank" href="{{ url_for('channel', id=video.channelId)}}">
|
||||||
<div class="para-green" style="height:12px;width:{{video.averageRating.split(".")[0]}}%"></div>
|
{%if video.author.__len__() > 8%}
|
||||||
|
<i class="user icon"></i> {{video.author[0:10]+'...'}}
|
||||||
|
{%else%}
|
||||||
|
<i class="user icon"></i> {{video.author}}
|
||||||
|
{%endif%}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="center aligned ui segment">
|
||||||
|
<h4 class="ui header"><i class="grey eye icon"></i>{{video.viewCount}}</h4>
|
||||||
|
</div>
|
||||||
|
<div class="center aligned ui segment">
|
||||||
|
{% if video.averageRating | int > 49 %}
|
||||||
|
<h4 class="ui header"><i class="green thumbs up icon"></i> {{video.averageRating[0:4]}}%</h4>
|
||||||
|
{% else %}
|
||||||
|
<h4 class="ui header"><i class="red thumbs down icon"></i> {{video.averageRating[0:4]}}%</h4>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="label"> Rating: {{video.averageRating[0:4]}}% <i class="green thumbs up icon"></i></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<div class="ui raised segment">
|
||||||
|
<p>{{video.description}}</p>
|
||||||
<div style="margin-top: 2em;" class="ui one column center aligned grid">
|
</div>
|
||||||
<div style="margin-bottom: 2em;" class="ui comments">
|
</div>
|
||||||
<h3 class="ui dividing header">Description</h3>
|
|
||||||
{{video.description}}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<script src="{{ url_for('static',filename='videojs.js') }}"></script>
|
<script src="{{ url_for('static',filename='videojs.js') }}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
Reference in New Issue
Block a user