Convert /newpipe/util/StreamTypeUtil to kotlin
This commit is contained in:
parent
09e17d7540
commit
698f0ac61b
2 changed files with 54 additions and 50 deletions
|
|
@ -1,50 +0,0 @@
|
||||||
package org.schabi.newpipe.util;
|
|
||||||
|
|
||||||
import org.schabi.newpipe.extractor.stream.StreamType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Utility class for {@link StreamType}.
|
|
||||||
*/
|
|
||||||
public final class StreamTypeUtil {
|
|
||||||
private StreamTypeUtil() {
|
|
||||||
// No impl pls
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the {@link StreamType} of a stream is a livestream.
|
|
||||||
*
|
|
||||||
* @param streamType the stream type of the stream
|
|
||||||
* @return whether the stream type is {@link StreamType#AUDIO_STREAM},
|
|
||||||
* {@link StreamType#AUDIO_LIVE_STREAM} or {@link StreamType#POST_LIVE_AUDIO_STREAM}
|
|
||||||
*/
|
|
||||||
public static boolean isAudio(final StreamType streamType) {
|
|
||||||
return streamType == StreamType.AUDIO_STREAM
|
|
||||||
|| streamType == StreamType.AUDIO_LIVE_STREAM
|
|
||||||
|| streamType == StreamType.POST_LIVE_AUDIO_STREAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the {@link StreamType} of a stream is a livestream.
|
|
||||||
*
|
|
||||||
* @param streamType the stream type of the stream
|
|
||||||
* @return whether the stream type is {@link StreamType#VIDEO_STREAM},
|
|
||||||
* {@link StreamType#LIVE_STREAM} or {@link StreamType#POST_LIVE_STREAM}
|
|
||||||
*/
|
|
||||||
public static boolean isVideo(final StreamType streamType) {
|
|
||||||
return streamType == StreamType.VIDEO_STREAM
|
|
||||||
|| streamType == StreamType.LIVE_STREAM
|
|
||||||
|| streamType == StreamType.POST_LIVE_STREAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the {@link StreamType} of a stream is a livestream.
|
|
||||||
*
|
|
||||||
* @param streamType the stream type of the stream
|
|
||||||
* @return whether the stream type is {@link StreamType#LIVE_STREAM} or
|
|
||||||
* {@link StreamType#AUDIO_LIVE_STREAM}
|
|
||||||
*/
|
|
||||||
public static boolean isLiveStream(final StreamType streamType) {
|
|
||||||
return streamType == StreamType.LIVE_STREAM
|
|
||||||
|| streamType == StreamType.AUDIO_LIVE_STREAM;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
54
app/src/main/java/org/schabi/newpipe/util/StreamTypeUtil.kt
Normal file
54
app/src/main/java/org/schabi/newpipe/util/StreamTypeUtil.kt
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2021-2026 NewPipe contributors <https://newpipe.net>
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.schabi.newpipe.util
|
||||||
|
|
||||||
|
import org.schabi.newpipe.extractor.stream.StreamType
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility class for [StreamType].
|
||||||
|
*/
|
||||||
|
object StreamTypeUtil {
|
||||||
|
/**
|
||||||
|
* Check if the [StreamType] of a stream is a livestream.
|
||||||
|
*
|
||||||
|
* @param streamType the stream type of the stream
|
||||||
|
* @return whether the stream type is [StreamType.AUDIO_STREAM],
|
||||||
|
* [StreamType.AUDIO_LIVE_STREAM] or [StreamType.POST_LIVE_AUDIO_STREAM]
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun isAudio(streamType: StreamType): Boolean {
|
||||||
|
return streamType == StreamType.AUDIO_STREAM ||
|
||||||
|
streamType == StreamType.AUDIO_LIVE_STREAM ||
|
||||||
|
streamType == StreamType.POST_LIVE_AUDIO_STREAM
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the [StreamType] of a stream is a livestream.
|
||||||
|
*
|
||||||
|
* @param streamType the stream type of the stream
|
||||||
|
* @return whether the stream type is [StreamType.VIDEO_STREAM],
|
||||||
|
* [StreamType.LIVE_STREAM] or [StreamType.POST_LIVE_STREAM]
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun isVideo(streamType: StreamType): Boolean {
|
||||||
|
return streamType == StreamType.VIDEO_STREAM ||
|
||||||
|
streamType == StreamType.LIVE_STREAM ||
|
||||||
|
streamType == StreamType.POST_LIVE_STREAM
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the [StreamType] of a stream is a livestream.
|
||||||
|
*
|
||||||
|
* @param streamType the stream type of the stream
|
||||||
|
* @return whether the stream type is [StreamType.LIVE_STREAM] or
|
||||||
|
* [StreamType.AUDIO_LIVE_STREAM]
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun isLiveStream(streamType: StreamType): Boolean {
|
||||||
|
return streamType == StreamType.LIVE_STREAM ||
|
||||||
|
streamType == StreamType.AUDIO_LIVE_STREAM
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue