Skip to content

Commit fc5cb14

Browse files
committed
feat: Implement Radio Browser API with server status monitoring
Major changes: - Added RadioBrowserApi class with comprehensive API integration - Implemented server status monitoring with availability checks - Added support for IPv4 and IPv6 addresses with proper URL formatting - Created ServerStatusView component for displaying server information - Added player selection functionality with dependency checking - Improved error handling and logging throughout the application Technical details: - Uses Ktor client for HTTP requests with proper timeout and retry configuration - Implements coroutine-based async operations for better performance - Added comprehensive logging with SLF4J - Proper serialization handling for API responses - Thread-safe server status management with synchronization UI Components: - ServerStatusView: Displays server information with availability indicators - PlayerSelectionView: Allows selection of media players with dependency checks - StationCard: Shows detailed station information with proper formatting Core functionality: - Server discovery and mirror selection - Station search with proper error handling - Player selection with dependency verification - Stream playback support for multiple players This commit establishes the core functionality for the Radio Browser application, providing a robust foundation for radio station discovery and playback.
1 parent c458a93 commit fc5cb14

File tree

7 files changed

+504
-475
lines changed

7 files changed

+504
-475
lines changed

composeApp/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
33
plugins {
44
alias(libs.plugins.kotlinMultiplatform)
55
alias(libs.plugins.jetbrainsCompose)
6+
kotlin("plugin.serialization") version "1.9.0"
67
}
78

89
repositories {
@@ -25,6 +26,12 @@ kotlin {
2526
implementation(compose.desktop.currentOs)
2627
implementation("ch.qos.logback:logback-classic:1.4.11")
2728
implementation("org.slf4j:slf4j-api:2.0.9")
29+
implementation("io.ktor:ktor-client-core:2.3.7")
30+
implementation("io.ktor:ktor-client-cio:2.3.7")
31+
implementation("io.ktor:ktor-client-content-negotiation:2.3.7")
32+
implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.7")
33+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0")
34+
implementation("org.slf4j:slf4j-simple:2.0.9")
2835
}
2936
}
3037
val koin_version = "4.0.3"

composeApp/src/desktopMain/kotlin/player/data/repository/PlayerImpl.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package player.data.repository
22

3+
import kotlinx.coroutines.Dispatchers
34
import kotlinx.coroutines.flow.Flow
45
import kotlinx.coroutines.flow.flow
6+
import kotlinx.coroutines.withContext
57
import player.domain.repository.PlayerRepository
68
import player.util.PlayerState
79
import java.io.File
@@ -44,9 +46,11 @@ class PlayerImpl : PlayerRepository {
4446
stop()
4547
try {
4648
val command = listOf(playerPath, "-url", url, "-volume", "100")
47-
process = ProcessBuilder(command)
48-
.directory(File(System.getProperty("user.dir")))
49-
.start()
49+
process = withContext(Dispatchers.IO) {
50+
ProcessBuilder(command)
51+
.directory(File(System.getProperty("user.dir")))
52+
.start()
53+
}
5054
} catch (e: IOException) {
5155
throw RuntimeException("Failed to start player: ${e.message}")
5256
}

0 commit comments

Comments
 (0)