Initial Commit

This commit is contained in:
Benjamyn Love 2018-05-26 15:56:29 +10:00
commit bc325da621
9 changed files with 138 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.tcreds
venv/

32
main.py Normal file
View File

@ -0,0 +1,32 @@
from flask import Flask, render_template, request
from twitch import TwitchClient
from pprint import pprint
import json
app = Flask(__name__)
app.config['DEBUG'] = True
try:
cred_file = open('.tcreds')
except Exception as e:
print(e)
details = json.load(cred_file)
#Setup Authed Twitch Client
tclient = TwitchClient(client_id=details["client_id"], oauth_token=details["oauth"])
def get_followed():
return tclient.streams.get_followed()
#Debug
#for stream in streams_live:
# print("%s: \t\t\t%s Logo is: %s" %(stream["channel"]["display_name"], stream["channel"]["game"],stream["channel"]["logo"]))
@app.route('/')
def index():
livestreamdata = get_followed()
return render_template('index.html', livestreamdata=livestreamdata)
if __name__ == '__main__':
app.run(host='0.0.0.0')

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
flask
python-twitch-client

7
static/css/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

46
static/css/test.css Normal file
View File

@ -0,0 +1,46 @@
.records {
font-size: 12px;
padding: 30px;
color: #363636;
}
.myNav {
background-color: #A4A4A4;
color: #363636;
}
.column {
width: 90%;
background-color: #B1B1B1;
padding: 2%;
float: left;
}
.row:after {
content: "";
display: table;
clear: both;
}
.buffer {
width: 2%;
background-color: #363636;
clear: both;
}
.allmostbiggertext {
font-size: 12px;
font-weight: 700;
padding-top: 10px;
}
.body {
background-color: #363636;
justify-content: center;
}
.col-centered{
float: none;
margin: 0 auto;
}

7
static/js/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

2
static/js/jquery-3.3.1.slim.min.js vendored Normal file

File diff suppressed because one or more lines are too long

5
static/js/popper.min.js vendored Normal file

File diff suppressed because one or more lines are too long

35
templates/index.html Normal file
View File

@ -0,0 +1,35 @@
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="/static/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="/static/css/test.css">
<title>DNSPy2: Electric Boogaloo</title>
</head>
<body class='body'>
<div class="navbar myNav ">
<div class="container d-flex justify-content-center" style="width: 100%">
<h3>WhoIWatch</h3>
</div>
</div>
<div class="records container h-100 d-flex justify-content-center" style="max-width: 100%">
<div class="column rounded ">
<b>Live Currently :D</b>
{% for x in livestreamdata %}
<li><a href="{{ x["channel"]["url"] }}" > {{ x["channel"]["display_name"] }} - {{ x["channel"]["game"] }} <img src="{{ x["channel"]["logo"]}}" height="16" width="16" > </li>
{% endfor %}
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="/static/js/jquery-3.3.1.slim.min.js" crossorigin="anonymous"></script>
<script src="/static/js/popper.min.js" crossorigin="anonymous"></script>
<script src="/static/js/bootstrap.min.js" crossorigin="anonymous"></script>
</body>
</html>