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
|
|
|
|
2021-03-31 18:16:08 +00:00
|
|
|
public class RelatedItemInfo extends ListInfo<InfoItem> {
|
|
|
|
public RelatedItemInfo(final int serviceId, final ListLinkHandler listUrlIdHandler,
|
|
|
|
final String name) {
|
2018-10-02 15:09:16 +00:00
|
|
|
super(serviceId, listUrlIdHandler, name);
|
|
|
|
}
|
|
|
|
|
2021-03-31 18:16:08 +00:00
|
|
|
public static RelatedItemInfo 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);
|
2021-03-31 18:16:08 +00:00
|
|
|
final RelatedItemInfo relatedItemInfo = new RelatedItemInfo(
|
2020-03-31 17:20:15 +00:00
|
|
|
info.getServiceId(), handler, info.getName());
|
2021-03-31 18:16:08 +00:00
|
|
|
final List<InfoItem> relatedItems = new ArrayList<>(info.getRelatedItems());
|
|
|
|
relatedItemInfo.setRelatedItems(relatedItems);
|
|
|
|
return relatedItemInfo;
|
2018-10-16 18:53:02 +00:00
|
|
|
}
|
2018-10-02 15:09:16 +00:00
|
|
|
}
|