parseMenuPlaylists function
Parses menu playlists.
Implementation
void parseMenuPlaylists(JsonMap data, JsonMap result) {
final menuItems = nav(data, MENU_ITEMS, nullIfAbsent: true);
if (menuItems == null) return;
final watchMenu = List<JsonMap>.from(
findObjectsByKey(menuItems as List, MNIR),
);
for (final item in watchMenu.map((x) => x[MNIR])) {
final icon = nav(item, ICON_TYPE);
String? watchKey;
if (icon == 'MUSIC_SHUFFLE') {
watchKey = 'shuffleId';
} else if (icon == 'MIX') {
watchKey = 'radioId';
} else {
continue;
}
var watchId = nav(item, [
'navigationEndpoint',
'watchPlaylistEndpoint',
'playlistId',
], nullIfAbsent: true);
watchId ??= nav(item, [
'navigationEndpoint',
'watchEndpoint',
'playlistId',
], nullIfAbsent: true);
if (watchId != null) {
result[watchKey] = watchId;
}
}
}