- public BufferedImage getCover(String luid) {
- // Retrieve it from the network if needed:
- if (lib.getInfo(luid) == null) {
- getFile(luid);
+ public BufferedImage getCover(final String luid) {
+ // Retrieve it from the cache if possible:
+ if (lib.getInfo(luid) != null) {
+ return lib.getCover(luid);
+ }
+
+ final BufferedImage[] result = new BufferedImage[1];
+ try {
+ new ConnectActionClient(host, port, true) {
+ @Override
+ public void action(Version serverVersion) throws Exception {
+ try {
+ Object rep = send("GET_COVER " + luid);
+ result[0] = (BufferedImage) rep;
+ } catch (Exception e) {
+ Instance.syserr(e);
+ }
+ }
+ }.connect();
+ } catch (IOException e) {
+ Instance.syserr(e);