Add cover image metadata to Twitch cache API

master
Nikola Forró 6 years ago
parent 28ef894cfb
commit 51a34a81e4

@ -131,6 +131,8 @@ event_fields = {
'end': flask_restful.fields.DateTime(dt_format='iso8601'), 'end': flask_restful.fields.DateTime(dt_format='iso8601'),
'title': flask_restful.fields.String(), 'title': flask_restful.fields.String(),
'description': 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_id': flask_restful.fields.Integer(),
'game_name': flask_restful.fields.String(), 'game_name': flask_restful.fields.String(),
'game_box_small': flask_restful.fields.String(), 'game_box_small': flask_restful.fields.String(),

@ -82,6 +82,8 @@ class Event(db.Model):
end = db.Column(db.DateTime) end = db.Column(db.DateTime)
title = db.Column(db.String) title = db.Column(db.String)
description = 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_id = db.Column(db.Integer)
game_name = db.Column(db.String) game_name = db.Column(db.String)
game_box_small = db.Column(db.String) game_box_small = db.Column(db.String)

@ -173,6 +173,8 @@ class Sync(object):
event.end = cls._to_datetime(cls._get(evt, 'end_time')) event.end = cls._to_datetime(cls._get(evt, 'end_time'))
event.title = cls._get(evt, 'title') event.title = cls._get(evt, 'title')
event.description = cls._get(evt, 'description') 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_id = cls._get(evt, 'game', '_id')
event.game_name = cls._get(evt, 'game', 'name') event.game_name = cls._get(evt, 'game', 'name')
event.game_box_small = cls._get(evt, 'game', 'box', 'small') event.game_box_small = cls._get(evt, 'game', 'box', 'small')

Loading…
Cancel
Save