[Android] [PATCH] Get cover art also for upnp network media
Marc K.
morckx at gmail.com
Mon Nov 7 13:29:52 CET 2016
On Mon, 2016-11-07 at 10:05 +0000, Geoffrey Métais wrote:
> Actually you're pointing at a potential bug.
>
> 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.
Network download only if you're quick enough to click an audio file
before its icon is downloaded (asynchronously) to the icon map :). If
you are, the fetching of the icon will just fail with some log output.
>
> We shouldn't use AudioUtil.getCover(), but
> AudioUtil.getCoverFromMemCache() for this.
>
> On Mon, Nov 7, 2016 at 12:47 AM Marc K <morckx at gmail.com> wrote:
> > Previously, cover art of upnp media was only shown in the browser,
> > but
> > not in the player.
> >
> > Signed-off-by: Marc K <morckx at gmail.com>
> > ---
> > .../src/org/videolan/vlc/gui/helpers/AudioUtil.java | 19
> > +++++++++++++++++--
> > 1 file changed, 17 insertions(+), 2 deletions(-)
> >
> > diff --git a/vlc-
> > android/src/org/videolan/vlc/gui/helpers/AudioUtil.java b/vlc-
> > android/src/org/videolan/vlc/gui/helpers/AudioUtil.java
> > index 846f996..efdd684 100644
> > --- a/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java
> > +++ b/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java
> > @@ -42,6 +42,7 @@ import org.videolan.vlc.R;
> > import org.videolan.vlc.VLCApplication;
> > import org.videolan.vlc.media.MediaUtils;
> > import org.videolan.vlc.util.AndroidDevices;
> > +import org.videolan.vlc.util.HttpImageLoader;
> > import org.videolan.vlc.util.MurmurHash;
> > import org.videolan.vlc.util.Permissions;
> > import org.videolan.vlc.util.Util;
> > @@ -227,6 +228,22 @@ public class AudioUtil {
> > }
> >
> > return artworkURL;
> > + } else if (artworkURL != null && artworkURL.startsWith("ht
> > tp://")) {
> > + try {
> > + /* Hack: The album art cannot actually be loaded
> > synchronously via http.
> > + * HttpImageLoader.downloadBitmap, however, will
> > load it from the icons map
> > + * if it was previously shown as thumbnail.
> > + */
> > + Bitmap albumArt =
> > HttpImageLoader.downloadBitmap(artworkURL);
> > + if (albumArt != null) {
> > + File outputFile = File.createTempFile("cover-
> > ", ".jpg", context.getCacheDir());
> > + FileOutputStream fos = new
> > FileOutputStream(outputFile);
> > + if (albumArt.compress(CompressFormat.JPEG, 90,
> > fos))
> > + return(outputFile.getPath());
> > + }
> > + } catch (IOException e) {
> > + e.printStackTrace();
> > + }
> > }
> > return null;
> > }
> > @@ -322,8 +339,6 @@ public class AudioUtil {
> > if (cacheFile.exists()) {
> > if (cacheFile.length() > 0)
> > coverPath = cachePath;
> > - else
> > - return null;
> > }
> > }
> >
> > --
> > 2.9.3
> >
> > _______________________________________________
> > Android mailing list
> > Android at videolan.org
> > https://mailman.videolan.org/listinfo/android
> >
>
> _______________________________________________
> Android mailing list
> Android at videolan.org
> https://mailman.videolan.org/listinfo/android
More information about the Android
mailing list