def gdoc(key): """ Get a Google doc and parse for use in template. """ context = make_context() file_path = 'data/%s.html' % key get_document(key, file_path) context.update(make_gdoc_context(key)) os.remove(file_path) return render_template('cards/gdoc.html', **context)
def title(): context = make_context() context.update(make_gdoc_context('title')) context['slug'] = 'title' context['template'] = 'title' context['route'] = '/title/' context['refresh_rate'] = app_config.LOAD_DOCS_INTERVAL return render_template('cards/title.html', **context)
def what_happened(): context = make_context() context.update(make_gdoc_context('what_happened')) context['slug'] = 'what-happened' context['template'] = 'link-roundup' context['route'] = '/what-happened/' context['refresh_rate'] = app_config.LOAD_DOCS_INTERVAL return render_template('cards/link-roundup.html', **context)
def get_caught_up(): context = make_context() context.update(make_gdoc_context('get_caught_up')) context['slug'] = 'get-caught-up' context['template'] = 'link-roundup' context['route'] = '/get-caught-up/' context['refresh_rate'] = app_config.LOAD_DOCS_INTERVAL return render_template('cards/link-roundup.html', **context)
def podcast(): """ Render the podcast card """ context = make_context() context.update(make_gdoc_context('podcast')) context['slug'] = 'podcast' context['template'] = 'podcast' return render_template('cards/podcast.html', **context)
def live_audio(): context = make_context() live_audio_state = context['COPY']['meta']['live_audio']['value'] context.update(make_gdoc_context('live_audio')) pointer = m3u8.load(app_config.LIVESTREAM_POINTER_FILE) context['live_audio_url'] = pointer.segments[0].uri if live_audio_state == 'live': context['live'] = True else: context['live'] = False context['slug'] = 'live-audio' context['template'] = 'live-audio' context['route'] = '/live-audio/' context['refresh_rate'] = app_config.LOAD_DOCS_INTERVAL return render_template('cards/live-audio.html', **context)