<div dir="ltr">Actually you're pointing at a potential bug.<div><br></div><div>As list has been persed, images are in cache, except fot http icon.*This patch would cause network download and filesystem I/O within MainThread.</div><div><br></div><div>We shouldn't use AudioUtil.getCover(), but AudioUtil.getCoverFromMemCache() for this.</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Nov 7, 2016 at 12:47 AM Marc K <<a href="mailto:morckx@gmail.com">morckx@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Previously, cover art of upnp media was only shown in the browser, but<br class="gmail_msg">
not in the player.<br class="gmail_msg">
<br class="gmail_msg">
Signed-off-by: Marc K <<a href="mailto:morckx@gmail.com" class="gmail_msg" target="_blank">morckx@gmail.com</a>><br class="gmail_msg">
---<br class="gmail_msg">
.../src/org/videolan/vlc/gui/helpers/AudioUtil.java | 19 +++++++++++++++++--<br class="gmail_msg">
1 file changed, 17 insertions(+), 2 deletions(-)<br class="gmail_msg">
<br class="gmail_msg">
diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java b/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java<br class="gmail_msg">
index 846f996..efdd684 100644<br class="gmail_msg">
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java<br class="gmail_msg">
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java<br class="gmail_msg">
@@ -42,6 +42,7 @@ import org.videolan.vlc.R;<br class="gmail_msg">
import org.videolan.vlc.VLCApplication;<br class="gmail_msg">
import org.videolan.vlc.media.MediaUtils;<br class="gmail_msg">
import org.videolan.vlc.util.AndroidDevices;<br class="gmail_msg">
+import org.videolan.vlc.util.HttpImageLoader;<br class="gmail_msg">
import org.videolan.vlc.util.MurmurHash;<br class="gmail_msg">
import org.videolan.vlc.util.Permissions;<br class="gmail_msg">
import org.videolan.vlc.util.Util;<br class="gmail_msg">
@@ -227,6 +228,22 @@ public class AudioUtil {<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
return artworkURL;<br class="gmail_msg">
+ } else if (artworkURL != null && artworkURL.startsWith("http://")) {<br class="gmail_msg">
+ try {<br class="gmail_msg">
+ /* Hack: The album art cannot actually be loaded synchronously via http.<br class="gmail_msg">
+ * HttpImageLoader.downloadBitmap, however, will load it from the icons map<br class="gmail_msg">
+ * if it was previously shown as thumbnail.<br class="gmail_msg">
+ */<br class="gmail_msg">
+ Bitmap albumArt = HttpImageLoader.downloadBitmap(artworkURL);<br class="gmail_msg">
+ if (albumArt != null) {<br class="gmail_msg">
+ File outputFile = File.createTempFile("cover-", ".jpg", context.getCacheDir());<br class="gmail_msg">
+ FileOutputStream fos = new FileOutputStream(outputFile);<br class="gmail_msg">
+ if (albumArt.compress(CompressFormat.JPEG, 90, fos))<br class="gmail_msg">
+ return(outputFile.getPath());<br class="gmail_msg">
+ }<br class="gmail_msg">
+ } catch (IOException e) {<br class="gmail_msg">
+ e.printStackTrace();<br class="gmail_msg">
+ }<br class="gmail_msg">
}<br class="gmail_msg">
return null;<br class="gmail_msg">
}<br class="gmail_msg">
@@ -322,8 +339,6 @@ public class AudioUtil {<br class="gmail_msg">
if (cacheFile.exists()) {<br class="gmail_msg">
if (cacheFile.length() > 0)<br class="gmail_msg">
coverPath = cachePath;<br class="gmail_msg">
- else<br class="gmail_msg">
- return null;<br class="gmail_msg">
}<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
--<br class="gmail_msg">
2.9.3<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
Android mailing list<br class="gmail_msg">
<a href="mailto:Android@videolan.org" class="gmail_msg" target="_blank">Android@videolan.org</a><br class="gmail_msg">
<a href="https://mailman.videolan.org/listinfo/android" rel="noreferrer" class="gmail_msg" target="_blank">https://mailman.videolan.org/listinfo/android</a><br class="gmail_msg">
</blockquote></div>