mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-04 01:54:33 +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 {
|
||||
apiHandler.getLibraryItems(libraryId) { libraryItems ->
|
||||
val libraryItemsWithAudio = libraryItems.filter { li -> li.checkHasTracks() }
|
||||
if (libraryItemsWithAudio.isNotEmpty()) selectedLibraryId = libraryId
|
||||
if (libraryItemsWithAudio.isNotEmpty()) {
|
||||
selectedLibraryId = libraryId
|
||||
}
|
||||
|
||||
serverLibraryItems = mutableListOf()
|
||||
libraryItemsWithAudio.forEach { libraryItem ->
|
||||
if (serverLibraryItems.find { li -> li.id == libraryItem.id } == null) {
|
||||
serverLibraryItems.add(libraryItem)
|
||||
}
|
||||
}
|
||||
cb(libraryItemsWithAudio)
|
||||
}
|
||||
|
@ -307,17 +308,6 @@ class MediaManager(var apiHandler: ApiHandler, var ctx: Context) {
|
|||
|
||||
// Only using book or podcast library categories for now
|
||||
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}")
|
||||
if (it.type == library.mediaType) {
|
||||
// Log.d(tag, "Using library category ${it.id}")
|
||||
|
|
|
@ -863,7 +863,7 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
|
|||
result.sendResult(localBrowseItems)
|
||||
|
||||
} else { // Load categories
|
||||
mediaManager.loadAndroidAutoItems() { libraryCategories ->
|
||||
mediaManager.loadAndroidAutoItems { libraryCategories ->
|
||||
browseTree = BrowseTree(this, libraryCategories, mediaManager.serverLibraries)
|
||||
|
||||
val children = browseTree[parentMediaId]?.map { item ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue