Add endpoint /all_channels.json to facilitate future autocomplete.

This commit is contained in:
voussoir 2021-06-04 21:41:30 -07:00
parent 8b4edad9f2
commit d76d592501
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -9,6 +9,12 @@ from .. import jsonify
site = common.site site = common.site
@site.route('/all_channels.json')
def get_all_channel_names():
all_channels = {channel.id: channel.name for channel in common.ycdldb.get_channels()}
response = {'channels': all_channels}
return jsonify.make_json_response(response)
@site.route('/channels') @site.route('/channels')
def get_channels(): def get_channels():
channels = common.ycdldb.get_channels() channels = common.ycdldb.get_channels()