From ecf75e1bdb280e07d75ba5f461ba278617828d85 Mon Sep 17 00:00:00 2001 From: capt titanium Date: Wed, 7 Oct 2020 15:56:43 +0530 Subject: [PATCH 1/2] improved some animations --- media_server.py | 10 ++- static/css/style.css | 51 ++++++++++---- templates/base.html | 163 +++++++++++++++++++++++++++++++++---------- templates/index.html | 12 ++-- templates/play.html | 30 +++++--- templates/test.html | 10 +-- 6 files changed, 206 insertions(+), 70 deletions(-) diff --git a/media_server.py b/media_server.py index 39ec541..8ae8ac7 100644 --- a/media_server.py +++ b/media_server.py @@ -1,4 +1,5 @@ -import os, sys +import os +import sys from flask import Flask, request, render_template reload(sys) @@ -7,17 +8,24 @@ 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('/') 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) diff --git a/static/css/style.css b/static/css/style.css index 1ab74fe..ff92f23 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -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; } @@ -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 */ } diff --git a/templates/base.html b/templates/base.html index b663e77..357da26 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,48 +1,137 @@ - - + Media Player - {{ title }} - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + src="https://code.jquery.com/jquery-3.2.1.min.js" + integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" + crossorigin="anonymous" + > - + {% block play%}{% endblock %} + + + + - - - diff --git a/templates/index.html b/templates/index.html index 44b85fe..9e54d06 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,6 +1,6 @@ -{% extends 'base.html' %} -{% block play %} -{% for i in range(video_files_number) %} -

{{ i+1 }}) {{ video_files[i] }}

-{% endfor %} -{% endblock %} +{% extends 'base.html' %} {% block play %} {% for i in range(video_files_number) +%} +

+ {{ i+1 }}) {{ video_files[i] }} +

+{% endfor %} {% endblock %} diff --git a/templates/play.html b/templates/play.html index fc6aafa..f13672f 100644 --- a/templates/play.html +++ b/templates/play.html @@ -1,14 +1,26 @@ -{% extends 'base.html' %} -{% block play %} +{% extends 'base.html' %} {% block play %} -

{{ title }}

+

{{ title }}

+
-

Home

-
Night Mode
+
+ +

+ Home +

+
+ Night Mode +
{% endblock %} diff --git a/templates/test.html b/templates/test.html index b9a68a3..1bad910 100644 --- a/templates/test.html +++ b/templates/test.html @@ -1,6 +1,8 @@ - +
+ +
From 91fe765973d06c880abf4be72be140b04de9e532 Mon Sep 17 00:00:00 2001 From: capt titanium Date: Wed, 7 Oct 2020 16:04:16 +0530 Subject: [PATCH 2/2] improved some animations --- media_server.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/media_server.py b/media_server.py index 8ae8ac7..26f3bb5 100644 --- a/media_server.py +++ b/media_server.py @@ -1,9 +1,13 @@ 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__) @@ -28,4 +32,4 @@ def test(): if __name__ == '__main__': - app.run(host='0.0.0.0', debug=True) + app.run(host='localhost', debug=True)