Rename Stream's baseUrl to manifestUrl
This commit is contained in:
parent
cfc13f4a6f
commit
2321822844
5 changed files with 54 additions and 86 deletions
|
@ -570,7 +570,7 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
|||
.setDeliveryMethod(DeliveryMethod.HLS)
|
||||
.setMediaFormat(format)
|
||||
.setAverageBitrate(UNKNOWN_BITRATE)
|
||||
.setBaseUrl(playlistUrl)
|
||||
.setManifestUrl(playlistUrl)
|
||||
.build();
|
||||
if (!Stream.containSimilarStream(audioStream, audioStreams)) {
|
||||
audioStreams.add(audioStream);
|
||||
|
@ -623,7 +623,7 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
|||
.setDeliveryMethod(DeliveryMethod.HLS)
|
||||
.setResolution(resolution)
|
||||
.setMediaFormat(format)
|
||||
.setBaseUrl(playlistUrl)
|
||||
.setManifestUrl(playlistUrl)
|
||||
.build();
|
||||
if (!Stream.containSimilarStream(videoStream, videoStreams)) {
|
||||
videoStreams.add(videoStream);
|
||||
|
|
|
@ -56,7 +56,7 @@ public final class AudioStream extends Stream {
|
|||
@Nullable
|
||||
private MediaFormat mediaFormat;
|
||||
@Nullable
|
||||
private String baseUrl;
|
||||
private String manifestUrl;
|
||||
private int averageBitrate = UNKNOWN_BITRATE;
|
||||
@Nullable
|
||||
private ItagItem itagItem;
|
||||
|
@ -148,22 +148,13 @@ public final class AudioStream extends Stream {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the base URL of the {@link AudioStream}.
|
||||
* Sets the URL of the manifest this stream comes from (if applicable, otherwise null).
|
||||
*
|
||||
* <p>
|
||||
* For non-URL contents, the base URL is, for instance, a link to the DASH or HLS manifest
|
||||
* from which the URLs have been parsed.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The default value is {@code null}.
|
||||
* </p>
|
||||
*
|
||||
* @param baseUrl the base URL of the {@link AudioStream}, which can be null
|
||||
* @param manifestUrl the URL of the manifest this stream comes from or {@code null}
|
||||
* @return this {@link Builder} instance
|
||||
*/
|
||||
public Builder setBaseUrl(@Nullable final String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
public Builder setManifestUrl(@Nullable final String manifestUrl) {
|
||||
this.manifestUrl = manifestUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -236,7 +227,7 @@ public final class AudioStream extends Stream {
|
|||
}
|
||||
|
||||
return new AudioStream(id, content, isUrl, mediaFormat, deliveryMethod, averageBitrate,
|
||||
baseUrl, itagItem);
|
||||
manifestUrl, itagItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -255,8 +246,8 @@ public final class AudioStream extends Stream {
|
|||
* @param averageBitrate the average bitrate of the stream (which can be unknown, see
|
||||
* {@link #UNKNOWN_BITRATE})
|
||||
* @param itagItem the {@link ItagItem} corresponding to the stream, which cannot be null
|
||||
* @param baseUrl the base URL of the stream (see {@link Stream#getBaseUrl()} for more
|
||||
* information)
|
||||
* @param manifestUrl the URL of the manifest this stream comes from (if applicable,
|
||||
* otherwise null)
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:ParameterNumber")
|
||||
private AudioStream(@Nonnull final String id,
|
||||
|
@ -265,9 +256,9 @@ public final class AudioStream extends Stream {
|
|||
@Nullable final MediaFormat format,
|
||||
@Nonnull final DeliveryMethod deliveryMethod,
|
||||
final int averageBitrate,
|
||||
@Nullable final String baseUrl,
|
||||
@Nullable final String manifestUrl,
|
||||
@Nullable final ItagItem itagItem) {
|
||||
super(id, content, isUrl, format, deliveryMethod, baseUrl);
|
||||
super(id, content, isUrl, format, deliveryMethod, manifestUrl);
|
||||
if (itagItem != null) {
|
||||
this.itagItem = itagItem;
|
||||
this.itag = itagItem.id;
|
||||
|
|
|
@ -33,7 +33,7 @@ public abstract class Stream implements Serializable {
|
|||
private final String content;
|
||||
private final boolean isUrl;
|
||||
private final DeliveryMethod deliveryMethod;
|
||||
@Nullable private final String baseUrl;
|
||||
@Nullable private final String manifestUrl;
|
||||
|
||||
/**
|
||||
* Instantiates a new {@code Stream} object.
|
||||
|
@ -45,21 +45,21 @@ public abstract class Stream implements Serializable {
|
|||
* manifest
|
||||
* @param format the {@link MediaFormat}, which can be null
|
||||
* @param deliveryMethod the delivery method of the stream
|
||||
* @param baseUrl the base URL of the content if the stream is a DASH or an HLS
|
||||
* manifest, which can be null
|
||||
* @param manifestUrl the URL of the manifest this stream comes from (if applicable,
|
||||
* otherwise null)
|
||||
*/
|
||||
public Stream(final String id,
|
||||
final String content,
|
||||
final boolean isUrl,
|
||||
@Nullable final MediaFormat format,
|
||||
final DeliveryMethod deliveryMethod,
|
||||
@Nullable final String baseUrl) {
|
||||
@Nullable final String manifestUrl) {
|
||||
this.id = id;
|
||||
this.content = content;
|
||||
this.isUrl = isUrl;
|
||||
this.mediaFormat = format;
|
||||
this.deliveryMethod = deliveryMethod;
|
||||
this.baseUrl = baseUrl;
|
||||
this.manifestUrl = manifestUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -184,7 +184,7 @@ public abstract class Stream implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the delivery method.
|
||||
* Gets the {@link DeliveryMethod}.
|
||||
*
|
||||
* @return the delivery method
|
||||
*/
|
||||
|
@ -194,18 +194,13 @@ public abstract class Stream implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the base URL of a stream.
|
||||
* Gets the URL of the manifest this stream comes from (if applicable, otherwise null).
|
||||
*
|
||||
* <p>
|
||||
* If the stream is not a DASH stream or an HLS stream, this value will always be null.
|
||||
* It may also be null for these streams too.
|
||||
* </p>
|
||||
*
|
||||
* @return the base URL of the stream or {@code null}
|
||||
* @return the URL of the manifest this stream comes from or {@code null}
|
||||
*/
|
||||
@Nullable
|
||||
public String getBaseUrl() {
|
||||
return baseUrl;
|
||||
public String getManifestUrl() {
|
||||
return manifestUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -235,11 +230,11 @@ public abstract class Stream implements Serializable {
|
|||
&& deliveryMethod == stream.deliveryMethod
|
||||
&& content.equals(stream.content)
|
||||
&& isUrl == stream.isUrl
|
||||
&& Objects.equals(baseUrl, stream.baseUrl);
|
||||
&& Objects.equals(manifestUrl, stream.manifestUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, mediaFormat, deliveryMethod, content, isUrl, baseUrl);
|
||||
return Objects.hash(id, mediaFormat, deliveryMethod, content, isUrl, manifestUrl);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public final class SubtitlesStream extends Stream {
|
|||
@Nullable
|
||||
private MediaFormat mediaFormat;
|
||||
@Nullable
|
||||
private String baseUrl;
|
||||
private String manifestUrl;
|
||||
private String languageCode;
|
||||
// Use of the Boolean class instead of the primitive type needed for setter call check
|
||||
private Boolean autoGenerated;
|
||||
|
@ -116,22 +116,13 @@ public final class SubtitlesStream extends Stream {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the base URL of the {@link SubtitlesStream}.
|
||||
* Sets the URL of the manifest this stream comes from (if applicable, otherwise null).
|
||||
*
|
||||
* <p>
|
||||
* For non-URL contents, the base URL is, for instance, a link to the DASH or HLS manifest
|
||||
* from which the URLs have been parsed.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The default value is {@code null}.
|
||||
* </p>
|
||||
*
|
||||
* @param baseUrl the base URL of the {@link SubtitlesStream}, which can be null
|
||||
* @param manifestUrl the URL of the manifest this stream comes from or {@code null}
|
||||
* @return this {@link Builder} instance
|
||||
*/
|
||||
public Builder setBaseUrl(@Nullable final String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
public Builder setManifestUrl(@Nullable final String manifestUrl) {
|
||||
this.manifestUrl = manifestUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -212,25 +203,25 @@ public final class SubtitlesStream extends Stream {
|
|||
}
|
||||
|
||||
return new SubtitlesStream(id, content, isUrl, mediaFormat, deliveryMethod,
|
||||
languageCode, autoGenerated, baseUrl);
|
||||
languageCode, autoGenerated, manifestUrl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subtitles stream.
|
||||
*
|
||||
* @param id the identifier which uniquely identifies the stream, e.g. for YouTube
|
||||
* this would be the itag
|
||||
* @param content the content or the URL of the stream, depending on whether isUrl is
|
||||
* true
|
||||
* @param isUrl whether content is the URL or the actual content of e.g. a DASH
|
||||
* manifest
|
||||
* @param mediaFormat the {@link MediaFormat} used by the stream
|
||||
* @param deliveryMethod the {@link DeliveryMethod} of the stream
|
||||
* @param languageCode the language code of the stream
|
||||
* @param autoGenerated whether the subtitles are auto-generated by the streaming service
|
||||
* @param baseUrl the base URL of the stream (see {@link Stream#getBaseUrl()} for more
|
||||
* information)
|
||||
* @param id the identifier which uniquely identifies the stream, e.g. for YouTube
|
||||
* this would be the itag
|
||||
* @param content the content or the URL of the stream, depending on whether isUrl is
|
||||
* true
|
||||
* @param isUrl whether content is the URL or the actual content of e.g. a DASH
|
||||
* manifest
|
||||
* @param mediaFormat the {@link MediaFormat} used by the stream
|
||||
* @param deliveryMethod the {@link DeliveryMethod} of the stream
|
||||
* @param languageCode the language code of the stream
|
||||
* @param autoGenerated whether the subtitles are auto-generated by the streaming service
|
||||
* @param manifestUrl the URL of the manifest this stream comes from (if applicable,
|
||||
* otherwise null)
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:ParameterNumber")
|
||||
private SubtitlesStream(@Nonnull final String id,
|
||||
|
@ -240,8 +231,8 @@ public final class SubtitlesStream extends Stream {
|
|||
@Nonnull final DeliveryMethod deliveryMethod,
|
||||
@Nonnull final String languageCode,
|
||||
final boolean autoGenerated,
|
||||
@Nullable final String baseUrl) {
|
||||
super(id, content, isUrl, mediaFormat, deliveryMethod, baseUrl);
|
||||
@Nullable final String manifestUrl) {
|
||||
super(id, content, isUrl, mediaFormat, deliveryMethod, manifestUrl);
|
||||
|
||||
/*
|
||||
* Locale.forLanguageTag only for Android API >= 21
|
||||
|
|
|
@ -64,7 +64,7 @@ public final class VideoStream extends Stream {
|
|||
@Nullable
|
||||
private MediaFormat mediaFormat;
|
||||
@Nullable
|
||||
private String baseUrl;
|
||||
private String manifestUrl;
|
||||
// Use of the Boolean class instead of the primitive type needed for setter call check
|
||||
private Boolean isVideoOnly;
|
||||
private String resolution;
|
||||
|
@ -157,22 +157,13 @@ public final class VideoStream extends Stream {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the base URL of the {@link VideoStream}.
|
||||
* Sets the URL of the manifest this stream comes from (if applicable, otherwise null).
|
||||
*
|
||||
* <p>
|
||||
* For non-URL contents, the base URL is, for instance, a link to the DASH or HLS manifest
|
||||
* from which the URLs have been parsed.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The default value is {@code null}.
|
||||
* </p>
|
||||
*
|
||||
* @param baseUrl the base URL of the {@link VideoStream}, which can be null
|
||||
* @param manifestUrl the URL of the manifest this stream comes from or {@code null}
|
||||
* @return this {@link Builder} instance
|
||||
*/
|
||||
public Builder setBaseUrl(@Nullable final String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
public Builder setManifestUrl(@Nullable final String manifestUrl) {
|
||||
this.manifestUrl = manifestUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -282,7 +273,7 @@ public final class VideoStream extends Stream {
|
|||
}
|
||||
|
||||
return new VideoStream(id, content, isUrl, mediaFormat, deliveryMethod, resolution,
|
||||
isVideoOnly, baseUrl, itagItem);
|
||||
isVideoOnly, manifestUrl, itagItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -300,8 +291,8 @@ public final class VideoStream extends Stream {
|
|||
* @param resolution the resolution of the stream
|
||||
* @param isVideoOnly whether the stream is video-only
|
||||
* @param itagItem the {@link ItagItem} corresponding to the stream, which cannot be null
|
||||
* @param baseUrl the base URL of the stream (see {@link Stream#getBaseUrl()} for more
|
||||
* information)
|
||||
* @param manifestUrl the URL of the manifest this stream comes from (if applicable,
|
||||
* otherwise null)
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:ParameterNumber")
|
||||
private VideoStream(@Nonnull final String id,
|
||||
|
@ -311,9 +302,9 @@ public final class VideoStream extends Stream {
|
|||
@Nonnull final DeliveryMethod deliveryMethod,
|
||||
@Nonnull final String resolution,
|
||||
final boolean isVideoOnly,
|
||||
@Nullable final String baseUrl,
|
||||
@Nullable final String manifestUrl,
|
||||
@Nullable final ItagItem itagItem) {
|
||||
super(id, content, isUrl, format, deliveryMethod, baseUrl);
|
||||
super(id, content, isUrl, format, deliveryMethod, manifestUrl);
|
||||
if (itagItem != null) {
|
||||
this.itagItem = itagItem;
|
||||
this.itag = itagItem.id;
|
||||
|
|
Loading…
Reference in a new issue