mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-17 00:01:16 +02:00
Fix:Android auto load libraries handle no libraries returned, Update:Local media items cover images width alignment #279
This commit is contained in:
parent
2a87f1de28
commit
fd134097a1
3 changed files with 30 additions and 19 deletions
|
@ -236,32 +236,37 @@ class MediaManager(var apiHandler: ApiHandler, var ctx: Context) {
|
||||||
serverConfigIdUsed = DeviceManager.serverConnectionConfigId
|
serverConfigIdUsed = DeviceManager.serverConnectionConfigId
|
||||||
|
|
||||||
loadLibraries { libraries ->
|
loadLibraries { libraries ->
|
||||||
val library = libraries[0]
|
if (libraries.isEmpty()) {
|
||||||
Log.d(tag, "Loading categories for library ${library.name} - ${library.id} - ${library.mediaType}")
|
Log.w(tag, "No libraries returned from server request")
|
||||||
|
cb(cats) // Return download category only
|
||||||
|
} else {
|
||||||
|
val library = libraries[0]
|
||||||
|
Log.d(tag, "Loading categories for library ${library.name} - ${library.id} - ${library.mediaType}")
|
||||||
|
|
||||||
loadLibraryCategories(library.id) { libraryCategories ->
|
loadLibraryCategories(library.id) { libraryCategories ->
|
||||||
|
|
||||||
// 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
|
// Add items in continue listening to serverLibraryItems
|
||||||
if (it.id == "continue-listening") {
|
if (it.id == "continue-listening") {
|
||||||
it.entities.forEach { libraryItemWrapper ->
|
it.entities.forEach { libraryItemWrapper ->
|
||||||
val libraryItem = libraryItemWrapper as LibraryItem
|
val libraryItem = libraryItemWrapper as LibraryItem
|
||||||
if (serverLibraryItems.find { li -> li.id == libraryItem.id } == null) {
|
if (serverLibraryItems.find { li -> li.id == libraryItem.id } == null) {
|
||||||
serverLibraryItems.add(libraryItem)
|
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}")
|
||||||
|
cats.add(it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log.d(tag, "Found library category ${it.label} with type ${it.type}")
|
cb(cats)
|
||||||
if (it.type == library.mediaType) {
|
|
||||||
// Log.d(tag, "Using library category ${it.id}")
|
|
||||||
cats.add(it)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cb(cats)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // Not connected/no internet sent downloaded cats only
|
} else { // Not connected/no internet sent downloaded cats only
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<div v-else class="w-full media-item-container overflow-y-auto">
|
<div v-else class="w-full media-item-container overflow-y-auto">
|
||||||
<template v-for="mediaItem in localLibraryItems">
|
<template v-for="mediaItem in localLibraryItems">
|
||||||
<nuxt-link :to="`/localMedia/item/${mediaItem.id}`" :key="mediaItem.id" class="flex my-1">
|
<nuxt-link :to="`/localMedia/item/${mediaItem.id}`" :key="mediaItem.id" class="flex my-1">
|
||||||
<div class="w-12 h-12 bg-primary">
|
<div class="w-12 h-12 min-w-12 min-h-12 bg-primary">
|
||||||
<img v-if="mediaItem.coverPathSrc" :src="mediaItem.coverPathSrc" class="w-full h-full object-contain" />
|
<img v-if="mediaItem.coverPathSrc" :src="mediaItem.coverPathSrc" class="w-full h-full object-contain" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-grow px-2">
|
<div class="flex-grow px-2">
|
||||||
|
|
|
@ -39,6 +39,12 @@ module.exports = {
|
||||||
},
|
},
|
||||||
maxWidth: {
|
maxWidth: {
|
||||||
'24': '6rem'
|
'24': '6rem'
|
||||||
|
},
|
||||||
|
minWidth: {
|
||||||
|
'12': '3rem'
|
||||||
|
},
|
||||||
|
minHeight: {
|
||||||
|
'12': '3rem'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue