Example usage for android.support.v4.media MediaMetadataCompat METADATA_KEY_NUM_TRACKS

List of usage examples for android.support.v4.media MediaMetadataCompat METADATA_KEY_NUM_TRACKS

Introduction

In this page you can find the example usage for android.support.v4.media MediaMetadataCompat METADATA_KEY_NUM_TRACKS.

Prototype

String METADATA_KEY_NUM_TRACKS

To view the source code for android.support.v4.media MediaMetadataCompat METADATA_KEY_NUM_TRACKS.

Click Source Link

Document

The number of tracks in the media's original source.

Usage

From source file:com.bayapps.android.robophish.utils.SimpleMusicProviderSource.java

public void add(String title, String album, String artist, String genre, String source, String iconUrl,
        long trackNumber, long totalTrackCount, long durationMs) {
    String id = String.valueOf(source.hashCode());

    //noinspection ResourceType
    mData.add(new MediaMetadataCompat.Builder().putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, id)
            .putString(MusicProviderSource.CUSTOM_METADATA_TRACK_SOURCE, source)
            .putString(MediaMetadataCompat.METADATA_KEY_ALBUM, album)
            .putString(MediaMetadataCompat.METADATA_KEY_ARTIST, artist)
            .putLong(MediaMetadataCompat.METADATA_KEY_DURATION, durationMs)
            .putString(MediaMetadataCompat.METADATA_KEY_GENRE, genre)
            .putString(MediaMetadataCompat.METADATA_KEY_ALBUM_ART_URI, iconUrl)
            .putString(MediaMetadataCompat.METADATA_KEY_TITLE, title)
            .putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, trackNumber)
            .putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, totalTrackCount).build());
}

From source file:com.example.android.uamp.model.ExternalStorageSource.java

@Override
public Iterator<MediaMetadataCompat> iterator() {

    ArrayList<MediaMetadataCompat> tracks = new ArrayList<>();
    Cursor cursor;// w w w  .  j av a  2 s . c  o m
    Uri euri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;

    //        String[] projection = {MediaStore.Audio.Media._ID,
    //                MediaStore.Audio.Media.DISPLAY_NAME,
    //                MediaStore.Audio.Media.DATA, MediaStore.Audio.Media.TITLE};
    String selection = MediaStore.Audio.Media.IS_MUSIC + "!=" + 0;
    cursor = mContentResolver.query(euri, null, selection, null, MediaStore.Audio.Media.TITLE + " ASC");
    // retrieve the indices of the columns where the ID, title, etc. of the song are
    int artistColumn = cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST);
    int titleColumn = cursor.getColumnIndex(MediaStore.Audio.Media.TITLE);
    int albumColumn = cursor.getColumnIndex(MediaStore.Audio.Media.ALBUM);
    int durationColumn = cursor.getColumnIndex(MediaStore.Audio.Media.DURATION);
    int idColumn = cursor.getColumnIndex(MediaStore.Audio.Media._ID);
    int dataColumn = cursor.getColumnIndex(MediaStore.Audio.Media.DATA);

    for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
        tracks.add(new MediaMetadataCompat.Builder()
                .putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, cursor.getString(idColumn))
                .putString(MusicProviderSource.CUSTOM_METADATA_TRACK_SOURCE, cursor.getString(dataColumn))
                .putString(MediaMetadataCompat.METADATA_KEY_ALBUM, cursor.getString(albumColumn))
                .putString(MediaMetadataCompat.METADATA_KEY_ARTIST, cursor.getString(artistColumn))
                .putLong(MediaMetadataCompat.METADATA_KEY_DURATION, cursor.getLong(durationColumn))
                .putString(MediaMetadataCompat.METADATA_KEY_GENRE, "Pop")
                .putString(MediaMetadataCompat.METADATA_KEY_ALBUM_ART_URI, "")
                .putString(MediaMetadataCompat.METADATA_KEY_TITLE, cursor.getString(titleColumn))
                .putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, 2)
                .putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, 2).build());
    }
    return tracks.iterator();

}

From source file:com.classiqo.nativeandroid_32bitz.model.RemoteJSONSource.java

private MediaMetadataCompat buildFromJSON(JSONObject json/*, String basePath*/) throws JSONException {
    String title = json.getString(JSON_TITLE);
    String album = json.getString(JSON_ALBUM);
    String artist = json.getString(JSON_ARTIST);
    String genre = json.getString(JSON_GENRE);
    String source = json.getString(JSON_SOURCE);
    String iconUrl = json.getString(JSON_IMAGE);
    int trackNumber = json.getInt(JSON_TRACK_NUMBER);
    int totalTrackCount = json.getInt(JSON_TOTAL_TRACK_COUNT);
    int duration = json.getInt(JSON_DURATION) * 1000;
    String site = json.getString(JSON_SITE);

    LogHelper.d(TAG, "Found music track", json);

    if (!source.startsWith("http")) {
        //            source = basePath + source;
        source = site + JSON_S3_BUCKET + "/" + JSON_MUSIC + "/" + artist + "/" + source;
    }/*from   ww  w  .j a  v  a 2 s.  c om*/
    if (!iconUrl.startsWith("http")) {
        //            source = basePath + iconUrl;
        iconUrl = site + JSON_S3_BUCKET + "/" + JSON_MUSIC + "/" + artist + "/" + album + ".jpg";
    }

    LogHelper.i(TAG, source);
    LogHelper.i(TAG, iconUrl);
    String id = String.valueOf(source.hashCode());

    //noinspection ResourceType
    return new MediaMetadataCompat.Builder().putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, id)
            .putString(MusicProviderSource.CUSTOM_METADATA_TRACK_SOURCE, source)
            .putString(MediaMetadataCompat.METADATA_KEY_ALBUM, album)
            .putString(MediaMetadataCompat.METADATA_KEY_ARTIST, artist)
            .putLong(MediaMetadataCompat.METADATA_KEY_DURATION, duration)
            .putString(MediaMetadataCompat.METADATA_KEY_GENRE, genre)
            .putString(MediaMetadataCompat.METADATA_KEY_ALBUM_ART_URI, iconUrl)
            .putString(MediaMetadataCompat.METADATA_KEY_TITLE, title)
            .putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, trackNumber)
            .putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, totalTrackCount).build();
}

From source file:com.example.android.uamp.model.RemoteJSONSource.java

private MediaMetadataCompat buildFromJSON(JSONObject json, String basePath) throws JSONException {
    String title = json.getString(JSON_TITLE);
    String album = json.getString(JSON_ALBUM);
    String artist = json.getString(JSON_ARTIST);
    String genre = json.getString(JSON_GENRE);
    String source = json.getString(JSON_SOURCE);
    String iconUrl = json.getString(JSON_IMAGE);
    int trackNumber = json.getInt(JSON_TRACK_NUMBER);
    int totalTrackCount = json.getInt(JSON_TOTAL_TRACK_COUNT);
    int duration = json.getInt(JSON_DURATION) * 1000; // ms

    LogHelper.d(TAG, "Found music track: ", json);

    // Media is stored relative to JSON file
    if (!source.startsWith("http")) {
        source = basePath + source;//from   w  w w .j a v  a 2  s.co m
    }
    if (!iconUrl.startsWith("http")) {
        iconUrl = basePath + iconUrl;
    }
    // Since we don't have a unique ID in the server, we fake one using the hashcode of
    // the music source. In a real world app, this could come from the server.
    String id = String.valueOf(source.hashCode());

    // Adding the music source to the MediaMetadata (and consequently using it in the
    // mediaSession.setMetadata) is not a good idea for a real world music app, because
    // the session metadata can be accessed by notification listeners. This is done in this
    // sample for convenience only.
    //noinspection ResourceType
    return new MediaMetadataCompat.Builder().putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, id)
            .putString(MusicProviderSource.CUSTOM_METADATA_TRACK_SOURCE, source)
            .putString(MediaMetadataCompat.METADATA_KEY_ALBUM, album)
            .putString(MediaMetadataCompat.METADATA_KEY_ARTIST, artist)
            .putLong(MediaMetadataCompat.METADATA_KEY_DURATION, duration)
            .putString(MediaMetadataCompat.METADATA_KEY_GENRE, genre)
            .putString(MediaMetadataCompat.METADATA_KEY_ALBUM_ART_URI, iconUrl)
            .putString(MediaMetadataCompat.METADATA_KEY_TITLE, title)
            .putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, trackNumber)
            .putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, totalTrackCount).build();
}

From source file:dk.glutter.android.dansker.uamp.model.RemoteJSONSource.java

private MediaMetadataCompat buildFromJSON(JSONObject json, String basePath) throws JSONException {
    String title = json.getString(JSON_TITLE);
    String album = json.getString(JSON_ALBUM);
    String artist = json.getString(JSON_ARTIST);
    String genre = json.getString(JSON_GENRE);
    String source = json.getString(JSON_SOURCE);
    String iconUrl = json.getString(JSON_IMAGE);
    int trackNumber = json.getInt(JSON_TRACK_NUMBER);
    int totalTrackCount = json.getInt(JSON_TOTAL_TRACK_COUNT);
    int duration = json.getInt(JSON_DURATION) * 1000; // ms

    LogHelper.d(TAG, "Found music track: ", json);

    // Media is stored relative to JSON file
    if (!source.startsWith("http")) {
        source = basePath + source;//from  w  w  w .ja  va2  s  . c  o m
    }
    if (!iconUrl.startsWith("http")) {
        iconUrl = "http://denstoredanske.dk/@api/deki/files/70689/=dannebrog.jpg";
    }
    // Since we don't have a unique ID in the server, we fake one using the hashcode of
    // the music source. In a real world app, this could come from the server.
    String id = String.valueOf(source.hashCode());

    // Adding the music source to the MediaMetadata (and consequently using it in the
    // mediaSession.setMetadata) is not a good idea for a real world music app, because
    // the session metadata can be accessed by notification listeners. This is done in this
    // sample for convenience only.
    //noinspection ResourceType
    return new MediaMetadataCompat.Builder().putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, id)
            .putString(MusicProviderSource.CUSTOM_METADATA_TRACK_SOURCE, source)
            .putString(MediaMetadataCompat.METADATA_KEY_ALBUM, album)
            .putString(MediaMetadataCompat.METADATA_KEY_ARTIST, artist)
            .putLong(MediaMetadataCompat.METADATA_KEY_DURATION, duration)
            .putString(MediaMetadataCompat.METADATA_KEY_GENRE, genre)
            .putString(MediaMetadataCompat.METADATA_KEY_ALBUM_ART_URI, iconUrl)
            .putString(MediaMetadataCompat.METADATA_KEY_TITLE, title)
            .putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, trackNumber)
            .putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, totalTrackCount).build();
}

From source file:com.example.hp.smartstor.CloudMusicManager.uamp.model.RemoteJSONSource.java

private MediaMetadataCompat buildFromJSON(JSONObject json, String basePath) throws JSONException {
    String title = json.getString(JSON_TITLE);
    String alb = json.getString(JSON_ALBUM);
    alb = alb.replace(" ", "%20");
    String album = alb;//w ww.  j  a  v  a  2 s. c  om
    Log.i("album after edit", alb);
    String artist = json.getString(JSON_ARTIST);
    String genre = json.getString(JSON_GENRE);
    String src = json.getString(JSON_SOURCE);
    src = src.replace(" ", "%20");
    String source = src;
    String iconUrl = json.getString(JSON_IMAGE);
    int trackNumber = json.getInt(JSON_TRACK_NUMBER);
    int totalTrackCount = json.getInt(JSON_TOTAL_TRACK_COUNT);
    int duration = json.getInt(JSON_DURATION) * 1000; // ms

    LogHelper.d(TAG, "Found music track: ", json);

    // Media is stored relative to JSON file
    if (!source.startsWith("http")) {
        source = basePath + source;
    }
    if (!iconUrl.startsWith("http")) {
        iconUrl = basePath + iconUrl;
    }
    // Since we don't have a unique ID in the server, we fake one using the hashcode of
    // the music source. In a real world app, this could come from the server.
    String id = String.valueOf(source.hashCode());

    // Adding the music source to the MediaMetadata (and consequently using it in the
    // mediaSession.setMetadata) is not a good idea for a real world music app, because
    // the session metadata can be accessed by notification listeners. This is done in this
    // sample for convenience only.
    //noinspection ResourceType
    return new MediaMetadataCompat.Builder().putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, id)
            .putString(MusicProviderSource.CUSTOM_METADATA_TRACK_SOURCE, source)
            .putString(MediaMetadataCompat.METADATA_KEY_ALBUM, album)
            .putString(MediaMetadataCompat.METADATA_KEY_ARTIST, artist)
            .putLong(MediaMetadataCompat.METADATA_KEY_DURATION, duration)
            .putString(MediaMetadataCompat.METADATA_KEY_GENRE, genre)
            .putString(MediaMetadataCompat.METADATA_KEY_ALBUM_ART_URI, iconUrl)
            .putString(MediaMetadataCompat.METADATA_KEY_TITLE, title)
            .putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, trackNumber)
            .putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, totalTrackCount).build();
}

From source file:com.murati.oszk.audiobook.model.RemoteJSONSource.java

protected MediaMetadataCompat buildFromJSON(JSONObject json, String basePath) throws JSONException {
    String writer = json.getString(JSON_WRITER);
    String ebook = json.getString(JSON_EBOOK_TITLE);

    String title = json.getString(JSON_TRACK_TITLE);
    int trackNumber = json.getInt(JSON_TRACK_NUMBER);

    String genre = json.getString(JSON_GENRE);
    String source = json.getString(JSON_SOURCE);
    String iconUrl = json.getString(JSON_IMAGE);

    int totalTrackCount = json.getInt(JSON_TOTAL_TRACK_COUNT);
    int duration = json.getInt(JSON_DURATION) * 1000; // ms

    LogHelper.d(TAG, "Loaded tracks: ", json);

    // Media is stored relative to JSON file
    if (!source.startsWith("http")) {
        source = basePath + source;/*from w w w. ja  va 2  s. c o m*/
    }
    if (!iconUrl.startsWith("http")) {
        iconUrl = basePath + iconUrl;
    }
    // Since we don't have a unique ID in the server, we fake one using the hashcode of
    // the music source. In a real world app, this could come from the server.
    String id = String.valueOf(source.hashCode());

    // Adding the music source to the MediaMetadata (and consequently using it in the
    // mediaSession.setMetadata) is not a good idea for a real world music app, because
    // the session metadata can be accessed by notification listeners. This is done in this
    // sample for convenience only.
    //noinspection ResourceType

    // Skip faulty ones
    if (ebook == null || title == null || ebook.trim().length() * title.trim().length() == 0) {
        LogHelper.e(TAG, "Error processing JSON: " + json.toString());
        return null;
    }

    // Fix writer
    if (writer == null || writer.trim().length() == 0) {
        if (title.contains(":")) {
            writer = title.split(":")[0];
        } else {
            writer = "Ismeretlen szerz"; //TODO: resource
        }
    }

    //Fix title TODO: Strip from API
    ebook = ebook.replace("&quot;", "");
    ebook = ebook.replace("\"", "");
    title = title.replace("&quot;", "\"");

    return new MediaMetadataCompat.Builder().putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, id)
            .putString(CUSTOM_METADATA_TRACK_SOURCE, source)
            .putString(MediaMetadataCompat.METADATA_KEY_ALBUM, ebook)
            .putString(MediaMetadataCompat.METADATA_KEY_WRITER, writer)
            .putLong(MediaMetadataCompat.METADATA_KEY_DURATION, duration)
            .putString(MediaMetadataCompat.METADATA_KEY_GENRE, genre)
            .putString(MediaMetadataCompat.METADATA_KEY_ALBUM_ART_URI, iconUrl)
            .putString(MediaMetadataCompat.METADATA_KEY_TITLE, title)
            .putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, trackNumber)
            .putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, totalTrackCount).build();
}

From source file:com.whitecloud.ron.musicplayer.model.MusicProvider.java

public ArrayList<Song> getTopTracks(String spotifyId) {
    try {/*from w  w  w  . j  a v a 2 s .co  m*/
        if (mCurrentState == State.NON_INITIALIZED) {
            mCurrentState = State.INITIALIZING;
            SpotifyApi api = new SpotifyApi();
            SpotifyService spotify = api.getService();
            Tracks tracks = spotify.getArtistTopTrack(spotifyId, "CA");
            List<Track> trackList = tracks.tracks;

            if (trackList != null) {
                for (int j = 0; j < trackList.size(); j++) {
                    Track track = trackList.get(j);
                    MediaMetadataCompat item = new MediaMetadataCompat.Builder()
                            .putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, track.id)
                            //                                 .putString(CUSTOM_METADATA_TRACK_SOURCE, track.preview_url)
                            .putString(MediaMetadataCompat.METADATA_KEY_ALBUM, track.album.name)
                            .putString(MediaMetadataCompat.METADATA_KEY_ARTIST, track.artists.get(0).name)
                            .putLong(MediaMetadataCompat.METADATA_KEY_DURATION, track.duration_ms)
                            .putString(MediaMetadataCompat.METADATA_KEY_GENRE, track.type)
                            .putString(MediaMetadataCompat.METADATA_KEY_ALBUM_ART_URI,
                                    track.album.images.get(0).url)
                            .putString(MediaMetadataCompat.METADATA_KEY_TITLE, track.name)
                            .putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, track.track_number)
                            .putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, trackList.size()).build();
                    String musicId = item.getString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID);
                    mMusicListById.put(musicId, new MutableMediaMetadata(musicId, item));
                    mMusicSourceList.put(musicId, track.preview_url);
                    mSongs.add(new Song(track.preview_url, track.name, track.album.name,
                            track.album.images.get(0).url, track.album.images.get(1).url));
                }
                buildListsByGenre();
            }
            mCurrentState = State.INITIALIZED;
        }
    } catch (RetrofitError e) {
        LogHelper.e(TAG, e, "Could not retrieve music list");
    } finally {
        if (mCurrentState != State.INITIALIZED) {
            // Something bad happened, so we reset state to NON_INITIALIZED to allow
            // retries (eg if the network connection is temporary unavailable)
            mCurrentState = State.NON_INITIALIZED;
        }

        return (ArrayList) mSongs;

    }
}

From source file:com.reallynourl.nourl.fmpfoldermusicplayer.ui.notifications.MediaNotification.java

private static void updateMediaSession(MediaSessionCompat mediaSession) {
    ExtendedFile currentFile = MediaManager.getInstance().getCurrentFile();
    if (currentFile != null) {
        long validActions = PlaybackStateCompat.ACTION_STOP;
        if (MediaManager.getInstance().canPlay()) {
            validActions |= PlaybackStateCompat.ACTION_PLAY | PlaybackStateCompat.ACTION_PAUSE;
        }//from   w  w w .ja v a  2  s.co  m
        if (MediaManager.getInstance().hasNext()) {
            validActions |= PlaybackStateCompat.ACTION_SKIP_TO_NEXT;
        }
        if (MediaManager.getInstance().hasPrevious()) {
            validActions |= PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS;
        }
        int playState = MediaManager.getInstance().isPlaying() ? PlaybackStateCompat.STATE_PLAYING
                : PlaybackStateCompat.STATE_PAUSED;
        mediaSession.setMetadata(new MediaMetadataCompat.Builder()
                .putString(MediaMetadataCompat.METADATA_KEY_ALBUM, currentFile.getParentFile().getName())
                .putString(MediaMetadataCompat.METADATA_KEY_TITLE, currentFile.getNameWithoutExtension())
                .putLong(MediaMetadataCompat.METADATA_KEY_DURATION, MediaManager.getInstance().getDuration())
                .putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER,
                        MediaManager.getInstance().getPlaylist().getCurrentIndex() + 1)
                .putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS,
                        MediaManager.getInstance().getPlaylist().size())
                //.putBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART, bitmap)
                .build());
        mediaSession.setPlaybackState(new PlaybackStateCompat.Builder()
                .setState(playState, MediaManager.getInstance().getPosition(), 1.0f).setActions(validActions)
                .build());
    } else {
        mediaSession.setActive(false);
    }
}

From source file:com.livemasjid.livemasjidandroid.model.RemoteJSONSource.java

private MediaMetadataCompat buildFromJSON(JSONObject json, String basePath, int totalTracks, int trackNo,
        ArrayList<String> live) throws JSONException {
    try {//from  ww  w  . ja va 2s.c om
        String title = json.getString(JSON_STREAMNAME);
        String album = json.getString(JSON_STREAMNAME);
        String artist = json.getString(JSON_STREAMDESC);
        String genre = json.getString(JSON_GENRE).replaceAll("/", "-");
        String listenURL = json.getString(JSON_STREAMURL);
        String id = json.getString(JSON_MOUNTNAME);
        String iconUrl = "http://livemasjid.com/images/MasjidLogo.png";//json.getString(JSON_IMAGE);
        if (genre.contains("Aalim")) {
            iconUrl = "http://livemasjid.com/images/AalimLogo.png";
        } else if (genre.contains("Institution")) {
            iconUrl = "http://livemasjid.com/images/InstitutionLogo.png";
        }
        int trackNumber = trackNo;//json.getInt(JSON_TRACK_NUMBER);
        int totalTrackCount = totalTracks;//json.getInt(JSON_TOTAL_TRACK_COUNT);
        int duration = 10000000;//json.getInt(JSON_DURATION) * 1000; // ms

        LogHelper.d(TAG, "Found music track: ", json);

        LogHelper.d(TAG, id);

        // Media is stored relative to JSON file
        if (!listenURL.startsWith("http")) {
            listenURL = "http://" + listenURL;
        }

        if (!live.contains(id)) {
            genre = "Offline";
            title = "Last recording: " + title;
            listenURL = listenURL.replace(":8000", "/download/mp3") + "/latest.mp3";
            //listenURL = listenURL.replace(":8000/","/download/mp3/dir2cast.php?dir=");
        }
        //if (!iconUrl.startsWith("http")) {
        //    iconUrl = basePath + iconUrl;
        //}
        // Since we don't have a unique ID in the server, we fake one using the hashcode of
        // the music listenURL. In a real world app, this could come from the server.
        //String id = String.valueOf(listenURL.hashCode());

        // Adding the music listenURL to the MediaMetadata (and consequently using it in the
        // mediaSession.setMetadata) is not a good idea for a real world music app, because
        // the session metadata can be accessed by notification listeners. This is done in this
        // sample for convenience only.
        //noinspection ResourceType
        return new MediaMetadataCompat.Builder().putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, id)
                .putString(MusicProviderSource.CUSTOM_METADATA_TRACK_SOURCE, listenURL)
                .putString(MediaMetadataCompat.METADATA_KEY_ALBUM, album)
                .putString(MediaMetadataCompat.METADATA_KEY_ARTIST, artist)
                .putLong(MediaMetadataCompat.METADATA_KEY_DURATION, duration)
                .putString(MediaMetadataCompat.METADATA_KEY_GENRE, genre)
                .putString(MediaMetadataCompat.METADATA_KEY_ALBUM_ART_URI, iconUrl)
                .putString(MediaMetadataCompat.METADATA_KEY_TITLE, title)
                .putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, trackNumber)
                .putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, totalTrackCount).build();
    } catch (JSONException e) {
        LogHelper.e(TAG, e, "Could not retrieve required track info");
        return null;
    }
}