PEP8 fixes - linuxgaming - Linux gaming aggregate tool, built to test out NodeJS.
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit e6c2cbf8aeee89296942f9e7974dba10a6921f9e
(DIR) parent 0a801a8887cd627d5af1b9f180bd5abf1fd0e82f
(HTM) Author: Jay Scott <me@jay.scot>
Date: Wed, 18 Jul 2018 10:53:33 +0100
PEP8 fixes
Diffstat:
M TODO.md | 3 ++-
M linuxgaming/__init__.py | 11 +++++------
M linuxgaming/search.py | 60 +++++++++++++++++++++++---------
M linuxgaming/static/js/script.js | 3 +--
M linuxgaming/templates/base.html | 2 +-
M linuxgaming/update.py | 6 +++---
6 files changed, 56 insertions(+), 29 deletions(-)
---
(DIR) diff --git a/TODO.md b/TODO.md
@@ -10,6 +10,7 @@
## other
- Add menu with source info / about etc
- - Move updates to AWS Lambda function
+ - Move updates to AWS Lambda function
+ - Add API
- Add Itch.io games
- Add Steam games
\ No newline at end of file
(DIR) diff --git a/linuxgaming/__init__.py b/linuxgaming/__init__.py
@@ -31,13 +31,13 @@ def create_app():
app.register_blueprint(update.bp)
app.register_blueprint(details.bp)
app.register_blueprint(search.bp)
-
@app.route("/")
def home():
today = datetime.now()
- all_data = mongo.db.items.find({"date":{'$gte': today - timedelta(hours=24)}}).sort('date', -1)
+ all_data = mongo.db.items.find(
+ {"date": {'$gte': today - timedelta(hours=24)}}).sort('date', -1)
return render_template('pages/home.html', entries=all_data)
@app.errorhandler(500)
@@ -60,6 +60,6 @@ def create_app():
def _jinja2_filter_datetime(date, fmt=None):
date = dateutil.parser.parse(str(date))
native = date.replace(tzinfo=None)
- format='%a %d %b %X %Y'
- return native.strftime(format)
- return app
-\ No newline at end of file
+ format = '%a %d %b %X %Y'
+ return native.strftime(format)
+ return app
(DIR) diff --git a/linuxgaming/search.py b/linuxgaming/search.py
@@ -1,11 +1,7 @@
from flask import (
Blueprint,
- flash,
- redirect,
render_template,
- url_for,
current_app)
-import yaml
bp = Blueprint('search', __name__, url_prefix='/search')
@@ -13,36 +9,69 @@ bp = Blueprint('search', __name__, url_prefix='/search')
@bp.route("/twitch", methods=('GET', 'POST'))
def twitch():
- all_data = current_app.mongo.db.items.find({"type" : "twitch"}).sort('date', -1)
- return render_template('pages/search.html', entries=all_data, count=all_data.count(), source="twitch")
+ all_data = current_app.mongo.db.items.find(
+ {"type": "twitch"}).sort('date', -1)
+ return render_template(
+ 'pages/search.html',
+ entries=all_data,
+ count=all_data.count(),
+ source="twitch")
+
@bp.route("/youtube", methods=('GET', 'POST'))
def youtube():
- all_data = current_app.mongo.db.items.find({"type" : "youtube"}).sort('date', -1)
- return render_template('pages/search.html', entries=all_data, count=all_data.count(), source="youtube")
+ all_data = current_app.mongo.db.items.find(
+ {"type": "youtube"}).sort('date', -1)
+ return render_template(
+ 'pages/search.html',
+ entries=all_data,
+ count=all_data.count(),
+ source="youtube")
+
@bp.route("/article", methods=('GET', 'POST'))
def article():
- all_data = current_app.mongo.db.items.find({"type" : "article"}).sort('date', -1)
- return render_template('pages/search.html', entries=all_data, count=all_data.count(), source="articles")
+ all_data = current_app.mongo.db.items.find(
+ {"type": "article"}).sort('date', -1)
+ return render_template(
+ 'pages/search.html',
+ entries=all_data,
+ count=all_data.count(),
+ source="articles")
@bp.route("/podcast", methods=('GET', 'POST'))
def podcast():
- all_data = current_app.mongo.db.items.find({"type" : "podcast"}).sort('date', -1)
- return render_template('pages/search.html', entries=all_data, count=all_data.count(), source="podcasts")
+ all_data = current_app.mongo.db.items.find(
+ {"type": "podcast"}).sort('date', -1)
+ return render_template(
+ 'pages/search.html',
+ entries=all_data,
+ count=all_data.count(),
+ source="podcasts")
+
@bp.route("/gog", methods=('GET', 'POST'))
def gog():
- all_data = current_app.mongo.db.items.find({"name" : "gog"}).sort('date', -1)
- return render_template('pages/search.html', entries=all_data, count=all_data.count(), source="gog")
+ all_data = current_app.mongo.db.items.find(
+ {"name": "gog"}).sort('date', -1)
+ return render_template(
+ 'pages/search.html',
+ entries=all_data,
+ count=all_data.count(),
+ source="gog")
+
@bp.route("/allthethings", methods=('GET', 'POST'))
def allthethings():
all_data = current_app.mongo.db.items.find().sort('date', -1)
- return render_template('pages/search.html', entries=all_data, count=all_data.count(), source="of all the things")
-\ No newline at end of file
+ return render_template(
+ 'pages/search.html',
+ entries=all_data,
+ count=all_data.count(),
+ source="of all the things")
(DIR) diff --git a/linuxgaming/static/js/script.js b/linuxgaming/static/js/script.js
@@ -21,4 +21,4 @@ $('.item, .img, .th')
$('.three.cards .image').dimmer({
on: 'hover'
-});
-\ No newline at end of file
+});
(DIR) diff --git a/linuxgaming/templates/base.html b/linuxgaming/templates/base.html
@@ -39,8 +39,8 @@
<a class="item" href="/search/gog" data-content="Filter all GoG Games">
<img class="ui mini bordered image" alt="GoG Logo" src="{{ url_for('static', filename='images/icons/gog.png')}}">
</a>
+
<div class="right item">
-
<a class="item" href="/search/allthethings" data-title="Show EVERYTHING!" data-content="Good luck rendering this...">
<i class="exclamation red large icon" ></i>
</a>
(DIR) diff --git a/linuxgaming/update.py b/linuxgaming/update.py
@@ -29,7 +29,7 @@ def rss_update():
if 'rss' not in feed_config[section]:
continue
- print("Updating - " + section)
+ current_app.logger.info('[RSS] Updating %s', section)
feeds = parse(feed_config[section]['rss']['url'])
for feed in feeds:
@@ -71,7 +71,7 @@ def twitch_update():
if 'twitch' not in feed_config[section]:
continue
- print("Updating " + section)
+ current_app.logger.info('[TWITCH] Updating %s', section)
twitch_channelID = feed_config[section]['twitch']['twitch_id']
client = TwitchClient(
@@ -132,7 +132,7 @@ def youtube_update():
youtube = build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION,
developerKey=DEVELOPER_KEY)
- print("Updating - " + section)
+ current_app.logger.info('[YOUTUBE] Updating %s', section)
search_response = youtube.search().list(
q="",
channelId=youtube_channelID,