MPD readpicture size
Feature request
Hello,
I had a problem with loading and showing album arts from MPD. After clearing cached images and opening album grid view, album arts started appearing, but always to a certain album. After this, all following covers remained black. I like this application, so I decided to investigate the problem.
For an unknown reason, the MPS reported an incorrect image size (4295083446) when calling the "readpicture" command (tested with netcat). I do not use embedded cover images in my library. This MPD command got executed simply because the "albumart" command returned null (missing cover.jpg in the album folder).
This incorrect image size broke any further album art retrieval. I am suspecting that when reported size was larger then ~50MB response was not read/handled correctly.
Following diff solves the problem (when abort is set do not return but instead gracefully end the loop -> dataToRead == 0):
--- a/app/src/main/java/org/gateshipone/malp/mpdservice/mpdprotocol/MPDInterface.java
+++ b/app/src/main/java/org/gateshipone/malp/mpdservice/mpdprotocol/MPDInterface.java
@@ -1172,10 +1172,8 @@ public class MPDInterface {
if (!abort) {
// Copy chunk to final output array
System.arraycopy(readData, 0, imageData, ((int) imageSize - dataToRead), chunkSize);
- } else {
- return null;
+ dataToRead -= chunkSize;
}
- dataToRead -= chunkSize;
}
I hope it helps. Cheers