Skip to content

Commit c877712

Browse files
committed
Add deprecated old method calls to avoid breaking API
1 parent 14f6f1b commit c877712

3 files changed

Lines changed: 40 additions & 0 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,22 @@ public StreamExtractor(StreamingService service, LinkHandler linkHandler) {
337337
public abstract InfoItemsCollector<? extends InfoItem, ? extends InfoItemExtractor>
338338
getRelatedItems() throws IOException, ExtractionException;
339339

340+
/**
341+
* @deprecated Use {@link #getRelatedItems()}. May be removed in a future version.
342+
* @return The result of {@link #getRelatedItems()} if it is a
343+
* StreamInfoItemsCollector, null otherwise
344+
* @throws IOException
345+
* @throws ExtractionException
346+
*/
347+
@Deprecated
348+
@Nullable
349+
public StreamInfoItemsCollector getRelatedStreams() throws IOException, ExtractionException {
350+
InfoItemsCollector<?, ?> collector = getRelatedItems();
351+
if (collector instanceof StreamInfoItemsCollector) {
352+
return (StreamInfoItemsCollector) collector;
353+
} else return null;
354+
}
355+
340356
/**
341357
* Should return a list of Frameset object that contains preview of stream frames
342358
*

extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfo.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,10 +606,26 @@ public List<InfoItem> getRelatedItems() {
606606
return relatedItems;
607607
}
608608

609+
/**
610+
* @deprecated Use {@link #getRelatedItems()}
611+
*/
612+
@Deprecated
613+
public List<InfoItem> getRelatedStreams() {
614+
return getRelatedItems();
615+
}
616+
609617
public void setRelatedItems(List<InfoItem> relatedItems) {
610618
this.relatedItems = relatedItems;
611619
}
612620

621+
/**
622+
* @deprecated Use {@link #setRelatedItems(List)}
623+
*/
624+
@Deprecated
625+
public void setRelatedStreams(List<InfoItem> relatedItems) {
626+
setRelatedItems(relatedItems);
627+
}
628+
613629
public long getStartPosition() {
614630
return startPosition;
615631
}

extractor/src/main/java/org/schabi/newpipe/extractor/utils/ExtractorHelper.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,12 @@ public static List<InfoItem> getRelatedItemsOrLogError(StreamInfo info, StreamEx
4141
}
4242
}
4343

44+
/**
45+
* @deprecated Use {@link #getRelatedItemsOrLogError(StreamInfo, StreamExtractor)}
46+
*/
47+
@Deprecated
48+
public static List<InfoItem> getRelatedVideosOrLogError(StreamInfo info, StreamExtractor extractor) {
49+
return getRelatedItemsOrLogError(info, extractor);
50+
}
51+
4452
}

0 commit comments

Comments
 (0)