Skip to content

Commit

Permalink
media browser: kotlin fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
haggaie committed Sep 5, 2024
1 parent 1498cc0 commit ae071ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class PlayerService : MediaBrowserServiceCompat() {
private var mediaBrowserConnector: MediaBrowserConnector? = null
get() {
if (field == null) {
return MediaBrowserConnector(this)
field = MediaBrowserConnector(this)
}
return field
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit ae071ba

Please sign in to comment.