From 51a34a81e461285d14a5b4cf68f414e6fa8bb99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Thu, 30 Aug 2018 11:21:42 +0200 Subject: [PATCH] Add cover image metadata to Twitch cache API --- twitch-cache-api/app.py | 2 ++ twitch-cache-api/db.py | 2 ++ twitch-cache-api/sync.py | 2 ++ 3 files changed, 6 insertions(+) diff --git a/twitch-cache-api/app.py b/twitch-cache-api/app.py index a24a540..f14824b 100644 --- a/twitch-cache-api/app.py +++ b/twitch-cache-api/app.py @@ -131,6 +131,8 @@ event_fields = { 'end': flask_restful.fields.DateTime(dt_format='iso8601'), 'title': flask_restful.fields.String(), 'description': flask_restful.fields.String(), + 'cover_image_id': flask_restful.fields.String(), + 'cover_image_url': flask_restful.fields.String(), 'game_id': flask_restful.fields.Integer(), 'game_name': flask_restful.fields.String(), 'game_box_small': flask_restful.fields.String(), diff --git a/twitch-cache-api/db.py b/twitch-cache-api/db.py index 5cfa69a..0a71a29 100644 --- a/twitch-cache-api/db.py +++ b/twitch-cache-api/db.py @@ -82,6 +82,8 @@ class Event(db.Model): end = db.Column(db.DateTime) title = db.Column(db.String) description = db.Column(db.String) + cover_image_id = db.Column(db.String) + cover_image_url = db.Column(db.String) game_id = db.Column(db.Integer) game_name = db.Column(db.String) game_box_small = db.Column(db.String) diff --git a/twitch-cache-api/sync.py b/twitch-cache-api/sync.py index 3507249..7f0ebd0 100644 --- a/twitch-cache-api/sync.py +++ b/twitch-cache-api/sync.py @@ -173,6 +173,8 @@ class Sync(object): event.end = cls._to_datetime(cls._get(evt, 'end_time')) event.title = cls._get(evt, 'title') event.description = cls._get(evt, 'description') + event.cover_image_id = cls._get(evt, 'cover_image_id') + event.cover_image_url = cls._get(evt, 'cover_image_url') event.game_id = cls._get(evt, 'game', '_id') event.game_name = cls._get(evt, 'game', 'name') event.game_box_small = cls._get(evt, 'game', 'box', 'small')