    public synchronized static Bitmap getCover(Context context, Media media, int width) {
        String coverPath = null;
        Bitmap cover = null;
        String cachePath = null;
        if (!Util.hasExternalStorage() && width > 0)
            return null;
        try {
            int hash = MurmurHash.hash32(media.getArtist()+media.getAlbum());
            cachePath = COVER_DIR + (hash >= 0 ? "" + hash : "m" + (-hash)) + "_" + width;
            File cacheFile = new File(cachePath);
            if (cacheFile != null && cacheFile.exists()) {
                if (cacheFile.length() > 0)
                    coverPath = cachePath;
            }
            if (coverPath == null)
                coverPath = getCoverFromVlc(context, media);
            if (coverPath == null)
                coverPath = getCoverFromFolder(context, media);
            if (coverPath == null)
                coverPath = getCoverFromMediaStore(context, media);
            cover = readBitmap(coverPath);
            if (cover != null && width > 0)
                cover = Util.scaleDownBitmap(context, cover, width);
            writeBitmap(cover, cachePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return cover;
    }

    public synchronized static Bitmap getCover(Context context, Media media, int width) {
        String coverPath = null;
        Bitmap cover = null;
        String cachePath = null;
        if (!Util.hasExternalStorage() && width > 0)
            return null;
        try {
            int hash = MurmurHash.hash32(media.getArtist()+media.getAlbum());
            cachePath = COVER_DIR + (hash >= 0 ? "" + hash : "m" + (-hash)) + "_" + width;
            File cacheFile = new File(cachePath);
            if (cacheFile != null && cacheFile.exists()) {
                if (cacheFile.length() > 0)
                    coverPath = cachePath;
                else
                    return null;
            }
            if (coverPath == null)
                coverPath = getCoverFromVlc(context, media);
            if (coverPath == null)
                coverPath = getCoverFromFolder(context, media);
            if (coverPath == null)
                coverPath = getCoverFromMediaStore(context, media);
            cover = readBitmap(coverPath);
            if (cover != null && width > 0)
                cover = Util.scaleDownBitmap(context, cover, width);
            writeBitmap(cover, cachePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return cover;
    }
