2018-04-21 21:10:01 +00:00
|
|
|
package org.schabi.newpipe.player.playqueue;
|
|
|
|
|
2017-11-02 06:38:18 +00:00
|
|
|
|
2020-04-15 13:31:53 +00:00
|
|
|
import org.schabi.newpipe.extractor.Page;
|
2017-11-02 06:38:18 +00:00
|
|
|
import org.schabi.newpipe.extractor.channel.ChannelInfo;
|
2018-03-18 15:37:49 +00:00
|
|
|
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
2017-11-02 06:38:18 +00:00
|
|
|
import org.schabi.newpipe.util.ExtractorHelper;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
2020-10-31 20:55:45 +00:00
|
|
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
|
|
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
2017-11-02 06:38:18 +00:00
|
|
|
|
2022-02-19 16:49:43 +00:00
|
|
|
public final class ChannelPlayQueue extends AbstractInfoPlayQueue<ChannelInfo> {
|
2017-11-02 06:38:18 +00:00
|
|
|
|
2018-01-23 00:40:00 +00:00
|
|
|
public ChannelPlayQueue(final ChannelInfo info) {
|
2022-02-19 16:49:43 +00:00
|
|
|
super(info);
|
2018-01-23 00:40:00 +00:00
|
|
|
}
|
|
|
|
|
2017-11-02 06:38:18 +00:00
|
|
|
public ChannelPlayQueue(final int serviceId,
|
2017-11-04 18:30:01 +00:00
|
|
|
final String url,
|
2020-04-15 13:31:53 +00:00
|
|
|
final Page nextPage,
|
2018-03-18 15:37:49 +00:00
|
|
|
final List<StreamInfoItem> streams,
|
2017-11-04 18:30:01 +00:00
|
|
|
final int index) {
|
2020-04-15 13:31:53 +00:00
|
|
|
super(serviceId, url, nextPage, streams, index);
|
2017-11-02 06:38:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-11-03 03:34:12 +00:00
|
|
|
protected String getTag() {
|
|
|
|
return "ChannelPlayQueue@" + Integer.toHexString(hashCode());
|
2017-11-02 06:38:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void fetch() {
|
2017-11-03 03:34:12 +00:00
|
|
|
if (this.isInitial) {
|
2017-11-02 06:38:18 +00:00
|
|
|
ExtractorHelper.getChannelInfo(this.serviceId, this.baseUrl, false)
|
|
|
|
.subscribeOn(Schedulers.io())
|
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
2017-11-03 03:34:12 +00:00
|
|
|
.subscribe(getHeadListObserver());
|
2017-11-02 06:38:18 +00:00
|
|
|
} else {
|
2020-04-15 13:31:53 +00:00
|
|
|
ExtractorHelper.getMoreChannelItems(this.serviceId, this.baseUrl, this.nextPage)
|
2017-11-02 06:38:18 +00:00
|
|
|
.subscribeOn(Schedulers.io())
|
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
2018-02-24 21:57:25 +00:00
|
|
|
.subscribe(getNextPageObserver());
|
2017-11-02 06:38:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|