Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ buildscript {
}

plugins {
id 'com.android.application' version '8.10.0' apply false
id 'com.android.library' version '8.10.0' apply false
id 'com.android.application' version '8.10.1' apply false
id 'com.android.library' version '8.10.1' apply false
id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false
id 'org.jetbrains.kotlin.plugin.compose' version "$kotlin_version" apply false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ class LiveMediaCenterConnection(
}

override fun promiseItems(itemId: KeyedIdentifier?): Promise<List<IItem>> = when (itemId) {
is ItemId -> ItemFilePromise(itemId)
null -> ItemFilePromise(null)
is ItemId -> ItemListPromise(itemId)
null -> ItemListPromise(null)
else -> Promise(emptyList())
}

Expand Down Expand Up @@ -411,7 +411,7 @@ class LiveMediaCenterConnection(
CancellationException("Getting file properties cancelled for $serviceFile.")
}

private inner class ItemFilePromise(
private inner class ItemListPromise(
itemId: ItemId?,
) : Promise.Proxy<List<IItem>>(), PromisedResponse<Document, List<IItem>> {
init {
Expand Down Expand Up @@ -449,7 +449,10 @@ class LiveMediaCenterConnection(
.getElementsByTag("Item")
.map { el ->
if (cs.isCancelled) throw itemParsingCancelledException()
Item(el.wholeOwnText(), el.attr("Name"))

val maybePlaylistId = el.attr("PlaylistID").takeIf { it.isNotEmpty() }?.let(::PlaylistId)

Item(el.wholeOwnText(), el.attr("Name"), maybePlaylistId)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.lasthopesoftware.TestUrl
import com.lasthopesoftware.bluewater.client.browsing.items.IItem
import com.lasthopesoftware.bluewater.client.browsing.items.Item
import com.lasthopesoftware.bluewater.client.browsing.items.ItemId
import com.lasthopesoftware.bluewater.client.browsing.items.playlists.PlaylistId
import com.lasthopesoftware.bluewater.client.connection.MediaCenterConnectionDetails
import com.lasthopesoftware.bluewater.client.connection.live.LiveMediaCenterConnection
import com.lasthopesoftware.bluewater.client.connection.requests.FakeHttpConnection
Expand Down Expand Up @@ -44,6 +45,7 @@ class WhenGettingTheItems {
<Item Name="Hurray For The Riff Raff">1973</Item>
<Item Name="Shakey Graves">2221</Item>
<Item Name="The Shins">2222</Item>
<Item Name="Task -- No images" Type="3" PlaylistID="921167006">1025</Item>
</Response>
""".encodeToByteArray().inputStream()
)
Expand Down Expand Up @@ -78,6 +80,7 @@ class WhenGettingTheItems {
Item(key="1973", value="Hurray For The Riff Raff", playlistId=null),
Item(key="2221", value="Shakey Graves", playlistId=null),
Item(key="2222", value="The Shins", playlistId=null),
Item(key="1025", value="Task -- No images", playlistId= PlaylistId("921167006")),
)
}
}