Add endpoint /all_channels.json to facilitate future autocomplete.

master
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
1 changed files with 6 additions and 0 deletions

View File

@ -9,6 +9,12 @@ from .. import jsonify
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')
def get_channels():
channels = common.ycdldb.get_channels()