当前位置: 首页>>代码示例>>Java>>正文


Java MediaWrapper.getArtworkURL方法代码示例

本文整理汇总了Java中org.videolan.vlc.MediaWrapper.getArtworkURL方法的典型用法代码示例。如果您正苦于以下问题:Java MediaWrapper.getArtworkURL方法的具体用法?Java MediaWrapper.getArtworkURL怎么用?Java MediaWrapper.getArtworkURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.videolan.vlc.MediaWrapper的用法示例。


在下文中一共展示了MediaWrapper.getArtworkURL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCoverFromVlc

import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
private static String getCoverFromVlc(Context context, MediaWrapper media) throws NoSuchAlgorithmException, UnsupportedEncodingException {
    String artworkURL = media.getArtworkURL();
    if (artworkURL != null && artworkURL.startsWith("file://")) {
        return Uri.decode(artworkURL).replace("file://", "");
    } else if(artworkURL != null && artworkURL.startsWith("attachment://")) {
        // Decode if the album art is embedded in the file
        String mArtist = Util.getMediaArtist(context, media);
        String mAlbum = Util.getMediaAlbum(context, media);

        /* Parse decoded attachment */
        if( mArtist.length() == 0 || mAlbum.length() == 0 ||
            mArtist.equals(VLCApplication.getAppContext().getString(R.string.unknown_artist)) ||
            mAlbum.equals(VLCApplication.getAppContext().getString(R.string.unknown_album)) )
        {
            /* If artist or album are missing, it was cached by title MD5 hash */
            MessageDigest md = MessageDigest.getInstance("MD5");
            byte[] binHash = md.digest((artworkURL + media.getTitle()).getBytes("UTF-8"));
            /* Convert binary hash to normal hash */
            BigInteger hash = new BigInteger(1, binHash);
            String titleHash = hash.toString(16);
            while(titleHash.length() < 32) {
                titleHash = "0" + titleHash;
            }
            /* Use generated hash to find art */
            artworkURL = ART_DIR + "/arturl/" + titleHash + "/art.png";
        } else {
            /* Otherwise, it was cached by artist and album */
            artworkURL = ART_DIR + "/artistalbum/" + mArtist + "/" + mAlbum + "/art.png";
        }

        return artworkURL;
    }
    return null;
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:35,代码来源:AudioUtil.java

示例2: getCoverFromVlc

import org.videolan.vlc.MediaWrapper; //导入方法依赖的package包/类
private static String getCoverFromVlc(Context context, MediaWrapper media) throws NoSuchAlgorithmException, UnsupportedEncodingException {
    String artworkURL = media.getArtworkURL();
    if (artworkURL != null && artworkURL.startsWith("file://")) {
        return Uri.decode(artworkURL).replace("file://", "");
    } else if(artworkURL != null && artworkURL.startsWith("attachment://")) {
        // Decode if the album art is embedded in the file
        String mArtist = Util.getMediaArtist(context, media);
        String mAlbum = Util.getMediaAlbum(context, media);

        /* Parse decoded attachment */
        if( mArtist.length() == 0 || mAlbum.length() == 0 ||
                mArtist.equals(VLCApplication.getAppContext().getString(R.string.unknown_artist)) ||
                mAlbum.equals(VLCApplication.getAppContext().getString(R.string.unknown_album)) )
        {
            /* If artist or album are missing, it was cached by title MD5 hash */
            MessageDigest md = MessageDigest.getInstance("MD5");
            byte[] binHash = md.digest((artworkURL + media.getTitle()).getBytes("UTF-8"));
            /* Convert binary hash to normal hash */
            BigInteger hash = new BigInteger(1, binHash);
            String titleHash = hash.toString(16);
            while(titleHash.length() < 32) {
                titleHash = "0" + titleHash;
            }
            /* Use generated hash to find art */
            artworkURL = ART_DIR + "/arturl/" + titleHash + "/art.png";
        } else {
            /* Otherwise, it was cached by artist and album */
            artworkURL = ART_DIR + "/artistalbum/" + mArtist + "/" + mAlbum + "/art.png";
        }

        return artworkURL;
    }
    return null;
}
 
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:35,代码来源:AudioUtil.java


注:本文中的org.videolan.vlc.MediaWrapper.getArtworkURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。