[Android] AudioUtil: do not save a cover if it's already in cache

Sébastien Toque git at videolan.org
Thu Oct 25 21:13:11 CEST 2012


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Thu Oct 25 21:13:05 2012 +0200| [68659aa7276b6440388448a06e28952347dbc847] | committer: Sébastien Toque

AudioUtil: do not save a cover if it's already in cache
Saving it again and again (in jpg) quicky decreases the cover quality

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=68659aa7276b6440388448a06e28952347dbc847
---

 vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
index 0799637..a9daccd 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
@@ -223,6 +223,8 @@ public class AudioUtil {
         OutputStream out = null;
         try {
             File file = new File(path);
+            if (file.exists() && file.length() > 0)
+                return;
             out = new BufferedOutputStream(new FileOutputStream(file), 4096);
             if (bitmap != null)
                 bitmap.compress(CompressFormat.JPEG, 90, out);



More information about the Android mailing list