Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improved animation in website #65

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions media_server.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
import os, sys
import os
import sys
from flask import Flask, request, render_template
from importlib import reload

# reload(sys)
# sys.setdefaultencoding('utf8')
reload(sys)
sys.setdefaultencoding('utf8')
sys.setdefaultencoding("utf-8")

video_dir = 'static/video/'

app = Flask(__name__)


@app.route('/')
@app.route('/home')
def index():
video_files = [f for f in os.listdir(video_dir)]
video_files_number = len(video_files)
return render_template("index.html", title='Home', video_files_number=video_files_number, video_files=video_files)


@app.route('/<filename>')
def video(filename):
return render_template('play.html', title=filename, video_file=filename)


@app.route('/test')
def test():
return render_template('test.html')


if __name__ == '__main__':
app.run(host='0.0.0.0', debug=True)
app.run(host='localhost', debug=True)
51 changes: 38 additions & 13 deletions static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,28 @@ html {
}

body {
background: rgb(67,83,134); /* Old browsers */
background: -moz-radial-gradient(center, ellipse cover, rgba(67,83,134,1) 0%, rgba(41,51,86,1) 100%); /* FF3.6-15 */
background: -webkit-radial-gradient(center, ellipse cover, rgba(67,83,134,1) 0%,rgba(41,51,86,1) 100%); /* Chrome10-25,Safari5.1-6 */
background: radial-gradient(ellipse at center, rgba(67,83,134,1) 0%,rgba(41,51,86,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
background: rgb(67, 83, 134); /* Old browsers */
background: -moz-radial-gradient(
center,
ellipse cover,
rgba(67, 83, 134, 1) 0%,
rgba(41, 51, 86, 1) 100%
); /* FF3.6-15 */
background: -webkit-radial-gradient(
center,
ellipse cover,
rgba(67, 83, 134, 1) 0%,
rgba(41, 51, 86, 1) 100%
); /* Chrome10-25,Safari5.1-6 */
background: radial-gradient(
ellipse at center,
rgba(67, 83, 134, 1) 0%,
rgba(41, 51, 86, 1) 100%
); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#435386', endColorstr='#293356',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */

color: #9fb1ed;
font-family: 'PT Sans', sans-serif;
font-family: "PT Sans", sans-serif;
height: 100%;
margin: 2em;
}
Expand All @@ -37,16 +51,27 @@ video {
display: block;
margin: 0 auto;
width: 90%;
max-width: 800px
}
.animated {
animation-duration: 1s !important;
max-width: 800px;
}
.nightmode {
background: rgb(67,83,134); /* Old browsers */
background: rgb(67, 83, 134); /* Old browsers */
background: radial-gradient(ellipse at center, #000000 0%, #212945 100%);
background: -moz-radial-gradient(center, ellipse cover, #000000 0%, #212945 100%); /* FF3.6-15 */
background: -webkit-radial-gradient(center, ellipse cover, #000000 0%, #212945 100%); /* Chrome10-25,Safari5.1-6 */
background: radial-gradient(ellipse at center, #000000 0%, #212945 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
background: -moz-radial-gradient(
center,
ellipse cover,
#000000 0%,
#212945 100%
); /* FF3.6-15 */
background: -webkit-radial-gradient(
center,
ellipse cover,
#000000 0%,
#212945 100%
); /* Chrome10-25,Safari5.1-6 */
background: radial-gradient(
ellipse at center,
#000000 0%,
#212945 100%
); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#000000', endColorstr='#212945',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
}
163 changes: 126 additions & 37 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -1,48 +1,137 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta charset="utf-8" />
<title>Media Player - {{ title }}</title>
<link rel="apple-touch-icon" sizes="57x57" href="static/img/favicon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="static/img/favicon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="static/img/favicon/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="static/img/favicon/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="static/img/favicon/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="static/img/favicon/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="static/img/favicon/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="static/img/favicon/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="static/img/favicon/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="static/img/favicon/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="static/img/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="static/img/favicon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="static/img/favicon/favicon-16x16.png">
<link rel="manifest" href="static/img/favicon/manifest.json">
<link rel="shortcut icon" href="static/img/favicon/favicon.ico" type="image/x-icon" />
<link
rel="apple-touch-icon"
sizes="57x57"
href="static/img/favicon/apple-icon-57x57.png"
/>
<link
rel="apple-touch-icon"
sizes="60x60"
href="static/img/favicon/apple-icon-60x60.png"
/>
<link
rel="apple-touch-icon"
sizes="72x72"
href="static/img/favicon/apple-icon-72x72.png"
/>
<link
rel="apple-touch-icon"
sizes="76x76"
href="static/img/favicon/apple-icon-76x76.png"
/>
<link
rel="apple-touch-icon"
sizes="114x114"
href="static/img/favicon/apple-icon-114x114.png"
/>
<link
rel="apple-touch-icon"
sizes="120x120"
href="static/img/favicon/apple-icon-120x120.png"
/>
<link
rel="apple-touch-icon"
sizes="144x144"
href="static/img/favicon/apple-icon-144x144.png"
/>
<link
rel="apple-touch-icon"
sizes="152x152"
href="static/img/favicon/apple-icon-152x152.png"
/>
<link
rel="apple-touch-icon"
sizes="180x180"
href="static/img/favicon/apple-icon-180x180.png"
/>
<link
rel="icon"
type="image/png"
sizes="192x192"
href="static/img/favicon/android-icon-192x192.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="static/img/favicon/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="96x96"
href="static/img/favicon/favicon-96x96.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="static/img/favicon/favicon-16x16.png"
/>
<link rel="manifest" href="static/img/favicon/manifest.json" />
<link
rel="shortcut icon"
href="static/img/favicon/favicon.ico"
type="image/x-icon"
/>

<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="static/img/favicon/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<link type="text/css" rel="stylesheet" href="static/css/animate.css">
<link type="text/css" rel="stylesheet" href="static/css/style.css">
<link href="https://fonts.googleapis.com/css?family=Kreon|PT+Sans:400,700" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<meta name="msapplication-TileColor" content="#ffffff" />
<meta
name="msapplication-TileImage"
content="static/img/favicon/ms-icon-144x144.png"
/>
<meta name="theme-color" content="#ffffff" />
<link type="text/css" rel="stylesheet" href="static/css/animate.css" />
<link type="text/css" rel="stylesheet" href="static/css/style.css" />
<link
href="https://fonts.googleapis.com/css?family=Kreon|PT+Sans:400,700"
rel="stylesheet"
/>
<link
href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
rel="stylesheet"
/>
<link
rel="stylesheet"
type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-social/5.1.1/bootstrap-social.min.css"
/>
<link
rel="stylesheet"
type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css"
/>
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"
></script>
</head>

<body class="fadeIn animated">
<body>
{% block play%}{% endblock %}
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"
></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"
integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
crossorigin="anonymous"
></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/wow/1.1.2/wow.min.js"></script>
<script>
new WOW().init();
$(document).ready(function () {
$(".nightmode_button").click(function () {
$("body").toggleClass("nightmode");
});
});
</script>
</body>

<script>
$( document ).ready(function() {
$( ".nightmode_button" ).click(function() {
$("body").toggleClass( "nightmode" );
});
});
</script>

</html>
12 changes: 6 additions & 6 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends 'base.html' %}
{% block play %}
{% for i in range(video_files_number) %}
<p><a href="/{{ video_files[i] }}"> {{ i+1 }}) {{ video_files[i] }} </a></p>
{% endfor %}
{% endblock %}
{% extends 'base.html' %} {% block play %} {% for i in range(video_files_number)
%}
<p class="wow fadeInLeft" data-wow-delay="0.2s">
<a href="/{{ video_files[i] }}"> {{ i+1 }}) {{ video_files[i] }} </a>
</p>
{% endfor %} {% endblock %}
30 changes: 21 additions & 9 deletions templates/play.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
{% extends 'base.html' %}
{% block play %}
{% extends 'base.html' %} {% block play %}

<h3> {{ title }} </h3>
<h3 class="wow fadeInDown" data-wow-delay="0.2s">{{ title }}</h3>
<div class="wow fadeIn" data-wow-delay="0.7s">
<video controls>
<source src="../static/video/{{ video_file }}" type="video/mp4">
<source src="../static/video/{{ video_file }}" type="video/mkv">
<source src="../static/video/{{ video_file }}" type="video/mov">
<track label="English" kind="subtitles" srclang="en" src="../static/video/subt.vtt" default>
<source src="../static/video/{{ video_file }}" type="video/mp4" />
<source src="../static/video/{{ video_file }}" type="video/mkv" />
<source src="../static/video/{{ video_file }}" type="video/mov" />
<track
label="English"
kind="subtitles"
srclang="en"
src="../static/video/subt.vtt"
default
/>
Your browser does not support this video format.
</video>
<p><a href="/">Home</a></p>
<div class="nightmode_button"><i class="fa fa-moon-o" aria-hidden="true"></i> Night Mode</div>
</div>

<p class="wow fadeIn" data-wow-delay="0.7s">
<a href="/" class="wow fadeIn" data-wow-delay="0.7s">Home</a>
</p>
<div class="nightmode_button wow fadeIn" data-wow-delay="0.7s">
<i class="fa fa-moon-o" aria-hidden="true"></i> Night Mode
</div>
{% endblock %}
10 changes: 6 additions & 4 deletions templates/test.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<html>
<video width="320" height="240" controls>
<source src="../static/.ht.mp4" type="video/mp4">
Your browser does not support this video format.
</video>
<div class="wow fadeIn" data-wow-delay="0.4s">
<video width="320" height="240" controls>
<source src="../static/.ht.mp4" type="video/mp4" />
Your browser does not support this video format.
</video>
</div>
</html>