[Android] [PATCH] Get cover art also for upnp network media

Jean-Baptiste Kempf jb at videolan.org
Sun Nov 6 18:44:18 CET 2016


I'm also not sure the download shouldn't be done with a HTTP getter
instead of VLC code....

Not to mention there are other extensions than jpg for art.


On Sun, 6 Nov 2016, at 18:22, Filip Roséen wrote:
> Hi Marc,
> On 2016-11-05 01:43, Marc K 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       | 15 +++++++++++++--
>>  1 file changed, 13 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..692f073 100644 --- a/vlc-
>>  android/src/org/videolan/vlc/gui/helpers/AudioUtil.java +++ b/vlc-
>>  android/src/org/videolan/vlc/gui/helpers/AudioUtil.java @@ -42,11
>>  +42,13 @@ 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;  import java.io.BufferedOutputStream;
>>  +import java.io.InputStream; import java.io.File; import
>>  java.io.FileOutputStream; import java.io.FilenameFilter; @@ -227,6
>>  +229,17 @@ public class AudioUtil { }  return artworkURL; +        }
>>  else if (artworkURL != null && artworkURL.startsWith("http://")) { +
>>  try { +                File outputFile = outputFile =
>>  File.createTempFile("vlc", ".jpg", context.getCacheDir()); +
>>  FileOutputStream fos = new FileOutputStream(outputFile); +
>>  if (HttpImageLoader.downloadBitmap(artworkURL).compress(CompressFor-
>>  mat.JPEG, 90, fos)) {
> Given that HttpImageLoader.downloadBitmap can return null to signal an
> error, the above suffers from a potential *null-pointer-exception*.
> I think it is more appropriate to handle such case gracefully, than to
> rely on something higher in the stack to catch the exception
> (potentially on the expense of alternative handlers not having the
> opportunity to kick in).


>>  +                    fos.close(); +                    return(outpu-
>>                       tFile.getPath()); +                } +
>>                       } catch (IOException e) { +
>>                       Log.d("ImageManager", "Error: " + e); +
>>                       } } return null; } @@ -322,8 +335,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

--
Jean-Baptiste Kempf -  President
+33 672 704 734
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/android/attachments/20161106/f524334f/attachment.html>


More information about the Android mailing list