diff --git a/README.md b/README.md index 084719c..90b7386 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,13 @@ As caching is mandatory, it has small side effect on the seeking within current available only after the file is fully cached - this can be theoretically improved in the future, but it's not priority now. +**d)** It's designed to work with audiobooks split to files by chapters, so typical chapter/files has +duration between 10 - 90 minutes. Anything else will be suboptimal - too short files will not assure +appropriate cache ahead ( as caching is done by files). Too big files (like m4b file containing whole +audiobook) will be hard to navigate (as internal chapters are not supported), slow to transcode, +plus there is hard limit of 250MB per file (for security reasons). + + How to install -------------- diff --git a/app/build.gradle b/app/build.gradle index 1adfcf6..ac04569 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -18,8 +18,8 @@ android { applicationId "eu.zderadicka.audioserve" minSdkVersion 21 targetSdkVersion 28 - versionCode 21 - versionName "0.7.1" + versionCode 22 + versionName "0.7.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/app/src/main/java/eu/zderadicka/audioserve/AudioService.kt b/app/src/main/java/eu/zderadicka/audioserve/AudioService.kt index c924c54..68971b6 100644 --- a/app/src/main/java/eu/zderadicka/audioserve/AudioService.kt +++ b/app/src/main/java/eu/zderadicka/audioserve/AudioService.kt @@ -356,7 +356,11 @@ class AudioService : MediaBrowserServiceCompat() { scheduler.post { preparer.duplicateInQueue(path) { idx, pos -> Log.d(LOG_TAG, "Duplicted $idx,$pos, current player pos ${player.currentPosition}") - player.seekTo(idx + 1, pos) //TODO find best way for gapless seek +200 looked like better when emulated + try { + player.seekTo(idx + 1, pos) //TODO find best way for gapless seek +200 looked like better when emulated + } catch (e:IllegalSeekPositionException) { + Log.e(LOG_TAG, "Error seeking in duplicated item") + } player.playWhenReady = true deletePreviousQueueItem = idx diff --git a/app/src/main/java/eu/zderadicka/audioserve/data/Utils.kt b/app/src/main/java/eu/zderadicka/audioserve/data/Utils.kt index 43ae2ea..edf9462 100644 --- a/app/src/main/java/eu/zderadicka/audioserve/data/Utils.kt +++ b/app/src/main/java/eu/zderadicka/audioserve/data/Utils.kt @@ -70,7 +70,7 @@ fun parseFolderfromJson(data: String, name: String, path: String) :AudioFolder{ val path = o.getString("path")!! val mime = o.getString("mime")!! - val metaObject = o.getJSONObject("meta") + val metaObject = if (o.isNull("meta")) null else o.getJSONObject("meta") val meta = if (metaObject != null) { val duration = metaObject.getInt("duration") val bitrate = metaObject.getInt("bitrate") diff --git a/app/src/main/java/eu/zderadicka/audioserve/net/FileCache.kt b/app/src/main/java/eu/zderadicka/audioserve/net/FileCache.kt index ed7e64c..44797b9 100644 --- a/app/src/main/java/eu/zderadicka/audioserve/net/FileCache.kt +++ b/app/src/main/java/eu/zderadicka/audioserve/net/FileCache.kt @@ -540,7 +540,7 @@ class FileLoader(private val queue: BlockingDeque, if (contentLength > MAX_CACHED_FILE_SIZE) { Log.e(LOG_TAG, "File is bigger then max limit") complete = true - break + continue } val buf = ByteArray(LOADER_BUFFER_SIZE) stream = conn.inputStream