All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.iheartradio.m3u8.PlaylistHandler Maven / Gradle / Ivy

package com.iheartradio.m3u8;

import com.iheartradio.m3u8.data.PlaylistData;

class PlaylistHandler implements LineHandler {
    @Override
    public void handle(String line, ParseState state) {
        final PlaylistData.Builder builder = new PlaylistData.Builder();

        if (Constants.URL_PATTERN.matcher(line).matches()) {
            builder.withUrl(line);
        } else {
            builder.withPath(line);
        }

        final MasterParseState masterState = state.getMaster();

        masterState.playlists.add(builder
                .withStreamInfo(masterState.streamInfo)
                .build());

        masterState.streamInfo = null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy