Search in sources :

Example 11 with StreamInfoItem

use of org.schabi.newpipe.extractor.stream.StreamInfoItem in project NewPipe by TeamNewPipe.

the class LocalPlaylistFragment method getPlayQueue.

private PlayQueue getPlayQueue(final int index) {
    if (itemListAdapter == null) {
        return new SinglePlayQueue(Collections.emptyList(), 0);
    }
    final List<LocalItem> infoItems = itemListAdapter.getItemsList();
    List<StreamInfoItem> streamInfoItems = new ArrayList<>(infoItems.size());
    for (final LocalItem item : infoItems) {
        if (item instanceof PlaylistStreamEntry) {
            streamInfoItems.add(((PlaylistStreamEntry) item).toStreamInfoItem());
        }
    }
    return new SinglePlayQueue(streamInfoItems, index);
}
Also used : StreamInfoItem(org.schabi.newpipe.extractor.stream.StreamInfoItem) PlaylistStreamEntry(org.schabi.newpipe.database.playlist.PlaylistStreamEntry) ArrayList(java.util.ArrayList) LocalItem(org.schabi.newpipe.database.LocalItem) SinglePlayQueue(org.schabi.newpipe.playlist.SinglePlayQueue)

Example 12 with StreamInfoItem

use of org.schabi.newpipe.extractor.stream.StreamInfoItem in project NewPipe by TeamNewPipe.

the class StatisticsPlaylistFragment method getPlayQueue.

private PlayQueue getPlayQueue(final int index) {
    if (itemListAdapter == null) {
        return new SinglePlayQueue(Collections.emptyList(), 0);
    }
    final List<LocalItem> infoItems = itemListAdapter.getItemsList();
    List<StreamInfoItem> streamInfoItems = new ArrayList<>(infoItems.size());
    for (final LocalItem item : infoItems) {
        if (item instanceof StreamStatisticsEntry) {
            streamInfoItems.add(((StreamStatisticsEntry) item).toStreamInfoItem());
        }
    }
    return new SinglePlayQueue(streamInfoItems, index);
}
Also used : StreamInfoItem(org.schabi.newpipe.extractor.stream.StreamInfoItem) StreamStatisticsEntry(org.schabi.newpipe.database.stream.StreamStatisticsEntry) ArrayList(java.util.ArrayList) LocalItem(org.schabi.newpipe.database.LocalItem) SinglePlayQueue(org.schabi.newpipe.playlist.SinglePlayQueue)

Example 13 with StreamInfoItem

use of org.schabi.newpipe.extractor.stream.StreamInfoItem in project NewPipe by TeamNewPipe.

the class StreamStatisticsEntry method toStreamInfoItem.

public StreamInfoItem toStreamInfoItem() {
    StreamInfoItem item = new StreamInfoItem(serviceId, url, title, streamType);
    item.setDuration(duration);
    item.setUploaderName(uploader);
    item.setThumbnailUrl(thumbnailUrl);
    return item;
}
Also used : StreamInfoItem(org.schabi.newpipe.extractor.stream.StreamInfoItem)

Aggregations

StreamInfoItem (org.schabi.newpipe.extractor.stream.StreamInfoItem)13 ArrayList (java.util.ArrayList)7 SinglePlayQueue (org.schabi.newpipe.playlist.SinglePlayQueue)7 Activity (android.app.Activity)4 Context (android.content.Context)4 DialogInterface (android.content.DialogInterface)4 Bundle (android.os.Bundle)4 NonNull (android.support.annotation.NonNull)4 Nullable (android.support.annotation.Nullable)4 View (android.view.View)4 List (java.util.List)4 R (org.schabi.newpipe.R)4 LocalItem (org.schabi.newpipe.database.LocalItem)4 InfoItemDialog (org.schabi.newpipe.info_list.InfoItemDialog)4 NavigationHelper (org.schabi.newpipe.util.NavigationHelper)4 RecyclerView (android.support.v7.widget.RecyclerView)3 Log (android.util.Log)3 LayoutInflater (android.view.LayoutInflater)3 ViewGroup (android.view.ViewGroup)3 AndroidSchedulers (io.reactivex.android.schedulers.AndroidSchedulers)3