linuxgaming

This is my own Linux gaming aggregate web app I built for personal use.
git clone git://git.beardyjay.co.uk/linuxgaming
Log | Files | Refs | README

commit 50adff9e315c07da7be76ffb14fca22dbd6ddc9e
parent f5e84a1b80c99dcce4549ce91e4a7cd7567237a1
Author: Jay Scott <jay@beardyjay.co.uk>
Date:   Wed, 18 Jul 2018 10:53:33 +0100

PEP8 fixes

Diffstat:
MTODO.md | 3++-
Mlinuxgaming/__init__.py | 11+++++------
Mlinuxgaming/search.py | 60++++++++++++++++++++++++++++++++++++++++++++----------------
Mlinuxgaming/static/js/script.js | 3+--
Mlinuxgaming/templates/base.html | 2+-
Mlinuxgaming/update.py | 6+++---
6 files changed, 56 insertions(+), 29 deletions(-)

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 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 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") 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 +}); 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> 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,