From 6525ccf7a7762161ebc0629db2611f6ac8c8f0cc Mon Sep 17 00:00:00 2001 From: girst Date: Sun, 19 Mar 2023 20:18:09 +0000 Subject: [PATCH] browse/channels: prepare for livestreams, shorts --- app/browse/__init__.py | 3 ++- app/browse/protobuf.py | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/browse/__init__.py b/app/browse/__init__.py index df39a04..fc35a76 100644 --- a/app/browse/__init__.py +++ b/app/browse/__init__.py @@ -49,7 +49,8 @@ def search(): @frontend.route('/channel//') def channel(channel_id, subpage="videos"): token = getattr(current_user, 'token', 'guest') - if subpage == "videos": + if subpage in ("videos", "streams", "shorts"): # "streams"==livestreams + # XXX: streams, shorts not working yet sort_by = request.args.get('sort') or "newest" query = None elif subpage == "playlists": diff --git a/app/browse/protobuf.py b/app/browse/protobuf.py index ce24f2c..fb57fef 100644 --- a/app/browse/protobuf.py +++ b/app/browse/protobuf.py @@ -96,7 +96,9 @@ class NewChannelDataSort: @message @dataclass class NewChannelDataInner: - data: NewChannelDataSort = field(15) + videos: NewChannelDataSort = field(15) # videos + # TODO: streams sends a field(14) with nearly? the same NewChannelDataSort struct, but then page>=2 doesn't work (sorting works) + # TODO: shorts sends a field(10) but with a different sub-struct (nothing works) @message @dataclass class NewChannelDataContainer: @@ -142,6 +144,8 @@ def make_channel_params(subject, typ="videos", page=1, sort=None, query=None, v3 sortorder = dict(newest=3, modified=4) elif typ == "search": sortorder = dict() + elif typ in ("streams", "shorts"): # XXX: not implemented + return None elif typ == "videos": # XXX: should be better integrated return b64e(Continuation( params=Params( @@ -149,7 +153,7 @@ def make_channel_params(subject, typ="videos", page=1, sort=None, query=None, v3 params=b64e(NewChannelDataContainerOuter( data=NewChannelDataContainer( data=NewChannelDataInner( - data=NewChannelDataSort( + videos=NewChannelDataSort( user=NewChannelDataUser( data=b64e(NewChannelUserInfo( offset= page*30, -- 2.39.3