mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-16 15:52:26 +02:00
Fix:Android auto library items mixing with other libraries #309
This commit is contained in:
parent
34d4a0b61b
commit
c1b8f8519f
2 changed files with 5 additions and 15 deletions
|
@ -95,12 +95,13 @@ class MediaManager(var apiHandler: ApiHandler, var ctx: Context) {
|
||||||
} else {
|
} else {
|
||||||
apiHandler.getLibraryItems(libraryId) { libraryItems ->
|
apiHandler.getLibraryItems(libraryId) { libraryItems ->
|
||||||
val libraryItemsWithAudio = libraryItems.filter { li -> li.checkHasTracks() }
|
val libraryItemsWithAudio = libraryItems.filter { li -> li.checkHasTracks() }
|
||||||
if (libraryItemsWithAudio.isNotEmpty()) selectedLibraryId = libraryId
|
if (libraryItemsWithAudio.isNotEmpty()) {
|
||||||
|
selectedLibraryId = libraryId
|
||||||
|
}
|
||||||
|
|
||||||
|
serverLibraryItems = mutableListOf()
|
||||||
libraryItemsWithAudio.forEach { libraryItem ->
|
libraryItemsWithAudio.forEach { libraryItem ->
|
||||||
if (serverLibraryItems.find { li -> li.id == libraryItem.id } == null) {
|
|
||||||
serverLibraryItems.add(libraryItem)
|
serverLibraryItems.add(libraryItem)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
cb(libraryItemsWithAudio)
|
cb(libraryItemsWithAudio)
|
||||||
}
|
}
|
||||||
|
@ -307,17 +308,6 @@ class MediaManager(var apiHandler: ApiHandler, var ctx: Context) {
|
||||||
|
|
||||||
// Only using book or podcast library categories for now
|
// Only using book or podcast library categories for now
|
||||||
libraryCategories.forEach {
|
libraryCategories.forEach {
|
||||||
|
|
||||||
// Add items in continue listening to serverLibraryItems
|
|
||||||
if (it.id == "continue-listening") {
|
|
||||||
it.entities.forEach { libraryItemWrapper ->
|
|
||||||
val libraryItem = libraryItemWrapper as LibraryItem
|
|
||||||
if (serverLibraryItems.find { li -> li.id == libraryItem.id } == null) {
|
|
||||||
serverLibraryItems.add(libraryItem)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log.d(tag, "Found library category ${it.label} with type ${it.type}")
|
// Log.d(tag, "Found library category ${it.label} with type ${it.type}")
|
||||||
if (it.type == library.mediaType) {
|
if (it.type == library.mediaType) {
|
||||||
// Log.d(tag, "Using library category ${it.id}")
|
// Log.d(tag, "Using library category ${it.id}")
|
||||||
|
|
|
@ -863,7 +863,7 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
|
||||||
result.sendResult(localBrowseItems)
|
result.sendResult(localBrowseItems)
|
||||||
|
|
||||||
} else { // Load categories
|
} else { // Load categories
|
||||||
mediaManager.loadAndroidAutoItems() { libraryCategories ->
|
mediaManager.loadAndroidAutoItems { libraryCategories ->
|
||||||
browseTree = BrowseTree(this, libraryCategories, mediaManager.serverLibraries)
|
browseTree = BrowseTree(this, libraryCategories, mediaManager.serverLibraries)
|
||||||
|
|
||||||
val children = browseTree[parentMediaId]?.map { item ->
|
val children = browseTree[parentMediaId]?.map { item ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue