diff --git a/bemani/backend/jubeat/clan.py b/bemani/backend/jubeat/clan.py index 11319bd..57a2825 100644 --- a/bemani/backend/jubeat/clan.py +++ b/bemani/backend/jubeat/clan.py @@ -999,6 +999,8 @@ class JubeatClan( music_list = Node.void('music_list') player.add_child(music_list) + # TODO: Might be a way to figure out who plays what song and then offer + # recommendations based on that. There should be 12 songs returned here. recommended_songs: List[Song] = [] for i, song in enumerate(recommended_songs): music = Node.void('music') diff --git a/bemani/backend/jubeat/festo.py b/bemani/backend/jubeat/festo.py index 03ad2e2..686d3a0 100644 --- a/bemani/backend/jubeat/festo.py +++ b/bemani/backend/jubeat/festo.py @@ -14,7 +14,7 @@ from bemani.backend.jubeat.clan import JubeatClan from bemani.backend.base import Status from bemani.common import Profile, ValidatedDict, VersionConstants -from bemani.data import UserID, Score +from bemani.data import UserID, Score, Song from bemani.protocol import Node @@ -410,6 +410,28 @@ class JubeatFesto( return shopinfo + def handle_recommend_get_recommend_request(self, request: Node) -> Node: + recommend = Node.void('recommend') + data = Node.void('data') + recommend.add_child(data) + + player = Node.void('player') + data.add_child(player) + music_list = Node.void('music_list') + player.add_child(music_list) + + # TODO: Might be a way to figure out who plays what song and then offer + # recommendations based on that. There should be 12 songs returned here. + recommended_songs: List[Song] = [] + for i, song in enumerate(recommended_songs): + music = Node.void('music') + music_list.add_child(music) + music.set_attribute('order', str(i)) + music.add_child(Node.s32('music_id', song.id)) + music.add_child(Node.s8('seq', song.chart)) + + return recommend + def handle_gametop_regist_request(self, request: Node) -> Node: data = request.child('data') player = data.child('player') diff --git a/bemani/backend/jubeat/qubell.py b/bemani/backend/jubeat/qubell.py index 46f832b..02217b8 100644 --- a/bemani/backend/jubeat/qubell.py +++ b/bemani/backend/jubeat/qubell.py @@ -16,7 +16,7 @@ from bemani.backend.jubeat.common import ( from bemani.backend.jubeat.prop import JubeatProp from bemani.common import Profile, ValidatedDict, VersionConstants -from bemani.data import Data, Score, UserID +from bemani.data import Data, Score, Song, UserID from bemani.protocol import Node @@ -398,15 +398,18 @@ class JubeatQubell( player = Node.void('player') data.add_child(player) - player.add_child(Node.void('music_list')) - # Music list should contain nodes like this (12 of them - # in total for a recommended list). If it isn't provided, - # the game will substitute a default. The order valid range - # is 0-11 inclusive (12 total). - # - # id - # chart - # + music_list = Node.void('music_list') + player.add_child(music_list) + + # TODO: Might be a way to figure out who plays what song and then offer + # recommendations based on that. There should be 12 songs returned here. + recommended_songs: List[Song] = [] + for i, song in enumerate(recommended_songs): + music = Node.void('music') + music_list.add_child(music) + music.set_attribute('order', str(i)) + music.add_child(Node.s32('music_id', song.id)) + music.add_child(Node.s8('seq', song.chart)) return recommend