Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/main/java/net/pcsx2/hifumi/GameIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;

import net.pcsx2.hifumi.util.EmbedUtil;
Expand Down Expand Up @@ -165,23 +166,27 @@ public class GameIndex implements Refreshable {
private Map<String, Object> map;

public GameIndex() {

}

@Override
public void refresh() {
Request req = new Request.Builder().url(GAMEINDEX_LOCATION).get().build();

try {
Response res = HifumiBot.getSelf().getHttpClient().newCall(req).execute();

if (res.isSuccessful()) {
Yaml yaml = new Yaml();
LoaderOptions lo = new LoaderOptions();
// Arbitrary amount, the gamedb should probably not exceed this.
lo.setMaxAliasesForCollections(500);

Yaml yaml = new Yaml(lo);
map = yaml.load(res.body().charStream());
}

this.isInitialized = true;
} catch (IOException e) {
} catch (Exception e) {
Messaging.logException("GameIndex", "refresh", e);
}
}
Expand Down