feat(library): extract track duration via ffprobe #13

Merged
bvandeusen merged 262 commits from dev into main 2026-04-20 08:11:10 -04:00
4 changed files with 24 additions and 1 deletions
Showing only changes of commit 415200d8f0 - Show all commits
@@ -43,6 +43,9 @@ class AuthStore @Inject constructor(
private val themeModeState = MutableStateFlow<String?>(null)
val themeMode: StateFlow<String?> = themeModeState.asStateFlow()
private val clientIdState = MutableStateFlow<String?>(null)
val clientId: StateFlow<String?> = clientIdState.asStateFlow()
init {
scope.launch {
dao.observe().collect { row ->
@@ -50,6 +53,7 @@ class AuthStore @Inject constructor(
baseUrlState.value = row?.baseUrl ?: DEFAULT_BASE_URL
userJsonState.value = row?.userJson
themeModeState.value = row?.themeMode
clientIdState.value = row?.clientId
}
}
}
@@ -74,6 +78,11 @@ class AuthStore @Inject constructor(
scope.launch { persistThemeMode(value) }
}
fun setClientId(value: String?) {
clientIdState.value = value
scope.launch { persistClientId(value) }
}
private suspend fun persistCookie(value: String?) {
if (dao.get() == null) {
dao.upsert(currentEntity().copy(sessionCookie = value))
@@ -106,12 +115,21 @@ class AuthStore @Inject constructor(
}
}
private suspend fun persistClientId(value: String?) {
if (dao.get() == null) {
dao.upsert(currentEntity().copy(clientId = value))
} else {
dao.setClientId(value)
}
}
private fun currentEntity(): AuthSessionEntity = AuthSessionEntity(
id = ROW_ID,
sessionCookie = sessionCookieState.value,
baseUrl = baseUrlState.value,
userJson = userJsonState.value,
themeMode = themeModeState.value,
clientId = clientIdState.value,
)
companion object {
@@ -59,7 +59,7 @@ import com.fabledsword.minstrel.cache.db.entities.SyncMetadataEntity
CachedHomeIndexEntity::class,
AuthSessionEntity::class,
],
version = 3,
version = 4,
exportSchema = true,
)
@TypeConverters(MinstrelTypeConverters::class)
@@ -34,4 +34,8 @@ interface AuthSessionDao {
/** Partial update: change only the theme override ("light"/"dark"/null=system). */
@Query("UPDATE auth_session SET themeMode = :themeMode WHERE id = 0")
suspend fun setThemeMode(themeMode: String?)
/** Partial update: change only the stable client install id. */
@Query("UPDATE auth_session SET clientId = :clientId WHERE id = 0")
suspend fun setClientId(clientId: String?)
}
@@ -28,4 +28,5 @@ data class AuthSessionEntity(
val baseUrl: String,
val userJson: String? = null,
val themeMode: String? = null,
val clientId: String? = null,
)