cleaned up flask apis adding skeleton code
This commit is contained in:
@@ -10,8 +10,8 @@ def hls(stream_id):
|
||||
#--------------------------------------------------------
|
||||
|
||||
|
||||
@main_bp.route('/get_loggedin_status')
|
||||
def get_loggedin_status():
|
||||
@main_bp.route('/get_login_status')
|
||||
def get_login_status():
|
||||
logged_in = False
|
||||
"""
|
||||
Returns whether the user is logged in or not
|
||||
@@ -26,53 +26,6 @@ def authenticate_user():
|
||||
return {"authenticated": True}
|
||||
|
||||
|
||||
@main_bp.route('/get_streams')
|
||||
def get_sample_streams():
|
||||
"""
|
||||
Returns a list of (sample) streamers live right now
|
||||
"""
|
||||
|
||||
# top 25, if not logged in
|
||||
# if logged in, show streams that match user's tags
|
||||
# user attains tags from the tags of the streamers they follow, and streamers they've watched
|
||||
|
||||
streamers = [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "Gaming Stream",
|
||||
"streamer": "Gamer123",
|
||||
"viewers": 1500,
|
||||
"thumbnail": "dance_game.png",
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Art Stream",
|
||||
"streamer": "Artist456",
|
||||
"viewers": 800,
|
||||
"thumbnail": "surface.jpeg",
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"title": "Music Stream",
|
||||
"streamer": "Musician789",
|
||||
"viewers": 2000,
|
||||
"thumbnail": "monkey.png",
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"title": "Just Chatting",
|
||||
"streamer": "Chatty101",
|
||||
"viewers": 1200,
|
||||
"thumbnail": "elf.webp",
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"title": "Cooking Stream",
|
||||
"streamer": "Chef202",
|
||||
"viewers": 1000,
|
||||
"thumbnail": "art.jpg",
|
||||
}
|
||||
]
|
||||
return streamers
|
||||
|
||||
#TODO Route for saving uploaded thumbnails to database, serving these images to the frontend upon request: →→→ @main_bp.route('/images/<path:filename>') \n def serve_image(filename): ←←←
|
||||
74
web_server/blueprints/streams.py
Normal file
74
web_server/blueprints/streams.py
Normal file
@@ -0,0 +1,74 @@
|
||||
from flask import Blueprint
|
||||
|
||||
stream_bp = Blueprint("stream", __name__)
|
||||
|
||||
@stream_bp.route('/get_streams', methods=['GET'])
|
||||
def get_sample_streams():
|
||||
"""
|
||||
Returns a list of (sample) streamers live right now
|
||||
"""
|
||||
|
||||
# top 25, if not logged in
|
||||
# if logged in, show streams that match user's tags
|
||||
# user attains tags from the tags of the streamers they follow, and streamers they've watched
|
||||
|
||||
streamers = [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "Gaming Stream",
|
||||
"streamer": "Gamer123",
|
||||
"viewers": 1500,
|
||||
"thumbnail": "dance_game.png",
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Art Stream",
|
||||
"streamer": "Artist456",
|
||||
"viewers": 800,
|
||||
"thumbnail": "surface.jpeg",
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"title": "Music Stream",
|
||||
"streamer": "Musician789",
|
||||
"viewers": 2000,
|
||||
"thumbnail": "monkey.png",
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"title": "Just Chatting",
|
||||
"streamer": "Chatty101",
|
||||
"viewers": 1200,
|
||||
"thumbnail": "elf.webp",
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"title": "Cooking Stream",
|
||||
"streamer": "Chef202",
|
||||
"viewers": 1000,
|
||||
"thumbnail": "art.jpg",
|
||||
}
|
||||
]
|
||||
return streamers
|
||||
|
||||
|
||||
@stream_bp.route('/get_recommended_streams', methods=['GET'])
|
||||
def get_recommended_streamers():
|
||||
"""
|
||||
Queries DB to get a list of recommended streamers using an algorithm
|
||||
"""
|
||||
return
|
||||
|
||||
@stream_bp.route('/get_followed_streams', methods=['GET'])
|
||||
def get_followed_streamers():
|
||||
"""
|
||||
Queries DB to get a list of followed streamers
|
||||
"""
|
||||
return
|
||||
|
||||
@stream_bp.route('/save_stream_thumbnail/<int:streamer_id>', methods=['POST'])
|
||||
def stream_thumbnail_snapshot(streamer_id):
|
||||
"""
|
||||
Function to be called periodically which saves the current live stream as an img to be used for the thumbnail to be displayed
|
||||
"""
|
||||
return
|
||||
@@ -18,7 +18,7 @@ def create_checkout_session():
|
||||
'quantity': 1,
|
||||
},
|
||||
],
|
||||
mode='subscription',
|
||||
mode='payment',
|
||||
redirect_on_completion = 'never'
|
||||
)
|
||||
except Exception as e:
|
||||
|
||||
17
web_server/blueprints/user.py
Normal file
17
web_server/blueprints/user.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from flask import Blueprint
|
||||
|
||||
user_bp = Blueprint("stream", __name__)
|
||||
|
||||
@user_bp.route('/is_subscribed/<int:user_id>/<int:streamer_id>', methods=['GET'])
|
||||
def user_subscribed(user_id, streamer_id):
|
||||
"""
|
||||
Checks to see if user is subscribed to a streamer
|
||||
"""
|
||||
return
|
||||
|
||||
@user_bp.route('/is_following/<int:user_id>/<int:streamer_id>', methods=['GET'])
|
||||
def user_following(user_id, streamer_id):
|
||||
"""
|
||||
Checks to see if user is following a streamer
|
||||
"""
|
||||
return
|
||||
Reference in New Issue
Block a user