mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-05-16 07:16:34 +03:00
Fix insertAfterCurrent, Fix getUri
This commit is contained in:
parent
dd65a12b53
commit
46fb7664c3
@ -138,6 +138,8 @@ open class APIDataSource private constructor(
|
||||
val bitrate = components[1].toInt()
|
||||
|
||||
Timber.i("DATASOURCE: %s", "Start")
|
||||
// FIXME
|
||||
// WRONG API CLIENT
|
||||
val request = subsonicAPIClient.api.stream(id, bitrate, offset = 0)
|
||||
val response: retrofit2.Response<ResponseBody>?
|
||||
val streamResponse: StreamResponse
|
||||
|
@ -107,7 +107,6 @@ class AutoMediaBrowserCallback(var player: Player) :
|
||||
private val useId3Tags get() = Settings.shouldUseId3Tags
|
||||
private val musicFolderId get() = activeServerProvider.getActiveServer().musicFolderId
|
||||
|
||||
|
||||
/**
|
||||
* Called when a {@link MediaBrowser} requests the root {@link MediaItem} by {@link
|
||||
* MediaBrowser#getLibraryRoot(LibraryParams)}.
|
||||
@ -162,7 +161,9 @@ class AutoMediaBrowserCallback(var player: Player) :
|
||||
): ListenableFuture<LibraryResult<MediaItem>> {
|
||||
playFromMediaId(mediaId)
|
||||
|
||||
// TODO: Later
|
||||
// FIXME:
|
||||
// Create LRU Cache of MediaItems, fill it in the other calls
|
||||
// and retrieve it here.
|
||||
return Futures.immediateFuture(
|
||||
LibraryResult.ofError(LibraryResult.RESULT_ERROR_BAD_VALUE)
|
||||
)
|
||||
@ -215,7 +216,6 @@ class AutoMediaBrowserCallback(var player: Player) :
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Suppress("ReturnCount", "ComplexMethod")
|
||||
fun onLoadChildren(
|
||||
parentId: String,
|
||||
@ -300,7 +300,6 @@ class AutoMediaBrowserCallback(var player: Player) :
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Suppress("MagicNumber", "ComplexMethod")
|
||||
private fun playFromMediaId(mediaId: String?) {
|
||||
Timber.d(
|
||||
@ -1083,7 +1082,6 @@ class AutoMediaBrowserCallback(var player: Player) :
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun buildMediaItemFromTrack(
|
||||
track: Track,
|
||||
mediaId: String,
|
||||
@ -1129,5 +1127,4 @@ class AutoMediaBrowserCallback(var player: Player) :
|
||||
.setUri(sourceUri)
|
||||
.build()
|
||||
}
|
||||
|
||||
}
|
@ -147,8 +147,12 @@ class CachedDataSource(
|
||||
return read
|
||||
}
|
||||
|
||||
/*
|
||||
* This method is called by StatsDataSource to verify that the loading succeeded,
|
||||
* so its important that we return the correct value here..
|
||||
*/
|
||||
override fun getUri(): Uri? {
|
||||
return cachePath?.toUri()
|
||||
return cachePath?.toUri() ?: upstreamDataSource.uri
|
||||
}
|
||||
|
||||
override fun close() {
|
||||
@ -174,6 +178,7 @@ class CachedDataSource(
|
||||
if (!found) return -1
|
||||
|
||||
cachePath = filePath
|
||||
openedFile = true
|
||||
|
||||
cacheFile = Storage.getFromPath(filePath)!!
|
||||
responseByteStream = cacheFile!!.getFileInputStream()
|
||||
|
@ -366,7 +366,7 @@ class MediaPlayerController(
|
||||
when (insertionMode) {
|
||||
InsertionMode.CLEAR -> clear()
|
||||
InsertionMode.APPEND -> insertAt = mediaItemCount
|
||||
InsertionMode.AFTER_CURRENT -> insertAt = currentMediaItemIndex
|
||||
InsertionMode.AFTER_CURRENT -> insertAt = currentMediaItemIndex + 1
|
||||
}
|
||||
|
||||
val mediaItems: List<MediaItem> = songs.map {
|
||||
|
@ -39,8 +39,8 @@ class DownloadHandler(
|
||||
val onValid = Runnable {
|
||||
// TODO: The logic here is different than in the controller...
|
||||
val insertionMode = when {
|
||||
append -> MediaPlayerController.InsertionMode.APPEND
|
||||
playNext -> MediaPlayerController.InsertionMode.AFTER_CURRENT
|
||||
append -> MediaPlayerController.InsertionMode.APPEND
|
||||
else -> MediaPlayerController.InsertionMode.CLEAR
|
||||
}
|
||||
|
||||
|
@ -33,13 +33,6 @@ import android.view.Gravity
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.AnyRes
|
||||
import org.moire.ultrasonic.R
|
||||
import org.moire.ultrasonic.app.UApp.Companion.applicationContext
|
||||
import org.moire.ultrasonic.domain.Bookmark
|
||||
import org.moire.ultrasonic.domain.MusicDirectory
|
||||
import org.moire.ultrasonic.domain.SearchResult
|
||||
import org.moire.ultrasonic.domain.Track
|
||||
import timber.log.Timber
|
||||
import java.io.Closeable
|
||||
import java.io.UnsupportedEncodingException
|
||||
import java.security.MessageDigest
|
||||
@ -49,6 +42,13 @@ import java.util.concurrent.TimeUnit
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
import kotlin.math.roundToInt
|
||||
import org.moire.ultrasonic.R
|
||||
import org.moire.ultrasonic.app.UApp.Companion.applicationContext
|
||||
import org.moire.ultrasonic.domain.Bookmark
|
||||
import org.moire.ultrasonic.domain.MusicDirectory
|
||||
import org.moire.ultrasonic.domain.SearchResult
|
||||
import org.moire.ultrasonic.domain.Track
|
||||
import timber.log.Timber
|
||||
|
||||
private const val LINE_LENGTH = 60
|
||||
private const val DEGRADE_PRECISION_AFTER = 10
|
||||
|
Loading…
x
Reference in New Issue
Block a user