Don't preemptively clean url and save StreamInfo with PlayQueueItem
This commit is contained in:
parent
183f9701fd
commit
f3a280dcb6
2 changed files with 12 additions and 3 deletions
|
@ -122,7 +122,7 @@ public class RouterActivity extends AppCompatActivity {
|
||||||
currentService = NewPipe.getServiceByUrl(url);
|
currentService = NewPipe.getServiceByUrl(url);
|
||||||
currentServiceId = currentService.getServiceId();
|
currentServiceId = currentService.getServiceId();
|
||||||
currentLinkType = currentService.getLinkTypeByUrl(url);
|
currentLinkType = currentService.getLinkTypeByUrl(url);
|
||||||
currentUrl = NavigationHelper.getCleanUrl(currentService, url, currentLinkType);
|
currentUrl = url;
|
||||||
} else {
|
} else {
|
||||||
currentService = NewPipe.getService(currentServiceId);
|
currentService = NewPipe.getService(currentServiceId);
|
||||||
}
|
}
|
||||||
|
@ -307,7 +307,8 @@ public class RouterActivity extends AppCompatActivity {
|
||||||
// StreamDetailFragment can fetch data itself
|
// StreamDetailFragment can fetch data itself
|
||||||
if(playerChoiceKey.equals(getString(R.string.show_info_key))) {
|
if(playerChoiceKey.equals(getString(R.string.show_info_key))) {
|
||||||
disposables.add(Observable
|
disposables.add(Observable
|
||||||
.fromCallable(() -> NavigationHelper.getIntentByLink(this, currentUrl))
|
.fromCallable(() -> NavigationHelper.getIntentByLink(this,
|
||||||
|
NavigationHelper.getCleanUrl(currentService, currentUrl, currentLinkType)))
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(intent -> {
|
.subscribe(intent -> {
|
||||||
|
|
|
@ -29,11 +29,13 @@ public class PlayQueueItem implements Serializable {
|
||||||
private Throwable error;
|
private Throwable error;
|
||||||
|
|
||||||
private transient Single<StreamInfo> stream;
|
private transient Single<StreamInfo> stream;
|
||||||
|
private StreamInfo info;
|
||||||
|
|
||||||
PlayQueueItem(@NonNull final StreamInfo info) {
|
PlayQueueItem(@NonNull final StreamInfo info) {
|
||||||
this(info.getName(), info.getUrl(), info.getServiceId(), info.getDuration(),
|
this(info.getName(), info.getUrl(), info.getServiceId(), info.getDuration(),
|
||||||
info.getThumbnailUrl(), info.getUploaderName(), info.getStreamType());
|
info.getThumbnailUrl(), info.getUploaderName(), info.getStreamType());
|
||||||
this.stream = Single.just(info);
|
this.stream = Single.just(info);
|
||||||
|
this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayQueueItem(@NonNull final StreamInfoItem item) {
|
PlayQueueItem(@NonNull final StreamInfoItem item) {
|
||||||
|
@ -105,7 +107,13 @@ public class PlayQueueItem implements Serializable {
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private Single<StreamInfo> getInfo() {
|
private Single<StreamInfo> getInfo() {
|
||||||
return ExtractorHelper.getStreamInfo(this.serviceId, this.url, false)
|
Single<StreamInfo> single;
|
||||||
|
if (this.info != null){
|
||||||
|
single = Single.just(info);
|
||||||
|
} else {
|
||||||
|
single = ExtractorHelper.getStreamInfo(this.serviceId, this.url, false);
|
||||||
|
}
|
||||||
|
return single
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.doOnError(throwable -> error = throwable);
|
.doOnError(throwable -> error = throwable);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue