fix music catalog

This commit is contained in:
gdlbo
2024-06-21 20:59:46 +03:00
parent c6cff1a585
commit 27b07719d9
@@ -220,10 +220,14 @@ public class CatalogJsonInjector {
}
}
private static void removeUnsupportedLayouts(JSONArray blocks) throws JSONException {
private static void removeUnsupportedLayouts(JSONArray blocks) {
for (int i = blocks.length() - 1; i >= 0; i--) {
JSONObject block = blocks.optJSONObject(i);
if (block == null) continue;
JSONObject layout = block.optJSONObject("layout");
if (layout == null) continue;
String data_type = block.optString("data_type");
if (Objects.equals(data_type, "music_recommended_playlists") || Objects.equals(data_type, "radiostations")) {
@@ -233,8 +237,6 @@ public class CatalogJsonInjector {
continue; // Skip to the next iteration after removing
}
if (layout == null) continue; // Skip to the next iteration if layout is null
String name = layout.optString("name");
if (!name.equals("header_extended")) {
continue; // Skip to the next iteration if not header_extended
@@ -243,11 +245,14 @@ public class CatalogJsonInjector {
if (layout.has("top_title")) {
blocks.remove(i);
}
layout.put("name", "header");
try {
layout.put("name", "header");
} catch (JSONException e) {
e.fillInStackTrace();
}
}
}
private static void setDefaultAudioPage(JSONArray jsonArray, JSONObject catalog) throws JSONException {
for (int i = 0; i < jsonArray.length(); i++) {
var item = jsonArray.optJSONObject(i);