Skip to content

Commit

Permalink
Some small fixes for files without audio meta and too big files
Browse files Browse the repository at this point in the history
  • Loading branch information
izderadicka committed Dec 30, 2018
1 parent 14a3fba commit 9ce70f6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/java/eu/zderadicka/audioserve/AudioService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/eu/zderadicka/audioserve/data/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ class FileLoader(private val queue: BlockingDeque<CacheItem>,
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
Expand Down

0 comments on commit 9ce70f6

Please sign in to comment.