2018-10-02 15:09:16 +00:00
|
|
|
package org.schabi.newpipe.util;
|
|
|
|
|
|
|
|
import org.schabi.newpipe.extractor.InfoItem;
|
|
|
|
import org.schabi.newpipe.extractor.ListInfo;
|
|
|
|
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
|
|
|
|
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
|
|
|
|
2018-10-16 18:53:02 +00:00
|
|
|
import java.util.ArrayList;
|
2018-10-02 15:09:16 +00:00
|
|
|
import java.util.Collections;
|
2018-10-16 18:53:02 +00:00
|
|
|
import java.util.List;
|
2018-10-02 15:09:16 +00:00
|
|
|
|
|
|
|
public class RelatedStreamInfo extends ListInfo<InfoItem> {
|
2020-03-31 17:20:15 +00:00
|
|
|
public RelatedStreamInfo(final int serviceId, final ListLinkHandler listUrlIdHandler,
|
|
|
|
final String name) {
|
2018-10-02 15:09:16 +00:00
|
|
|
super(serviceId, listUrlIdHandler, name);
|
|
|
|
}
|
|
|
|
|
2020-03-31 17:20:15 +00:00
|
|
|
public static RelatedStreamInfo getInfo(final StreamInfo info) {
|
2020-08-16 08:24:58 +00:00
|
|
|
final ListLinkHandler handler = new ListLinkHandler(
|
2020-03-31 17:20:15 +00:00
|
|
|
info.getOriginalUrl(), info.getUrl(), info.getId(), Collections.emptyList(), null);
|
2020-08-16 08:24:58 +00:00
|
|
|
final RelatedStreamInfo relatedStreamInfo = new RelatedStreamInfo(
|
2020-03-31 17:20:15 +00:00
|
|
|
info.getServiceId(), handler, info.getName());
|
2020-08-27 20:56:58 +00:00
|
|
|
final List<InfoItem> streams = new ArrayList<>(info.getRelatedStreams());
|
2018-10-16 18:53:02 +00:00
|
|
|
relatedStreamInfo.setRelatedItems(streams);
|
|
|
|
return relatedStreamInfo;
|
|
|
|
}
|
2018-10-02 15:09:16 +00:00
|
|
|
}
|