1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-01-08 16:30:34 +00:00

media browser: kotlin fixes

This commit is contained in:
Haggai Eran 2024-09-05 21:08:12 +03:00 committed by Siddhesh Naik
parent bf59f1e09d
commit 9f26137b9c
2 changed files with 8 additions and 5 deletions

View File

@ -58,7 +58,7 @@ class PlayerService : MediaBrowserServiceCompat() {
private var mediaBrowserConnector: MediaBrowserConnector? = null
get() {
if (field == null) {
return MediaBrowserConnector(this)
field = MediaBrowserConnector(this)
}
return field
}

View File

@ -263,7 +263,7 @@ class MediaBrowserConnector(private val playerService: PlayerService) : Playback
try {
val parentIdUri = Uri.parse(parentId)
val path = parentIdUri.pathSegments
val path = ArrayList(parentIdUri.pathSegments)
if (path.isEmpty()) {
val mediaItems: MutableList<MediaBrowserCompat.MediaItem> = ArrayList()
@ -431,7 +431,7 @@ class MediaBrowserConnector(private val playerService: PlayerService) : Playback
private fun extractPlayQueueFromMediaId(mediaId: String): Single<PlayQueue> {
try {
val mediaIdUri = Uri.parse(mediaId)
val path = mediaIdUri.pathSegments
val path = ArrayList(mediaIdUri.pathSegments)
if (path.isEmpty()) {
throw parseError()
@ -461,14 +461,17 @@ class MediaBrowserConnector(private val playerService: PlayerService) : Playback
@Throws(ContentNotAvailableException::class)
private fun extractPlayQueueFromPlaylistMediaId(
mediaIdSegments: List<String>,
mediaIdSegments: ArrayList<String>,
url: String?,
): Single<PlayQueue> {
if (mediaIdSegments.isEmpty()) {
throw parseError()
}
when (val playlistType = mediaIdSegments.first()) {
val playlistType = mediaIdSegments.first()
mediaIdSegments.removeAt(0)
when (playlistType) {
ID_LOCAL, ID_REMOTE -> {
if (mediaIdSegments.size != 2) {
throw parseError()