-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # api-client/build.gradle.kts # build.gradle.kts
- Loading branch information
Showing
36 changed files
with
265 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
version = "0.10" | ||
version = "0.11" | ||
|
||
val retrofitVersion = "2.11.0" | ||
val jacksonVersion = "2.17.0" | ||
|
||
dependencies { | ||
api(platform("com.squareup.okhttp3:okhttp-bom:4.12.0")) | ||
api("com.google.code.gson:gson:2.11.0") // patch for CVE-2022-25647 | ||
api("com.squareup.okhttp3:logging-interceptor") | ||
api("com.squareup.okhttp3:okhttp-dnsoverhttps") | ||
api("com.squareup.retrofit2:retrofit:2.11.0") | ||
api("com.squareup.retrofit2:adapter-rxjava3:2.11.0") | ||
api("com.squareup.retrofit2:converter-gson:2.11.0") | ||
api("com.squareup.retrofit2:retrofit:$retrofitVersion") | ||
api("com.squareup.retrofit2:adapter-rxjava3:$retrofitVersion") | ||
api("com.squareup.retrofit2:converter-jackson:$retrofitVersion") | ||
api("com.fasterxml.jackson.core:jackson-core:$jacksonVersion") | ||
api("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
api-client/src/main/kotlin/online/hudacek/fxradio/apiclient/musicbrainz/model/Artist.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
package online.hudacek.fxradio.apiclient.musicbrainz.model | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
data class Artist( | ||
val id: String, | ||
val name: String, | ||
val disambiguation: String | ||
val disambiguation: String? | ||
) |
3 changes: 3 additions & 0 deletions
3
...client/src/main/kotlin/online/hudacek/fxradio/apiclient/musicbrainz/model/ArtistCredit.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
api-client/src/main/kotlin/online/hudacek/fxradio/apiclient/musicbrainz/model/Release.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
package online.hudacek.fxradio.apiclient.musicbrainz.model | ||
|
||
import com.google.gson.annotations.SerializedName | ||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import com.fasterxml.jackson.annotation.JsonProperty | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
data class Release( | ||
val id: String, | ||
val score: Int, | ||
val title: String, | ||
val status: String, | ||
@SerializedName("artist-credit") val artistCredit: List<ArtistCredit> | ||
val status: String?, | ||
@JsonProperty("artist-credit") val artistCredit: List<ArtistCredit> | ||
) |
3 changes: 3 additions & 0 deletions
3
...client/src/main/kotlin/online/hudacek/fxradio/apiclient/musicbrainz/model/SearchResult.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
api-client/src/main/kotlin/online/hudacek/fxradio/apiclient/radiobrowser/model/Tag.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package online.hudacek.fxradio.apiclient.radiobrowser.model | ||
|
||
import com.google.gson.annotations.SerializedName | ||
import com.fasterxml.jackson.annotation.JsonProperty | ||
|
||
data class Tag(val name: String, @SerializedName("stationcount") val stationCount: Int) | ||
data class Tag(val name: String, @JsonProperty("stationcount") val stationCount: Int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/kotlin/online/hudacek/fxradio/persistence/database/ConnectionManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package online.hudacek.fxradio.persistence.database | ||
|
||
import io.reactivex.rxjava3.schedulers.Schedulers | ||
import online.hudacek.fxradio.Config | ||
import org.davidmoten.rxjava3.jdbc.Database | ||
import org.davidmoten.rxjava3.jdbc.pool.Pools | ||
import org.flywaydb.core.Flyway | ||
import java.util.concurrent.Executors | ||
|
||
private const val DB_POOLS = 5 | ||
|
||
class ConnectionManager(private val dbUrl: String) { | ||
|
||
// Workaround for https://github.com/davidmoten/rxjava2-jdbc/issues/51 | ||
private val executor = Executors.newFixedThreadPool(DB_POOLS) | ||
|
||
private val pools = Pools.nonBlocking() | ||
.url(dbUrl) | ||
.maxPoolSize(DB_POOLS) | ||
.scheduler(Schedulers.from(executor)) | ||
.build() | ||
|
||
/** | ||
* Establishes connection to SQLite db with [dbUrl] | ||
* Performs flyway migrations for the given database | ||
*/ | ||
val database: Database by lazy { | ||
Database.from(pools).also { | ||
Flyway.configure().dataSource(dbUrl, null, null).load().also { | ||
it.migrate() | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Closes connection to DB | ||
*/ | ||
fun close() { | ||
database.close() | ||
executor.shutdownNow() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.