commit
9c117386ba
|
@ -12,7 +12,9 @@ buildscript {
|
||||||
classpath gradlePlugins.kotlin
|
classpath gradlePlugins.kotlin
|
||||||
classpath gradlePlugins.ktlintGradle
|
classpath gradlePlugins.ktlintGradle
|
||||||
classpath gradlePlugins.detekt
|
classpath gradlePlugins.detekt
|
||||||
classpath gradlePlugins.jacocoAndroid
|
classpath(gradlePlugins.jacocoAndroid) {
|
||||||
|
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +29,7 @@ allprojects {
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
|
google()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.moire.ultrasonic.cache
|
package org.moire.ultrasonic.cache
|
||||||
|
|
||||||
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should contain`
|
import org.amshove.kluent.`should contain`
|
||||||
import org.amshove.kluent.`should equal to`
|
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.moire.ultrasonic.cache.serializers.getMusicFolderSerializer
|
import org.moire.ultrasonic.cache.serializers.getMusicFolderSerializer
|
||||||
|
@ -20,8 +20,8 @@ class PermanentFileStorageTest : BaseStorageTest() {
|
||||||
val item = MusicFolder("1", "2")
|
val item = MusicFolder("1", "2")
|
||||||
storage.store("test", item, getMusicFolderSerializer())
|
storage.store("test", item, getMusicFolderSerializer())
|
||||||
|
|
||||||
storageDir.exists() `should equal to` true
|
storageDir.exists() `should be equal to` true
|
||||||
getServerStorageDir().exists() `should equal to` true
|
getServerStorageDir().exists() `should be equal to` true
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -32,7 +32,7 @@ class PermanentFileStorageTest : BaseStorageTest() {
|
||||||
storage.store(name, item, getMusicFolderSerializer())
|
storage.store(name, item, getMusicFolderSerializer())
|
||||||
|
|
||||||
val storageFiles = getServerStorageDir().listFiles()
|
val storageFiles = getServerStorageDir().listFiles()
|
||||||
storageFiles.size `should equal to` 1
|
storageFiles.size `should be equal to` 1
|
||||||
storageFiles[0].name `should contain` name
|
storageFiles[0].name `should contain` name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class PermanentFileStorageTest : BaseStorageTest() {
|
||||||
|
|
||||||
storage.clearAll()
|
storage.clearAll()
|
||||||
|
|
||||||
getServerStorageDir().listFiles().size `should equal to` 0
|
getServerStorageDir().listFiles().size `should be equal to` 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1,33 +1,33 @@
|
||||||
ext.versions = [
|
ext.versions = [
|
||||||
versionCode : 66,
|
versionCode : 67,
|
||||||
versionName : "2.3.1",
|
versionName : "2.4.0",
|
||||||
|
|
||||||
minSdk : 14,
|
minSdk : 14,
|
||||||
targetSdk : 22,
|
targetSdk : 22,
|
||||||
compileSdk : 27,
|
compileSdk : 27,
|
||||||
gradle : '4.5.1',
|
gradle : '4.5.1',
|
||||||
|
|
||||||
androidTools : "3.0.1",
|
androidTools : "3.1.0",
|
||||||
ktlint : "0.15.1",
|
ktlint : "0.20.0",
|
||||||
ktlintGradle : "3.0.1",
|
ktlintGradle : "3.2.0",
|
||||||
detekt : "1.0.0.RC6-3",
|
detekt : "1.0.0.RC6-4",
|
||||||
jacoco : "0.7.9",
|
jacoco : "0.7.9",
|
||||||
jacocoAndroid : "0.1.2",
|
jacocoAndroid : "0.1.2",
|
||||||
|
|
||||||
androidSupport : "22.2.1",
|
androidSupport : "22.2.1",
|
||||||
|
|
||||||
kotlin : "1.2.21",
|
kotlin : "1.2.31",
|
||||||
|
|
||||||
retrofit : "2.1.0",
|
retrofit : "2.4.0",
|
||||||
jackson : "2.9.0",
|
jackson : "2.9.0",
|
||||||
okhttp : "3.9.0",
|
okhttp : "3.10.0",
|
||||||
semver : "1.0.0",
|
semver : "1.0.0",
|
||||||
twitterSerial : "0.1.6",
|
twitterSerial : "0.1.6",
|
||||||
|
|
||||||
junit : "4.12",
|
junit : "4.12",
|
||||||
mockito : "2.12.0",
|
mockito : "2.16.0",
|
||||||
mockitoKotlin : "1.5.0",
|
mockitoKotlin : "1.5.0",
|
||||||
kluent : "1.26",
|
kluent : "1.35",
|
||||||
apacheCodecs : "1.10",
|
apacheCodecs : "1.10",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@ class MusicDirectory {
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun getChildren(
|
fun getChildren(
|
||||||
includeDirs: Boolean = true,
|
includeDirs: Boolean = true,
|
||||||
includeFiles: Boolean = true): List<Entry> {
|
includeFiles: Boolean = true
|
||||||
|
): List<Entry> {
|
||||||
if (includeDirs && includeFiles) {
|
if (includeDirs && includeFiles) {
|
||||||
return children
|
return children
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,18 +57,20 @@ fun parseDate(dateAsString: String): Calendar {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T : SubsonicResponse> checkErrorCallParsed(mockWebServerRule: MockWebServerRule,
|
fun <T : SubsonicResponse> checkErrorCallParsed(
|
||||||
apiRequest: () -> Response<T>): T {
|
mockWebServerRule: MockWebServerRule,
|
||||||
|
apiRequest: () -> Response<T>
|
||||||
|
): T {
|
||||||
mockWebServerRule.enqueueResponse("request_data_not_found_error_response.json")
|
mockWebServerRule.enqueueResponse("request_data_not_found_error_response.json")
|
||||||
|
|
||||||
val response = apiRequest()
|
val response = apiRequest()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body()) {
|
with(response.body()!!) {
|
||||||
status `should be` SubsonicResponse.Status.ERROR
|
status `should be` SubsonicResponse.Status.ERROR
|
||||||
error `should be` SubsonicError.RequestedDataWasNotFound
|
error `should be` SubsonicError.RequestedDataWasNotFound
|
||||||
}
|
}
|
||||||
return response.body()
|
return response.body()!!
|
||||||
}
|
}
|
||||||
|
|
||||||
fun SubsonicResponse.assertBaseResponseOk() {
|
fun SubsonicResponse.assertBaseResponseOk() {
|
||||||
|
@ -77,9 +79,11 @@ fun SubsonicResponse.assertBaseResponseOk() {
|
||||||
error `should be` null
|
error `should be` null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun MockWebServerRule.assertRequestParam(responseResourceName: String = "ping_ok.json",
|
fun MockWebServerRule.assertRequestParam(
|
||||||
|
responseResourceName: String = "ping_ok.json",
|
||||||
expectedParam: String,
|
expectedParam: String,
|
||||||
apiRequest: () -> Response<out Any>) {
|
apiRequest: () -> Response<out Any>
|
||||||
|
) {
|
||||||
this.enqueueResponse(responseResourceName)
|
this.enqueueResponse(responseResourceName)
|
||||||
apiRequest()
|
apiRequest()
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import okhttp3.mockwebserver.MockResponse
|
import okhttp3.mockwebserver.MockResponse
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -34,7 +34,7 @@ class GetStreamUrlTest {
|
||||||
|
|
||||||
val streamUrl = client.getStreamUrl(id)
|
val streamUrl = client.getStreamUrl(id)
|
||||||
|
|
||||||
streamUrl `should equal to` expectedUrl
|
streamUrl `should be equal to` expectedUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -43,6 +43,6 @@ class GetStreamUrlTest {
|
||||||
|
|
||||||
val streamUrl = client.getStreamUrl(id)
|
val streamUrl = client.getStreamUrl(id)
|
||||||
|
|
||||||
streamUrl `should equal to` expectedUrl
|
streamUrl `should be equal to` expectedUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
||||||
|
@ -26,19 +26,20 @@ class SubsonicApiCreateShareTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.createShare(listOf("some-id")).execute()
|
val response = client.api.createShare(listOf("some-id")).execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
response.body().shares.size `should equal to` 1
|
response.body()!!.shares.size `should be equal to` 1
|
||||||
with(response.body().shares[0]) {
|
with(response.body()!!.shares[0]) {
|
||||||
id `should equal to` "0"
|
id `should be equal to` "0"
|
||||||
url `should equal to` "https://subsonic.com/ext/share/awdwo?jwt=eyJhbGciOiJIUzI1NiJ9." +
|
url `should be equal to` "https://subsonic.com/ext/share/awdwo?jwt=" +
|
||||||
|
"eyJhbGciOiJIUzI1NiJ9." +
|
||||||
"eyJwYXRoIjoiL2V4dC9zaGFyZS9hd2R3byIsImV4cCI6MTU0MTYyNjQzMX0.iy8dkt_ZZc8hJ692" +
|
"eyJwYXRoIjoiL2V4dC9zaGFyZS9hd2R3byIsImV4cCI6MTU0MTYyNjQzMX0.iy8dkt_ZZc8hJ692" +
|
||||||
"UxorHdHWFU2RB-fMCmCA4IJ_dTw"
|
"UxorHdHWFU2RB-fMCmCA4IJ_dTw"
|
||||||
username `should equal to` "admin"
|
username `should be equal to` "admin"
|
||||||
created `should equal` parseDate("2017-11-07T21:33:51.748Z")
|
created `should equal` parseDate("2017-11-07T21:33:51.748Z")
|
||||||
expires `should equal` parseDate("2018-11-07T21:33:51.748Z")
|
expires `should equal` parseDate("2018-11-07T21:33:51.748Z")
|
||||||
lastVisited `should equal` parseDate("2018-11-07T21:33:51.748Z")
|
lastVisited `should equal` parseDate("2018-11-07T21:33:51.748Z")
|
||||||
description `should equal to` "Awesome link!"
|
description `should be equal to` "Awesome link!"
|
||||||
visitCount `should equal to` 0
|
visitCount `should be equal to` 0
|
||||||
items.size `should equal to` 1
|
items.size `should be equal to` 1
|
||||||
items[0] `should equal` MusicDirectoryChild(id = "4212", parent = "4186", isDir = false,
|
items[0] `should equal` MusicDirectoryChild(id = "4212", parent = "4186", isDir = false,
|
||||||
title = "Heaven Knows", album = "Going to Hell", artist = "The Pretty Reckless",
|
title = "Heaven Knows", album = "Going to Hell", artist = "The Pretty Reckless",
|
||||||
track = 3, year = 2014, genre = "Hard Rock", coverArt = "4186", size = 9025090,
|
track = 3, year = 2014, genre = "Hard Rock", coverArt = "4186", size = 9025090,
|
||||||
|
|
|
@ -150,7 +150,7 @@ class SubsonicApiErrorsTest : SubsonicAPIClientTest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Response<SubsonicResponse>.assertError(expectedError: SubsonicError) =
|
private fun Response<SubsonicResponse>.assertError(expectedError: SubsonicError) =
|
||||||
with(body()) {
|
with(body()!!) {
|
||||||
error `should not be` null
|
error `should not be` null
|
||||||
error `should equal` expectedError
|
error `should equal` expectedError
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.moire.ultrasonic.api.subsonic.models.Album
|
import org.moire.ultrasonic.api.subsonic.models.Album
|
||||||
|
@ -28,8 +28,8 @@ class SubsonicApiGetAlbumList2Test : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getAlbumList2(STARRED).execute()
|
val response = client.api.getAlbumList2(STARRED).execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().albumList) {
|
with(response.body()!!.albumList) {
|
||||||
this.size `should equal to` 2
|
this.size `should be equal to` 2
|
||||||
this[0] `should equal` Album(id = "962", name = "Fury", artist = "Sick Puppies",
|
this[0] `should equal` Album(id = "962", name = "Fury", artist = "Sick Puppies",
|
||||||
artistId = "473", coverArt = "al-962", songCount = 13, duration = 2591,
|
artistId = "473", coverArt = "al-962", songCount = 13, duration = 2591,
|
||||||
created = parseDate("2017-09-02T17:34:51.000Z"), year = 2016,
|
created = parseDate("2017-09-02T17:34:51.000Z"), year = 2016,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.moire.ultrasonic.api.subsonic.models.AlbumListType
|
import org.moire.ultrasonic.api.subsonic.models.AlbumListType
|
||||||
|
@ -27,8 +27,8 @@ class SubsonicApiGetAlbumListRequestTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getAlbumList(BY_GENRE).execute()
|
val response = client.api.getAlbumList(BY_GENRE).execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().albumList) {
|
with(response.body()!!.albumList) {
|
||||||
size `should equal to` 2
|
size `should be equal to` 2
|
||||||
this[1] `should equal` MusicDirectoryChild(id = "9997", parent = "9996", isDir = true,
|
this[1] `should equal` MusicDirectoryChild(id = "9997", parent = "9996", isDir = true,
|
||||||
title = "Endless Forms Most Beautiful", album = "Endless Forms Most Beautiful",
|
title = "Endless Forms Most Beautiful", album = "Endless Forms Most Beautiful",
|
||||||
artist = "Nightwish", year = 2015, genre = "Symphonic Metal",
|
artist = "Nightwish", year = 2015, genre = "Symphonic Metal",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.amshove.kluent.`should not be`
|
import org.amshove.kluent.`should not be`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -38,18 +38,18 @@ class SubsonicApiGetAlbumTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getAlbum("512").execute()
|
val response = client.api.getAlbum("512").execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().album) {
|
with(response.body()!!.album) {
|
||||||
id `should equal to` "618"
|
id `should be equal to` "618"
|
||||||
name `should equal to` "Black Ice"
|
name `should be equal to` "Black Ice"
|
||||||
artist `should equal to` "AC/DC"
|
artist `should be equal to` "AC/DC"
|
||||||
artistId `should equal to` "362"
|
artistId `should be equal to` "362"
|
||||||
coverArt `should equal to` "al-618"
|
coverArt `should be equal to` "al-618"
|
||||||
songCount `should equal to` 15
|
songCount `should be equal to` 15
|
||||||
duration `should equal to` 3331
|
duration `should be equal to` 3331
|
||||||
created `should equal` parseDate("2016-10-23T15:31:22.000Z")
|
created `should equal` parseDate("2016-10-23T15:31:22.000Z")
|
||||||
year `should equal to` 2008
|
year `should be equal to` 2008
|
||||||
genre `should equal to` "Hard Rock"
|
genre `should be equal to` "Hard Rock"
|
||||||
songList.size `should equal to` 15
|
songList.size `should be equal to` 15
|
||||||
songList[0] `should equal` MusicDirectoryChild(id = "6491", parent = "6475",
|
songList[0] `should equal` MusicDirectoryChild(id = "6491", parent = "6475",
|
||||||
isDir = false, title = "Rock 'n' Roll Train", album = "Black Ice",
|
isDir = false, title = "Rock 'n' Roll Train", album = "Black Ice",
|
||||||
artist = "AC/DC", track = 1, year = 2008, genre = "Hard Rock",
|
artist = "AC/DC", track = 1, year = 2008, genre = "Hard Rock",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.amshove.kluent.`should not be`
|
import org.amshove.kluent.`should not be`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -38,12 +38,12 @@ class SubsonicApiGetArtistTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getArtist("100").execute()
|
val response = client.api.getArtist("100").execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().artist) {
|
with(response.body()!!.artist) {
|
||||||
id `should equal to` "362"
|
id `should be equal to` "362"
|
||||||
name `should equal to` "AC/DC"
|
name `should be equal to` "AC/DC"
|
||||||
coverArt `should equal to` "ar-362"
|
coverArt `should be equal to` "ar-362"
|
||||||
albumCount `should equal to` 2
|
albumCount `should be equal to` 2
|
||||||
albumsList.size `should equal to` 2
|
albumsList.size `should be equal to` 2
|
||||||
albumsList[0] `should equal` Album(id = "618", name = "Black Ice", artist = "AC/DC",
|
albumsList[0] `should equal` Album(id = "618", name = "Black Ice", artist = "AC/DC",
|
||||||
artistId = "362", coverArt = "al-618", songCount = 15, duration = 3331,
|
artistId = "362", coverArt = "al-618", songCount = 15, duration = 3331,
|
||||||
created = parseDate("2016-10-23T15:31:22.000Z"),
|
created = parseDate("2016-10-23T15:31:22.000Z"),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.amshove.kluent.`should not be`
|
import org.amshove.kluent.`should not be`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -29,11 +29,11 @@ class SubsonicApiGetArtistsTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getArtists(null).execute()
|
val response = client.api.getArtists(null).execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().indexes) {
|
with(response.body()!!.indexes) {
|
||||||
lastModified `should equal to` 0L
|
lastModified `should be equal to` 0L
|
||||||
ignoredArticles `should equal to` "The El La Los Las Le Les"
|
ignoredArticles `should be equal to` "The El La Los Las Le Les"
|
||||||
shortcutList `should equal` emptyList()
|
shortcutList `should equal` emptyList()
|
||||||
indexList.size `should equal to` 2
|
indexList.size `should be equal to` 2
|
||||||
indexList `should equal` listOf(
|
indexList `should equal` listOf(
|
||||||
Index(name = "A", artists = listOf(
|
Index(name = "A", artists = listOf(
|
||||||
Artist(id = "362", name = "AC/DC", coverArt = "ar-362", albumCount = 2),
|
Artist(id = "362", name = "AC/DC", coverArt = "ar-362", albumCount = 2),
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import okhttp3.mockwebserver.MockResponse
|
import okhttp3.mockwebserver.MockResponse
|
||||||
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should be`
|
import org.amshove.kluent.`should be`
|
||||||
import org.amshove.kluent.`should equal to`
|
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.amshove.kluent.`should not be`
|
import org.amshove.kluent.`should not be`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -19,7 +19,7 @@ class SubsonicApiGetAvatarTest : SubsonicAPIClientTest() {
|
||||||
|
|
||||||
with(response) {
|
with(response) {
|
||||||
stream `should be` null
|
stream `should be` null
|
||||||
responseHttpCode `should equal to` 200
|
responseHttpCode `should be equal to` 200
|
||||||
apiError `should equal` SubsonicError.RequestedDataWasNotFound
|
apiError `should equal` SubsonicError.RequestedDataWasNotFound
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class SubsonicApiGetAvatarTest : SubsonicAPIClientTest() {
|
||||||
|
|
||||||
with(response) {
|
with(response) {
|
||||||
stream `should equal` null
|
stream `should equal` null
|
||||||
responseHttpCode `should equal to` httpErrorCode
|
responseHttpCode `should be equal to` httpErrorCode
|
||||||
apiError `should be` null
|
apiError `should be` null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,11 +46,11 @@ class SubsonicApiGetAvatarTest : SubsonicAPIClientTest() {
|
||||||
val response = client.stream("some")
|
val response = client.stream("some")
|
||||||
|
|
||||||
with(response) {
|
with(response) {
|
||||||
responseHttpCode `should equal to` 200
|
responseHttpCode `should be equal to` 200
|
||||||
apiError `should be` null
|
apiError `should be` null
|
||||||
stream `should not be` null
|
stream `should not be` null
|
||||||
val expectedContent = mockWebServerRule.loadJsonResponse("ping_ok.json")
|
val expectedContent = mockWebServerRule.loadJsonResponse("ping_ok.json")
|
||||||
stream!!.bufferedReader().readText() `should equal to` expectedContent
|
stream!!.bufferedReader().readText() `should be equal to` expectedContent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
||||||
|
@ -25,11 +25,11 @@ class SubsonicApiGetBookmarksTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getBookmarks().execute()
|
val response = client.api.getBookmarks().execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
response.body().bookmarkList.size `should equal to` 1
|
response.body()!!.bookmarkList.size `should be equal to` 1
|
||||||
with(response.body().bookmarkList[0]) {
|
with(response.body()!!.bookmarkList[0]) {
|
||||||
position `should equal to` 107914
|
position `should be equal to` 107914
|
||||||
username `should equal to` "CaptainEurope"
|
username `should be equal to` "CaptainEurope"
|
||||||
comment `should equal to` "Look at this"
|
comment `should be equal to` "Look at this"
|
||||||
created `should equal` parseDate("2017-11-18T15:22:22.144Z")
|
created `should equal` parseDate("2017-11-18T15:22:22.144Z")
|
||||||
changed `should equal` parseDate("2017-11-18T15:22:22.144Z")
|
changed `should equal` parseDate("2017-11-18T15:22:22.144Z")
|
||||||
entry `should equal` MusicDirectoryChild(id = "10349", parent = "10342",
|
entry `should equal` MusicDirectoryChild(id = "10349", parent = "10342",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.moire.ultrasonic.api.subsonic.models.ChatMessage
|
import org.moire.ultrasonic.api.subsonic.models.ChatMessage
|
||||||
|
@ -25,8 +25,8 @@ class SubsonicApiGetChatMessagesTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getChatMessages().execute()
|
val response = client.api.getChatMessages().execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().chatMessages) {
|
with(response.body()!!.chatMessages) {
|
||||||
size `should equal to` 2
|
size `should be equal to` 2
|
||||||
this[0] `should equal` ChatMessage(username = "sindre", time = 1269771845310,
|
this[0] `should equal` ChatMessage(username = "sindre", time = 1269771845310,
|
||||||
message = "Sindre was here")
|
message = "Sindre was here")
|
||||||
this[1] `should equal` ChatMessage(username = "ben", time = 1269771842504,
|
this[1] `should equal` ChatMessage(username = "ben", time = 1269771842504,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import okhttp3.mockwebserver.MockResponse
|
import okhttp3.mockwebserver.MockResponse
|
||||||
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should be`
|
import org.amshove.kluent.`should be`
|
||||||
import org.amshove.kluent.`should equal to`
|
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.amshove.kluent.`should not be`
|
import org.amshove.kluent.`should not be`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -19,7 +19,7 @@ class SubsonicApiGetCoverArtTest : SubsonicAPIClientTest() {
|
||||||
|
|
||||||
with(response) {
|
with(response) {
|
||||||
stream `should be` null
|
stream `should be` null
|
||||||
responseHttpCode `should equal to` 200
|
responseHttpCode `should be equal to` 200
|
||||||
apiError `should equal` SubsonicError.RequestedDataWasNotFound
|
apiError `should equal` SubsonicError.RequestedDataWasNotFound
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,11 +46,11 @@ class SubsonicApiGetCoverArtTest : SubsonicAPIClientTest() {
|
||||||
val response = client.getCoverArt("some-id")
|
val response = client.getCoverArt("some-id")
|
||||||
|
|
||||||
with(response) {
|
with(response) {
|
||||||
responseHttpCode `should equal to` 200
|
responseHttpCode `should be equal to` 200
|
||||||
apiError `should be` null
|
apiError `should be` null
|
||||||
stream `should not be` null
|
stream `should not be` null
|
||||||
val expectedContent = mockWebServerRule.loadJsonResponse("ping_ok.json")
|
val expectedContent = mockWebServerRule.loadJsonResponse("ping_ok.json")
|
||||||
stream!!.bufferedReader().readText() `should equal to` expectedContent
|
stream!!.bufferedReader().readText() `should be equal to` expectedContent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.moire.ultrasonic.api.subsonic.models.Genre
|
import org.moire.ultrasonic.api.subsonic.models.Genre
|
||||||
|
@ -25,8 +25,8 @@ class SubsonicApiGetGenresTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getGenres().execute()
|
val response = client.api.getGenres().execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().genresList) {
|
with(response.body()!!.genresList) {
|
||||||
size `should equal to` 5
|
size `should be equal to` 5
|
||||||
this[0] `should equal` Genre(1186, 103, "Rock")
|
this[0] `should equal` Genre(1186, 103, "Rock")
|
||||||
this[1] `should equal` Genre(896, 72, "Electronic")
|
this[1] `should equal` Genre(896, 72, "Electronic")
|
||||||
this[2] `should equal` Genre(790, 59, "Alternative Rock")
|
this[2] `should equal` Genre(790, 59, "Alternative Rock")
|
||||||
|
|
|
@ -18,8 +18,8 @@ class SubsonicApiGetIndexesTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getIndexes(null, null).execute()
|
val response = client.api.getIndexes(null, null).execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
response.body().indexes `should not be` null
|
response.body()!!.indexes `should not be` null
|
||||||
with(response.body().indexes) {
|
with(response.body()!!.indexes) {
|
||||||
lastModified `should equal` 1491069027523
|
lastModified `should equal` 1491069027523
|
||||||
ignoredArticles `should equal` "The El La Los Las Le Les"
|
ignoredArticles `should equal` "The El La Los Las Le Les"
|
||||||
shortcutList `should equal` listOf(
|
shortcutList `should equal` listOf(
|
||||||
|
|
|
@ -16,7 +16,7 @@ class SubsonicApiGetLicenseTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getLicense().execute()
|
val response = client.api.getLicense().execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body()) {
|
with(response.body()!!) {
|
||||||
assertBaseResponseOk()
|
assertBaseResponseOk()
|
||||||
license `should equal` License(valid = true,
|
license `should equal` License(valid = true,
|
||||||
trialExpires = parseDate("2016-11-23T20:17:15.206Z"),
|
trialExpires = parseDate("2016-11-23T20:17:15.206Z"),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,10 +21,10 @@ class SubsonicApiGetLyricsTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getLyrics().execute()
|
val response = client.api.getLyrics().execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().lyrics) {
|
with(response.body()!!.lyrics) {
|
||||||
artist `should equal to` "Amorphis"
|
artist `should be equal to` "Amorphis"
|
||||||
title `should equal to` "Alone"
|
title `should be equal to` "Alone"
|
||||||
text `should equal to` "Tear dimmed rememberance\nIn a womb of time\nBreath upon " +
|
text `should be equal to` "Tear dimmed rememberance\nIn a womb of time\nBreath upon " +
|
||||||
"me\nPossessed by the"
|
"me\nPossessed by the"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should be`
|
import org.amshove.kluent.`should be`
|
||||||
import org.amshove.kluent.`should equal to`
|
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.amshove.kluent.`should not be`
|
import org.amshove.kluent.`should not be`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -40,15 +40,15 @@ class SubsonicApiGetMusicDirectoryTest : SubsonicAPIClientTest() {
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
|
|
||||||
response.body().musicDirectory `should not be` null
|
response.body()!!.musicDirectory `should not be` null
|
||||||
with(response.body().musicDirectory) {
|
with(response.body()!!.musicDirectory) {
|
||||||
id `should equal to` "4836"
|
id `should be equal to` "4836"
|
||||||
parent `should equal to` "300"
|
parent `should be equal to` "300"
|
||||||
name `should equal` "12 Stones"
|
name `should equal` "12 Stones"
|
||||||
userRating `should equal to` 5
|
userRating `should be equal to` 5
|
||||||
averageRating `should equal to` 5.0f
|
averageRating `should be equal to` 5.0f
|
||||||
starred `should equal` null
|
starred `should equal` null
|
||||||
playCount `should equal to` 1
|
playCount `should be equal to` 1
|
||||||
childList.size `should be` 2
|
childList.size `should be` 2
|
||||||
childList[0] `should equal` MusicDirectoryChild(id = "4844", parent = "4836",
|
childList[0] `should equal` MusicDirectoryChild(id = "4844", parent = "4836",
|
||||||
isDir = false, title = "Crash", album = "12 Stones", artist = "12 Stones",
|
isDir = false, title = "Crash", album = "12 Stones", artist = "12 Stones",
|
||||||
|
|
|
@ -15,7 +15,7 @@ class SubsonicApiGetMusicFoldersTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getMusicFolders().execute()
|
val response = client.api.getMusicFolders().execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body()) {
|
with(response.body()!!) {
|
||||||
assertBaseResponseOk()
|
assertBaseResponseOk()
|
||||||
musicFolders `should equal` listOf(
|
musicFolders `should equal` listOf(
|
||||||
MusicFolder("0", "Music"),
|
MusicFolder("0", "Music"),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.amshove.kluent.`should not be`
|
import org.amshove.kluent.`should not be`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -28,17 +28,17 @@ class SubsonicApiGetPlaylistTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getPlaylist("4").execute()
|
val response = client.api.getPlaylist("4").execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().playlist) {
|
with(response.body()!!.playlist) {
|
||||||
id `should equal to` "0"
|
id `should be equal to` "0"
|
||||||
name `should equal to` "Aug 27, 2017 11:17 AM"
|
name `should be equal to` "Aug 27, 2017 11:17 AM"
|
||||||
owner `should equal to` "admin"
|
owner `should be equal to` "admin"
|
||||||
public `should equal to` false
|
public `should be equal to` false
|
||||||
songCount `should equal to` 16
|
songCount `should be equal to` 16
|
||||||
duration `should equal to` 3573
|
duration `should be equal to` 3573
|
||||||
created `should equal` parseDate("2017-08-27T11:17:26.216Z")
|
created `should equal` parseDate("2017-08-27T11:17:26.216Z")
|
||||||
changed `should equal` parseDate("2017-08-27T11:17:26.218Z")
|
changed `should equal` parseDate("2017-08-27T11:17:26.218Z")
|
||||||
coverArt `should equal to` "pl-0"
|
coverArt `should be equal to` "pl-0"
|
||||||
entriesList.size `should equal to` 2
|
entriesList.size `should be equal to` 2
|
||||||
entriesList[1] `should equal` MusicDirectoryChild(id = "4215", parent = "4186",
|
entriesList[1] `should equal` MusicDirectoryChild(id = "4215", parent = "4186",
|
||||||
isDir = false, title = "Going to Hell", album = "Going to Hell",
|
isDir = false, title = "Going to Hell", album = "Going to Hell",
|
||||||
artist = "The Pretty Reckless", track = 2, year = 2014,
|
artist = "The Pretty Reckless", track = 2, year = 2014,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.amshove.kluent.`should not be`
|
import org.amshove.kluent.`should not be`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -27,8 +27,8 @@ class SubsonicApiGetPlaylistsTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getPlaylists().execute()
|
val response = client.api.getPlaylists().execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().playlists) {
|
with(response.body()!!.playlists) {
|
||||||
size `should equal to` 1
|
size `should be equal to` 1
|
||||||
this[0] `should equal` Playlist(id = "0", name = "Aug 27, 2017 11:17 AM",
|
this[0] `should equal` Playlist(id = "0", name = "Aug 27, 2017 11:17 AM",
|
||||||
owner = "admin", public = false, songCount = 16, duration = 3573,
|
owner = "admin", public = false, songCount = 16, duration = 3573,
|
||||||
comment = "Some comment",
|
comment = "Some comment",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.amshove.kluent.`should not be`
|
import org.amshove.kluent.`should not be`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -27,20 +27,20 @@ class SubsonicApiGetPodcastsTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getPodcasts().execute()
|
val response = client.api.getPodcasts().execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
val podcastChannelsList = response.body().podcastChannels
|
val podcastChannelsList = response.body()!!.podcastChannels
|
||||||
podcastChannelsList.size `should equal to` 1
|
podcastChannelsList.size `should be equal to` 1
|
||||||
with(podcastChannelsList[0]) {
|
with(podcastChannelsList[0]) {
|
||||||
id `should equal to` "2"
|
id `should be equal to` "2"
|
||||||
url `should equal to` "http://feeds.codenewbie.org/cnpodcast.xml"
|
url `should be equal to` "http://feeds.codenewbie.org/cnpodcast.xml"
|
||||||
title `should equal to` "CodeNewbie"
|
title `should be equal to` "CodeNewbie"
|
||||||
description `should equal to` "Stories and interviews from people on their coding " +
|
description `should be equal to` "Stories and interviews from people on their coding " +
|
||||||
"journey."
|
"journey."
|
||||||
coverArt `should equal to` "pod-2"
|
coverArt `should be equal to` "pod-2"
|
||||||
originalImageUrl `should equal to` "http://codenewbie.blubrry.com/wp-content/uploads/" +
|
originalImageUrl `should be equal to` "http://codenewbie.blubrry.com/wp-content/" +
|
||||||
"powerpress/220808.jpg"
|
"uploads/powerpress/220808.jpg"
|
||||||
status `should equal to` "completed"
|
status `should be equal to` "completed"
|
||||||
errorMessage `should equal to` ""
|
errorMessage `should be equal to` ""
|
||||||
episodeList.size `should equal to` 10
|
episodeList.size `should be equal to` 10
|
||||||
episodeList[0] `should equal` MusicDirectoryChild(id = "148", parent = "9959",
|
episodeList[0] `should equal` MusicDirectoryChild(id = "148", parent = "9959",
|
||||||
isDir = false,
|
isDir = false,
|
||||||
title = "S1:EP3 – How to teach yourself computer science (Vaidehi Joshi)",
|
title = "S1:EP3 – How to teach yourself computer science (Vaidehi Joshi)",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
||||||
|
@ -25,8 +25,8 @@ class SubsonicApiGetRandomSongsTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getRandomSongs().execute()
|
val response = client.api.getRandomSongs().execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().songsList) {
|
with(response.body()!!.songsList) {
|
||||||
size `should equal to` 3
|
size `should be equal to` 3
|
||||||
this[1] `should equal` MusicDirectoryChild(id = "3061", parent = "3050", isDir = false,
|
this[1] `should equal` MusicDirectoryChild(id = "3061", parent = "3050", isDir = false,
|
||||||
title = "Sure as Hell", album = "Who Are You Now?", artist = "This Providence",
|
title = "Sure as Hell", album = "Who Are You Now?", artist = "This Providence",
|
||||||
track = 1, year = 2009, genre = "Indie Rock", coverArt = "3050",
|
track = 1, year = 2009, genre = "Indie Rock", coverArt = "3050",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
||||||
|
@ -25,19 +25,19 @@ class SubsonicApiGetSharesTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getShares().execute()
|
val response = client.api.getShares().execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
response.body().shares.size `should equal to` 1
|
response.body()!!.shares.size `should be equal to` 1
|
||||||
with(response.body().shares[0]) {
|
with(response.body()!!.shares[0]) {
|
||||||
id `should equal to` "0"
|
id `should be equal to` "0"
|
||||||
url `should equal to` "https://subsonic.com/ext/share/awdwo?jwt=eyJhbGciOiJIUzI1" +
|
url `should be equal to` "https://subsonic.com/ext/share/awdwo?jwt=eyJhbGciOiJIUzI1" +
|
||||||
"NiJ9.eyJwYXRoIjoiL2V4dC9zaGFyZS9hd2R3byIsImV4cCI6MTU0MTYyNjQzMX0.iy8dkt_ZZc8" +
|
"NiJ9.eyJwYXRoIjoiL2V4dC9zaGFyZS9hd2R3byIsImV4cCI6MTU0MTYyNjQzMX0.iy8dkt_ZZc8" +
|
||||||
"hJ692UxorHdHWFU2RB-fMCmCA4IJ_dTw"
|
"hJ692UxorHdHWFU2RB-fMCmCA4IJ_dTw"
|
||||||
username `should equal to` "admin"
|
username `should be equal to` "admin"
|
||||||
created `should equal` parseDate("2017-11-07T21:33:51.748Z")
|
created `should equal` parseDate("2017-11-07T21:33:51.748Z")
|
||||||
expires `should equal` parseDate("2018-11-07T21:33:51.748Z")
|
expires `should equal` parseDate("2018-11-07T21:33:51.748Z")
|
||||||
lastVisited `should equal` parseDate("2018-11-07T21:33:51.748Z")
|
lastVisited `should equal` parseDate("2018-11-07T21:33:51.748Z")
|
||||||
visitCount `should equal to` 0
|
visitCount `should be equal to` 0
|
||||||
description `should equal to` "Awesome link!"
|
description `should be equal to` "Awesome link!"
|
||||||
items.size `should equal to` 1
|
items.size `should be equal to` 1
|
||||||
items[0] `should equal` MusicDirectoryChild(id = "4212", parent = "4186", isDir = false,
|
items[0] `should equal` MusicDirectoryChild(id = "4212", parent = "4186", isDir = false,
|
||||||
title = "Heaven Knows", album = "Going to Hell", artist = "The Pretty Reckless",
|
title = "Heaven Knows", album = "Going to Hell", artist = "The Pretty Reckless",
|
||||||
track = 3, year = 2014, genre = "Hard Rock", coverArt = "4186", size = 9025090,
|
track = 3, year = 2014, genre = "Hard Rock", coverArt = "4186", size = 9025090,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
||||||
|
@ -25,8 +25,8 @@ class SubsonicApiGetSongsByGenreTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getSongsByGenre("Trance").execute()
|
val response = client.api.getSongsByGenre("Trance").execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
response.body().songsList.size `should equal to` 2
|
response.body()!!.songsList.size `should be equal to` 2
|
||||||
with(response.body().songsList) {
|
with(response.body()!!.songsList) {
|
||||||
this[0] `should equal` MusicDirectoryChild(id = "575", parent = "576", isDir = false,
|
this[0] `should equal` MusicDirectoryChild(id = "575", parent = "576", isDir = false,
|
||||||
title = "Time Machine (Vadim Zhukov Remix)", album = "668",
|
title = "Time Machine (Vadim Zhukov Remix)", album = "668",
|
||||||
artist = "Tasadi", year = 2008, genre = "Trance", size = 22467672,
|
artist = "Tasadi", year = 2008, genre = "Trance", size = 22467672,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.moire.ultrasonic.api.subsonic.models.Artist
|
import org.moire.ultrasonic.api.subsonic.models.Artist
|
||||||
|
@ -27,9 +27,9 @@ class SubsonicApiGetStarred2Test : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getStarred2().execute()
|
val response = client.api.getStarred2().execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().starred2) {
|
with(response.body()!!.starred2) {
|
||||||
albumList `should equal` emptyList()
|
albumList `should equal` emptyList()
|
||||||
artistList.size `should equal to` 1
|
artistList.size `should be equal to` 1
|
||||||
artistList[0] `should equal` Artist(id = "364", name = "Parov Stelar",
|
artistList[0] `should equal` Artist(id = "364", name = "Parov Stelar",
|
||||||
starred = parseDate("2017-08-12T18:32:58.768Z"))
|
starred = parseDate("2017-08-12T18:32:58.768Z"))
|
||||||
songList `should equal` emptyList()
|
songList `should equal` emptyList()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.moire.ultrasonic.api.subsonic.models.Artist
|
import org.moire.ultrasonic.api.subsonic.models.Artist
|
||||||
|
@ -26,9 +26,9 @@ class SubsonicApiGetStarredTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getStarred().execute()
|
val response = client.api.getStarred().execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().starred) {
|
with(response.body()!!.starred) {
|
||||||
albumList `should equal` emptyList()
|
albumList `should equal` emptyList()
|
||||||
artistList.size `should equal to` 1
|
artistList.size `should be equal to` 1
|
||||||
artistList[0] `should equal` Artist(id = "364", name = "Parov Stelar",
|
artistList[0] `should equal` Artist(id = "364", name = "Parov Stelar",
|
||||||
starred = parseDate("2017-08-12T18:32:58.768Z"))
|
starred = parseDate("2017-08-12T18:32:58.768Z"))
|
||||||
songList `should equal` emptyList()
|
songList `should equal` emptyList()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.moire.ultrasonic.api.subsonic.models.User
|
import org.moire.ultrasonic.api.subsonic.models.User
|
||||||
|
@ -25,24 +25,24 @@ class SubsonicApiGetUserTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getUser("some").execute()
|
val response = client.api.getUser("some").execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().user) {
|
with(response.body()!!.user) {
|
||||||
username `should equal to` "GodOfUniverse"
|
username `should be equal to` "GodOfUniverse"
|
||||||
email `should equal to` "some.mail@example.com"
|
email `should be equal to` "some.mail@example.com"
|
||||||
scrobblingEnabled `should equal to` false
|
scrobblingEnabled `should be equal to` false
|
||||||
adminRole `should equal to` true
|
adminRole `should be equal to` true
|
||||||
settingsRole `should equal to` true
|
settingsRole `should be equal to` true
|
||||||
downloadRole `should equal to` true
|
downloadRole `should be equal to` true
|
||||||
uploadRole `should equal to` true
|
uploadRole `should be equal to` true
|
||||||
playlistRole `should equal to` true
|
playlistRole `should be equal to` true
|
||||||
coverArtRole `should equal to` true
|
coverArtRole `should be equal to` true
|
||||||
commentRole `should equal to` true
|
commentRole `should be equal to` true
|
||||||
podcastRole `should equal to` true
|
podcastRole `should be equal to` true
|
||||||
streamRole `should equal to` true
|
streamRole `should be equal to` true
|
||||||
jukeboxRole `should equal to` true
|
jukeboxRole `should be equal to` true
|
||||||
shareRole `should equal to` true
|
shareRole `should be equal to` true
|
||||||
videoConverstionRole `should equal to` false
|
videoConverstionRole `should be equal to` false
|
||||||
folderList.size `should equal to` 1
|
folderList.size `should be equal to` 1
|
||||||
folderList[0] `should equal to` 0
|
folderList[0] `should be equal to` 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
||||||
|
@ -25,8 +25,8 @@ class SubsonicApiGetVideosListTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.getVideos().execute()
|
val response = client.api.getVideos().execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().videosList) {
|
with(response.body()!!.videosList) {
|
||||||
size `should equal to` 1
|
size `should be equal to` 1
|
||||||
this[0] `should equal` MusicDirectoryChild(id = "10402", parent = "10401",
|
this[0] `should equal` MusicDirectoryChild(id = "10402", parent = "10401",
|
||||||
isDir = false, title = "MVI_0512", album = "Incoming", size = 21889646,
|
isDir = false, title = "MVI_0512", album = "Incoming", size = 21889646,
|
||||||
contentType = "video/avi", suffix = "avi",
|
contentType = "video/avi", suffix = "avi",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.moire.ultrasonic.api.subsonic.models.JukeboxAction
|
import org.moire.ultrasonic.api.subsonic.models.JukeboxAction
|
||||||
|
@ -29,11 +29,11 @@ class SubsonicApiJukeboxControlTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.jukeboxControl(STATUS).execute()
|
val response = client.api.jukeboxControl(STATUS).execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().jukebox) {
|
with(response.body()!!.jukebox) {
|
||||||
currentIndex `should equal to` 94
|
currentIndex `should be equal to` 94
|
||||||
playing `should equal to` true
|
playing `should be equal to` true
|
||||||
gain `should equal to` 0.32f
|
gain `should be equal to` 0.32f
|
||||||
position `should equal to` 3
|
position `should be equal to` 3
|
||||||
playlistEntries `should equal` emptyList()
|
playlistEntries `should equal` emptyList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,12 +45,12 @@ class SubsonicApiJukeboxControlTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.jukeboxControl(GET).execute()
|
val response = client.api.jukeboxControl(GET).execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().jukebox) {
|
with(response.body()!!.jukebox) {
|
||||||
currentIndex `should equal to` 887
|
currentIndex `should be equal to` 887
|
||||||
playing `should equal to` false
|
playing `should be equal to` false
|
||||||
gain `should equal to` 0.88f
|
gain `should be equal to` 0.88f
|
||||||
position `should equal to` 2
|
position `should be equal to` 2
|
||||||
playlistEntries.size `should equal to` 2
|
playlistEntries.size `should be equal to` 2
|
||||||
playlistEntries[1] `should equal` MusicDirectoryChild(id = "4215", parent = "4186",
|
playlistEntries[1] `should equal` MusicDirectoryChild(id = "4215", parent = "4186",
|
||||||
isDir = false, title = "Going to Hell", album = "Going to Hell",
|
isDir = false, title = "Going to Hell", album = "Going to Hell",
|
||||||
artist = "The Pretty Reckless", track = 2, year = 2014, genre = "Hard Rock",
|
artist = "The Pretty Reckless", track = 2, year = 2014, genre = "Hard Rock",
|
||||||
|
|
|
@ -13,7 +13,7 @@ class SubsonicApiPingRequestTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.ping().execute()
|
val response = client.api.ping().execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body()) {
|
with(response.body()!!) {
|
||||||
assertBaseResponseOk()
|
assertBaseResponseOk()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,11 @@ class SubsonicApiSSLTest {
|
||||||
mockWebServer.shutdown()
|
mockWebServer.shutdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createSSLContext(certificatePemStream: InputStream,
|
private fun createSSLContext(
|
||||||
|
certificatePemStream: InputStream,
|
||||||
certificatePkcs12Stream: InputStream,
|
certificatePkcs12Stream: InputStream,
|
||||||
password: String): SSLContext {
|
password: String
|
||||||
|
): SSLContext {
|
||||||
var cert: X509Certificate? = null
|
var cert: X509Certificate? = null
|
||||||
val trustStore = KeyStore.getInstance(KeyStore.getDefaultType())
|
val trustStore = KeyStore.getInstance(KeyStore.getDefaultType())
|
||||||
trustStore.load(null)
|
trustStore.load(null)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.amshove.kluent.`should not be`
|
import org.amshove.kluent.`should not be`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -29,10 +29,10 @@ class SubsonicApiSearchTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.search().execute()
|
val response = client.api.search().execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().searchResult) {
|
with(response.body()!!.searchResult) {
|
||||||
offset `should equal to` 10
|
offset `should be equal to` 10
|
||||||
totalHits `should equal to` 53
|
totalHits `should be equal to` 53
|
||||||
matchList.size `should equal to` 1
|
matchList.size `should be equal to` 1
|
||||||
matchList[0] `should equal` MusicDirectoryChild(id = "5831", parent = "5766",
|
matchList[0] `should equal` MusicDirectoryChild(id = "5831", parent = "5766",
|
||||||
isDir = false, title = "You'll Be Under My Wheels",
|
isDir = false, title = "You'll Be Under My Wheels",
|
||||||
album = "Need for Speed Most Wanted", artist = "The Prodigy",
|
album = "Need for Speed Most Wanted", artist = "The Prodigy",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.amshove.kluent.`should not be`
|
import org.amshove.kluent.`should not be`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -30,17 +30,17 @@ class SubsonicApiSearchThreeTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.search3("some-query").execute()
|
val response = client.api.search3("some-query").execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().searchResult) {
|
with(response.body()!!.searchResult) {
|
||||||
artistList.size `should equal to` 1
|
artistList.size `should be equal to` 1
|
||||||
artistList[0] `should equal` Artist(id = "505", name = "The Prodigy",
|
artistList[0] `should equal` Artist(id = "505", name = "The Prodigy",
|
||||||
coverArt = "ar-505", albumCount = 5)
|
coverArt = "ar-505", albumCount = 5)
|
||||||
albumList.size `should equal to` 1
|
albumList.size `should be equal to` 1
|
||||||
albumList[0] `should equal` Album(id = "855",
|
albumList[0] `should equal` Album(id = "855",
|
||||||
name = "Always Outnumbered, Never Outgunned",
|
name = "Always Outnumbered, Never Outgunned",
|
||||||
artist = "The Prodigy", artistId = "505", coverArt = "al-855", songCount = 12,
|
artist = "The Prodigy", artistId = "505", coverArt = "al-855", songCount = 12,
|
||||||
duration = 3313, created = parseDate("2016-10-23T20:57:27.000Z"),
|
duration = 3313, created = parseDate("2016-10-23T20:57:27.000Z"),
|
||||||
year = 2004, genre = "Electronic")
|
year = 2004, genre = "Electronic")
|
||||||
songList.size `should equal to` 1
|
songList.size `should be equal to` 1
|
||||||
songList[0] `should equal` MusicDirectoryChild(id = "5831", parent = "5766",
|
songList[0] `should equal` MusicDirectoryChild(id = "5831", parent = "5766",
|
||||||
isDir = false,
|
isDir = false,
|
||||||
title = "You'll Be Under My Wheels", album = "Need for Speed Most Wanted",
|
title = "You'll Be Under My Wheels", album = "Need for Speed Most Wanted",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.amshove.kluent.`should not be`
|
import org.amshove.kluent.`should not be`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -29,16 +29,16 @@ class SubsonicApiSearchTwoTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.search2("some-query").execute()
|
val response = client.api.search2("some-query").execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().searchResult) {
|
with(response.body()!!.searchResult) {
|
||||||
artistList.size `should equal to` 1
|
artistList.size `should be equal to` 1
|
||||||
artistList[0] `should equal` Artist(id = "522", name = "The Prodigy")
|
artistList[0] `should equal` Artist(id = "522", name = "The Prodigy")
|
||||||
albumList.size `should equal to` 1
|
albumList.size `should be equal to` 1
|
||||||
albumList[0] `should equal` MusicDirectoryChild(id = "8867", parent = "522",
|
albumList[0] `should equal` MusicDirectoryChild(id = "8867", parent = "522",
|
||||||
isDir = true, title = "Always Outnumbered, Never Outgunned",
|
isDir = true, title = "Always Outnumbered, Never Outgunned",
|
||||||
album = "Always Outnumbered, Never Outgunned", artist = "The Prodigy",
|
album = "Always Outnumbered, Never Outgunned", artist = "The Prodigy",
|
||||||
year = 2004, genre = "Electronic", coverArt = "8867", playCount = 0,
|
year = 2004, genre = "Electronic", coverArt = "8867", playCount = 0,
|
||||||
created = parseDate("2016-10-23T20:57:27.000Z"))
|
created = parseDate("2016-10-23T20:57:27.000Z"))
|
||||||
songList.size `should equal to` 1
|
songList.size `should be equal to` 1
|
||||||
songList[0] `should equal` MusicDirectoryChild(id = "5831", parent = "5766",
|
songList[0] `should equal` MusicDirectoryChild(id = "5831", parent = "5766",
|
||||||
isDir = false,
|
isDir = false,
|
||||||
title = "You'll Be Under My Wheels", album = "Need for Speed Most Wanted",
|
title = "You'll Be Under My Wheels", album = "Need for Speed Most Wanted",
|
||||||
|
|
|
@ -15,7 +15,7 @@ class SubsonicApiStarTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.star().execute()
|
val response = client.api.star().execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
response.body().status `should be` SubsonicResponse.Status.OK
|
response.body()?.status `should be` SubsonicResponse.Status.OK
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import okhttp3.mockwebserver.MockResponse
|
import okhttp3.mockwebserver.MockResponse
|
||||||
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should be`
|
import org.amshove.kluent.`should be`
|
||||||
import org.amshove.kluent.`should equal to`
|
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.amshove.kluent.`should not be`
|
import org.amshove.kluent.`should not be`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -19,7 +19,7 @@ class SubsonicApiStreamTest : SubsonicAPIClientTest() {
|
||||||
|
|
||||||
with(response) {
|
with(response) {
|
||||||
stream `should be` null
|
stream `should be` null
|
||||||
responseHttpCode `should equal to` 200
|
responseHttpCode `should be equal to` 200
|
||||||
apiError `should equal` SubsonicError.RequestedDataWasNotFound
|
apiError `should equal` SubsonicError.RequestedDataWasNotFound
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class SubsonicApiStreamTest : SubsonicAPIClientTest() {
|
||||||
|
|
||||||
with(response) {
|
with(response) {
|
||||||
stream `should be` null
|
stream `should be` null
|
||||||
responseHttpCode `should equal to` httpErrorCode
|
responseHttpCode `should be equal to` httpErrorCode
|
||||||
apiError `should be` null
|
apiError `should be` null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,11 +46,11 @@ class SubsonicApiStreamTest : SubsonicAPIClientTest() {
|
||||||
val response = client.stream("some-id")
|
val response = client.stream("some-id")
|
||||||
|
|
||||||
with(response) {
|
with(response) {
|
||||||
responseHttpCode `should equal to` 200
|
responseHttpCode `should be equal to` 200
|
||||||
apiError `should be` null
|
apiError `should be` null
|
||||||
stream `should not be` null
|
stream `should not be` null
|
||||||
val expectedContent = mockWebServerRule.loadJsonResponse("ping_ok.json")
|
val expectedContent = mockWebServerRule.loadJsonResponse("ping_ok.json")
|
||||||
stream!!.bufferedReader().readText() `should equal to` expectedContent
|
stream!!.bufferedReader().readText() `should be equal to` expectedContent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class SubsonicApiUnstarTest : SubsonicAPIClientTest() {
|
||||||
val response = client.api.unstar().execute()
|
val response = client.api.unstar().execute()
|
||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
response.body().status `should be` SubsonicResponse.Status.OK
|
response.body()?.status `should be` SubsonicResponse.Status.OK
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -2,8 +2,8 @@ package org.moire.ultrasonic.api.subsonic.interceptors
|
||||||
|
|
||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
import okhttp3.mockwebserver.MockResponse
|
import okhttp3.mockwebserver.MockResponse
|
||||||
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should contain`
|
import org.amshove.kluent.`should contain`
|
||||||
import org.amshove.kluent.`should equal to`
|
|
||||||
import org.amshove.kluent.`should not contain`
|
import org.amshove.kluent.`should not contain`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class RangeHeaderInterceptorTest : BaseInterceptorTest() {
|
||||||
|
|
||||||
val executedRequest = mockWebServerRule.mockWebServer.takeRequest()
|
val executedRequest = mockWebServerRule.mockWebServer.takeRequest()
|
||||||
executedRequest.headers.names() `should contain` "Range"
|
executedRequest.headers.names() `should contain` "Range"
|
||||||
executedRequest.headers["Range"]!! `should equal to` "bytes=$offset-"
|
executedRequest.headers["Range"]!! `should be equal to` "bytes=$offset-"
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -54,6 +54,6 @@ class RangeHeaderInterceptorTest : BaseInterceptorTest() {
|
||||||
|
|
||||||
val executedRequest = mockWebServerRule.mockWebServer.takeRequest()
|
val executedRequest = mockWebServerRule.mockWebServer.takeRequest()
|
||||||
executedRequest.headers.names() `should contain` "Range"
|
executedRequest.headers.names() `should contain` "Range"
|
||||||
executedRequest.headers["Range"]!! `should equal to` "bytes=$offset-"
|
executedRequest.headers["Range"]!! `should be equal to` "bytes=$offset-"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,5 +7,5 @@ import java.io.IOException
|
||||||
* by current server api version.
|
* by current server api version.
|
||||||
*/
|
*/
|
||||||
class ApiNotSupportedException(
|
class ApiNotSupportedException(
|
||||||
serverApiVersion: SubsonicAPIVersions)
|
serverApiVersion: SubsonicAPIVersions
|
||||||
: IOException("Server api $serverApiVersion does not support this call")
|
) : IOException("Server api $serverApiVersion does not support this call")
|
||||||
|
|
|
@ -44,7 +44,8 @@ import retrofit2.Call
|
||||||
*/
|
*/
|
||||||
internal class ApiVersionCheckWrapper(
|
internal class ApiVersionCheckWrapper(
|
||||||
val api: SubsonicAPIDefinition,
|
val api: SubsonicAPIDefinition,
|
||||||
var currentApiVersion: SubsonicAPIVersions) : SubsonicAPIDefinition by api {
|
var currentApiVersion: SubsonicAPIVersions
|
||||||
|
) : SubsonicAPIDefinition by api {
|
||||||
override fun getArtists(musicFolderId: String?): Call<GetArtistsResponse> {
|
override fun getArtists(musicFolderId: String?): Call<GetArtistsResponse> {
|
||||||
checkVersion(V1_8_0)
|
checkVersion(V1_8_0)
|
||||||
return api.getArtists(musicFolderId)
|
return api.getArtists(musicFolderId)
|
||||||
|
@ -70,26 +71,30 @@ internal class ApiVersionCheckWrapper(
|
||||||
return api.getAlbum(id)
|
return api.getAlbum(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun search2(query: String,
|
override fun search2(
|
||||||
|
query: String,
|
||||||
artistCount: Int?,
|
artistCount: Int?,
|
||||||
artistOffset: Int?,
|
artistOffset: Int?,
|
||||||
albumCount: Int?,
|
albumCount: Int?,
|
||||||
albumOffset: Int?,
|
albumOffset: Int?,
|
||||||
songCount: Int?,
|
songCount: Int?,
|
||||||
musicFolderId: String?): Call<SearchTwoResponse> {
|
musicFolderId: String?
|
||||||
|
): Call<SearchTwoResponse> {
|
||||||
checkVersion(V1_4_0)
|
checkVersion(V1_4_0)
|
||||||
checkParamVersion(musicFolderId, V1_12_0)
|
checkParamVersion(musicFolderId, V1_12_0)
|
||||||
return api.search2(query, artistCount, artistOffset, albumCount, albumOffset, songCount,
|
return api.search2(query, artistCount, artistOffset, albumCount, albumOffset, songCount,
|
||||||
musicFolderId)
|
musicFolderId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun search3(query: String,
|
override fun search3(
|
||||||
|
query: String,
|
||||||
artistCount: Int?,
|
artistCount: Int?,
|
||||||
artistOffset: Int?,
|
artistOffset: Int?,
|
||||||
albumCount: Int?,
|
albumCount: Int?,
|
||||||
albumOffset: Int?,
|
albumOffset: Int?,
|
||||||
songCount: Int?,
|
songCount: Int?,
|
||||||
musicFolderId: String?): Call<SearchThreeResponse> {
|
musicFolderId: String?
|
||||||
|
): Call<SearchThreeResponse> {
|
||||||
checkVersion(V1_8_0)
|
checkVersion(V1_8_0)
|
||||||
checkParamVersion(musicFolderId, V1_12_0)
|
checkParamVersion(musicFolderId, V1_12_0)
|
||||||
return api.search3(query, artistCount, artistOffset, albumCount, albumOffset,
|
return api.search3(query, artistCount, artistOffset, albumCount, albumOffset,
|
||||||
|
@ -101,9 +106,11 @@ internal class ApiVersionCheckWrapper(
|
||||||
return api.getPlaylists(username)
|
return api.getPlaylists(username)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createPlaylist(id: String?,
|
override fun createPlaylist(
|
||||||
|
id: String?,
|
||||||
name: String?,
|
name: String?,
|
||||||
songIds: List<String>?): Call<SubsonicResponse> {
|
songIds: List<String>?
|
||||||
|
): Call<SubsonicResponse> {
|
||||||
checkVersion(V1_2_0)
|
checkVersion(V1_2_0)
|
||||||
return api.createPlaylist(id, name, songIds)
|
return api.createPlaylist(id, name, songIds)
|
||||||
}
|
}
|
||||||
|
@ -113,12 +120,14 @@ internal class ApiVersionCheckWrapper(
|
||||||
return api.deletePlaylist(id)
|
return api.deletePlaylist(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun updatePlaylist(id: String,
|
override fun updatePlaylist(
|
||||||
|
id: String,
|
||||||
name: String?,
|
name: String?,
|
||||||
comment: String?,
|
comment: String?,
|
||||||
public: Boolean?,
|
public: Boolean?,
|
||||||
songIdsToAdd: List<String>?,
|
songIdsToAdd: List<String>?,
|
||||||
songIndexesToRemove: List<Int>?): Call<SubsonicResponse> {
|
songIndexesToRemove: List<Int>?
|
||||||
|
): Call<SubsonicResponse> {
|
||||||
checkVersion(V1_8_0)
|
checkVersion(V1_8_0)
|
||||||
return api.updatePlaylist(id, name, comment, public, songIdsToAdd, songIndexesToRemove)
|
return api.updatePlaylist(id, name, comment, public, songIdsToAdd, songIndexesToRemove)
|
||||||
}
|
}
|
||||||
|
@ -141,35 +150,41 @@ internal class ApiVersionCheckWrapper(
|
||||||
return api.scrobble(id, time, submission)
|
return api.scrobble(id, time, submission)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getAlbumList(type: AlbumListType,
|
override fun getAlbumList(
|
||||||
|
type: AlbumListType,
|
||||||
size: Int?,
|
size: Int?,
|
||||||
offset: Int?,
|
offset: Int?,
|
||||||
fromYear: Int?,
|
fromYear: Int?,
|
||||||
toYear: Int?,
|
toYear: Int?,
|
||||||
genre: String?,
|
genre: String?,
|
||||||
musicFolderId: String?): Call<GetAlbumListResponse> {
|
musicFolderId: String?
|
||||||
|
): Call<GetAlbumListResponse> {
|
||||||
checkVersion(V1_2_0)
|
checkVersion(V1_2_0)
|
||||||
checkParamVersion(musicFolderId, V1_11_0)
|
checkParamVersion(musicFolderId, V1_11_0)
|
||||||
return api.getAlbumList(type, size, offset, fromYear, toYear, genre, musicFolderId)
|
return api.getAlbumList(type, size, offset, fromYear, toYear, genre, musicFolderId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getAlbumList2(type: AlbumListType,
|
override fun getAlbumList2(
|
||||||
|
type: AlbumListType,
|
||||||
size: Int?,
|
size: Int?,
|
||||||
offset: Int?,
|
offset: Int?,
|
||||||
fromYear: Int?,
|
fromYear: Int?,
|
||||||
toYear: Int?,
|
toYear: Int?,
|
||||||
genre: String?,
|
genre: String?,
|
||||||
musicFolderId: String?): Call<GetAlbumList2Response> {
|
musicFolderId: String?
|
||||||
|
): Call<GetAlbumList2Response> {
|
||||||
checkVersion(V1_8_0)
|
checkVersion(V1_8_0)
|
||||||
checkParamVersion(musicFolderId, V1_12_0)
|
checkParamVersion(musicFolderId, V1_12_0)
|
||||||
return api.getAlbumList2(type, size, offset, fromYear, toYear, genre, musicFolderId)
|
return api.getAlbumList2(type, size, offset, fromYear, toYear, genre, musicFolderId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getRandomSongs(size: Int?,
|
override fun getRandomSongs(
|
||||||
|
size: Int?,
|
||||||
genre: String?,
|
genre: String?,
|
||||||
fromYear: Int?,
|
fromYear: Int?,
|
||||||
toYear: Int?,
|
toYear: Int?,
|
||||||
musicFolderId: String?): Call<GetRandomSongsResponse> {
|
musicFolderId: String?
|
||||||
|
): Call<GetRandomSongsResponse> {
|
||||||
checkVersion(V1_2_0)
|
checkVersion(V1_2_0)
|
||||||
return api.getRandomSongs(size, genre, fromYear, toYear, musicFolderId)
|
return api.getRandomSongs(size, genre, fromYear, toYear, musicFolderId)
|
||||||
}
|
}
|
||||||
|
@ -186,14 +201,16 @@ internal class ApiVersionCheckWrapper(
|
||||||
return api.getStarred2(musicFolderId)
|
return api.getStarred2(musicFolderId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun stream(id: String,
|
override fun stream(
|
||||||
|
id: String,
|
||||||
maxBitRate: Int?,
|
maxBitRate: Int?,
|
||||||
format: String?,
|
format: String?,
|
||||||
timeOffset: Int?,
|
timeOffset: Int?,
|
||||||
videoSize: String?,
|
videoSize: String?,
|
||||||
estimateContentLength: Boolean?,
|
estimateContentLength: Boolean?,
|
||||||
converted: Boolean?,
|
converted: Boolean?,
|
||||||
offset: Long?): Call<ResponseBody> {
|
offset: Long?
|
||||||
|
): Call<ResponseBody> {
|
||||||
checkParamVersion(maxBitRate, V1_2_0)
|
checkParamVersion(maxBitRate, V1_2_0)
|
||||||
checkParamVersion(format, V1_6_0)
|
checkParamVersion(format, V1_6_0)
|
||||||
checkParamVersion(videoSize, V1_6_0)
|
checkParamVersion(videoSize, V1_6_0)
|
||||||
|
@ -203,11 +220,13 @@ internal class ApiVersionCheckWrapper(
|
||||||
estimateContentLength, converted)
|
estimateContentLength, converted)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun jukeboxControl(action: JukeboxAction,
|
override fun jukeboxControl(
|
||||||
|
action: JukeboxAction,
|
||||||
index: Int?,
|
index: Int?,
|
||||||
offset: Int?,
|
offset: Int?,
|
||||||
ids: List<String>?,
|
ids: List<String>?,
|
||||||
gain: Float?): Call<JukeboxResponse> {
|
gain: Float?
|
||||||
|
): Call<JukeboxResponse> {
|
||||||
checkVersion(V1_2_0)
|
checkVersion(V1_2_0)
|
||||||
checkParamVersion(offset, V1_7_0)
|
checkParamVersion(offset, V1_7_0)
|
||||||
return api.jukeboxControl(action, index, offset, ids, gain)
|
return api.jukeboxControl(action, index, offset, ids, gain)
|
||||||
|
@ -218,9 +237,11 @@ internal class ApiVersionCheckWrapper(
|
||||||
return api.getShares()
|
return api.getShares()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createShare(idsToShare: List<String>,
|
override fun createShare(
|
||||||
|
idsToShare: List<String>,
|
||||||
description: String?,
|
description: String?,
|
||||||
expires: Long?): Call<SharesResponse> {
|
expires: Long?
|
||||||
|
): Call<SharesResponse> {
|
||||||
checkVersion(V1_6_0)
|
checkVersion(V1_6_0)
|
||||||
return api.createShare(idsToShare, description, expires)
|
return api.createShare(idsToShare, description, expires)
|
||||||
}
|
}
|
||||||
|
@ -230,9 +251,11 @@ internal class ApiVersionCheckWrapper(
|
||||||
return api.deleteShare(id)
|
return api.deleteShare(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun updateShare(id: String,
|
override fun updateShare(
|
||||||
|
id: String,
|
||||||
description: String?,
|
description: String?,
|
||||||
expires: Long?): Call<SubsonicResponse> {
|
expires: Long?
|
||||||
|
): Call<SubsonicResponse> {
|
||||||
checkVersion(V1_6_0)
|
checkVersion(V1_6_0)
|
||||||
return api.updateShare(id, description, expires)
|
return api.updateShare(id, description, expires)
|
||||||
}
|
}
|
||||||
|
@ -242,10 +265,12 @@ internal class ApiVersionCheckWrapper(
|
||||||
return api.getGenres()
|
return api.getGenres()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getSongsByGenre(genre: String,
|
override fun getSongsByGenre(
|
||||||
|
genre: String,
|
||||||
count: Int,
|
count: Int,
|
||||||
offset: Int,
|
offset: Int,
|
||||||
musicFolderId: String?): Call<GetSongsByGenreResponse> {
|
musicFolderId: String?
|
||||||
|
): Call<GetSongsByGenreResponse> {
|
||||||
checkVersion(V1_9_0)
|
checkVersion(V1_9_0)
|
||||||
checkParamVersion(musicFolderId, V1_12_0)
|
checkParamVersion(musicFolderId, V1_12_0)
|
||||||
return api.getSongsByGenre(genre, count, offset, musicFolderId)
|
return api.getSongsByGenre(genre, count, offset, musicFolderId)
|
||||||
|
@ -271,9 +296,11 @@ internal class ApiVersionCheckWrapper(
|
||||||
return api.getBookmarks()
|
return api.getBookmarks()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createBookmark(id: String,
|
override fun createBookmark(
|
||||||
|
id: String,
|
||||||
position: Long,
|
position: Long,
|
||||||
comment: String?): Call<SubsonicResponse> {
|
comment: String?
|
||||||
|
): Call<SubsonicResponse> {
|
||||||
checkVersion(V1_9_0)
|
checkVersion(V1_9_0)
|
||||||
return api.createBookmark(id, position, comment)
|
return api.createBookmark(id, position, comment)
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,14 +35,16 @@ private const val READ_TIMEOUT = 60_000L
|
||||||
*
|
*
|
||||||
* @author Yahor Berdnikau
|
* @author Yahor Berdnikau
|
||||||
*/
|
*/
|
||||||
class SubsonicAPIClient(baseUrl: String,
|
class SubsonicAPIClient(
|
||||||
|
baseUrl: String,
|
||||||
username: String,
|
username: String,
|
||||||
password: String,
|
password: String,
|
||||||
minimalProtocolVersion: SubsonicAPIVersions,
|
minimalProtocolVersion: SubsonicAPIVersions,
|
||||||
clientID: String,
|
clientID: String,
|
||||||
allowSelfSignedCertificate: Boolean = false,
|
allowSelfSignedCertificate: Boolean = false,
|
||||||
enableLdapUserSupport: Boolean = false,
|
enableLdapUserSupport: Boolean = false,
|
||||||
debug: Boolean = false) {
|
debug: Boolean = false
|
||||||
|
) {
|
||||||
private val versionInterceptor = VersionInterceptor(minimalProtocolVersion) {
|
private val versionInterceptor = VersionInterceptor(minimalProtocolVersion) {
|
||||||
protocolVersion = it
|
protocolVersion = it
|
||||||
}
|
}
|
||||||
|
@ -139,14 +141,14 @@ class SubsonicAPIClient(baseUrl: String,
|
||||||
val response = apiCall()
|
val response = apiCall()
|
||||||
return if (response.isSuccessful) {
|
return if (response.isSuccessful) {
|
||||||
val responseBody = response.body()
|
val responseBody = response.body()
|
||||||
val contentType = responseBody.contentType()
|
val contentType = responseBody?.contentType()
|
||||||
if (contentType != null &&
|
if (contentType != null &&
|
||||||
contentType.type().equals("application", true) &&
|
contentType.type().equals("application", true) &&
|
||||||
contentType.subtype().equals("json", true)) {
|
contentType.subtype().equals("json", true)) {
|
||||||
val error = jacksonMapper.readValue<SubsonicResponse>(responseBody.byteStream())
|
val error = jacksonMapper.readValue<SubsonicResponse>(responseBody.byteStream())
|
||||||
StreamResponse(apiError = error.error, responseHttpCode = response.code())
|
StreamResponse(apiError = error.error, responseHttpCode = response.code())
|
||||||
} else {
|
} else {
|
||||||
StreamResponse(stream = responseBody.byteStream(),
|
StreamResponse(stream = responseBody?.byteStream(),
|
||||||
responseHttpCode = response.code())
|
responseHttpCode = response.code())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -165,7 +167,7 @@ class SubsonicAPIClient(baseUrl: String,
|
||||||
val request = api.stream(id).execute()
|
val request = api.stream(id).execute()
|
||||||
val url = request.raw().request().url().toString()
|
val url = request.raw().request().url().toString()
|
||||||
if (request.isSuccessful) {
|
if (request.isSuccessful) {
|
||||||
request.body().close()
|
request.body()?.close()
|
||||||
}
|
}
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,10 @@ interface SubsonicAPIDefinition {
|
||||||
fun getMusicFolders(): Call<MusicFoldersResponse>
|
fun getMusicFolders(): Call<MusicFoldersResponse>
|
||||||
|
|
||||||
@GET("getIndexes.view")
|
@GET("getIndexes.view")
|
||||||
fun getIndexes(@Query("musicFolderId") musicFolderId: String?,
|
fun getIndexes(
|
||||||
@Query("ifModifiedSince") ifModifiedSince: Long?): Call<GetIndexesResponse>
|
@Query("musicFolderId") musicFolderId: String?,
|
||||||
|
@Query("ifModifiedSince") ifModifiedSince: Long?
|
||||||
|
): Call<GetIndexesResponse>
|
||||||
|
|
||||||
@GET("getMusicDirectory.view")
|
@GET("getMusicDirectory.view")
|
||||||
fun getMusicDirectory(@Query("id") id: String): Call<GetMusicDirectoryResponse>
|
fun getMusicDirectory(@Query("id") id: String): Call<GetMusicDirectoryResponse>
|
||||||
|
@ -64,14 +66,18 @@ interface SubsonicAPIDefinition {
|
||||||
fun getArtists(@Query("musicFolderId") musicFolderId: String?): Call<GetArtistsResponse>
|
fun getArtists(@Query("musicFolderId") musicFolderId: String?): Call<GetArtistsResponse>
|
||||||
|
|
||||||
@GET("star.view")
|
@GET("star.view")
|
||||||
fun star(@Query("id") id: String? = null,
|
fun star(
|
||||||
|
@Query("id") id: String? = null,
|
||||||
@Query("albumId") albumId: String? = null,
|
@Query("albumId") albumId: String? = null,
|
||||||
@Query("artistId") artistId: String? = null): Call<SubsonicResponse>
|
@Query("artistId") artistId: String? = null
|
||||||
|
): Call<SubsonicResponse>
|
||||||
|
|
||||||
@GET("unstar.view")
|
@GET("unstar.view")
|
||||||
fun unstar(@Query("id") id: String? = null,
|
fun unstar(
|
||||||
|
@Query("id") id: String? = null,
|
||||||
@Query("albumId") albumId: String? = null,
|
@Query("albumId") albumId: String? = null,
|
||||||
@Query("artistId") artistId: String? = null): Call<SubsonicResponse>
|
@Query("artistId") artistId: String? = null
|
||||||
|
): Call<SubsonicResponse>
|
||||||
|
|
||||||
@GET("getArtist.view")
|
@GET("getArtist.view")
|
||||||
fun getArtist(@Query("id") id: String): Call<GetArtistResponse>
|
fun getArtist(@Query("id") id: String): Call<GetArtistResponse>
|
||||||
|
@ -80,31 +86,37 @@ interface SubsonicAPIDefinition {
|
||||||
fun getAlbum(@Query("id") id: String): Call<GetAlbumResponse>
|
fun getAlbum(@Query("id") id: String): Call<GetAlbumResponse>
|
||||||
|
|
||||||
@GET("search.view")
|
@GET("search.view")
|
||||||
fun search(@Query("artist") artist: String? = null,
|
fun search(
|
||||||
|
@Query("artist") artist: String? = null,
|
||||||
@Query("album") album: String? = null,
|
@Query("album") album: String? = null,
|
||||||
@Query("title") title: String? = null,
|
@Query("title") title: String? = null,
|
||||||
@Query("any") any: String? = null,
|
@Query("any") any: String? = null,
|
||||||
@Query("count") count: Int? = null,
|
@Query("count") count: Int? = null,
|
||||||
@Query("offset") offset: Int? = null,
|
@Query("offset") offset: Int? = null,
|
||||||
@Query("newerThan") newerThan: Long? = null): Call<SearchResponse>
|
@Query("newerThan") newerThan: Long? = null
|
||||||
|
): Call<SearchResponse>
|
||||||
|
|
||||||
@GET("search2.view")
|
@GET("search2.view")
|
||||||
fun search2(@Query("query") query: String,
|
fun search2(
|
||||||
|
@Query("query") query: String,
|
||||||
@Query("artistCount") artistCount: Int? = null,
|
@Query("artistCount") artistCount: Int? = null,
|
||||||
@Query("artistOffset") artistOffset: Int? = null,
|
@Query("artistOffset") artistOffset: Int? = null,
|
||||||
@Query("albumCount") albumCount: Int? = null,
|
@Query("albumCount") albumCount: Int? = null,
|
||||||
@Query("albumOffset") albumOffset: Int? = null,
|
@Query("albumOffset") albumOffset: Int? = null,
|
||||||
@Query("songCount") songCount: Int? = null,
|
@Query("songCount") songCount: Int? = null,
|
||||||
@Query("musicFolderId") musicFolderId: String? = null): Call<SearchTwoResponse>
|
@Query("musicFolderId") musicFolderId: String? = null
|
||||||
|
): Call<SearchTwoResponse>
|
||||||
|
|
||||||
@GET("search3.view")
|
@GET("search3.view")
|
||||||
fun search3(@Query("query") query: String,
|
fun search3(
|
||||||
|
@Query("query") query: String,
|
||||||
@Query("artistCount") artistCount: Int? = null,
|
@Query("artistCount") artistCount: Int? = null,
|
||||||
@Query("artistOffset") artistOffset: Int? = null,
|
@Query("artistOffset") artistOffset: Int? = null,
|
||||||
@Query("albumCount") albumCount: Int? = null,
|
@Query("albumCount") albumCount: Int? = null,
|
||||||
@Query("albumOffset") albumOffset: Int? = null,
|
@Query("albumOffset") albumOffset: Int? = null,
|
||||||
@Query("songCount") songCount: Int? = null,
|
@Query("songCount") songCount: Int? = null,
|
||||||
@Query("musicFolderId") musicFolderId: String? = null): Call<SearchThreeResponse>
|
@Query("musicFolderId") musicFolderId: String? = null
|
||||||
|
): Call<SearchThreeResponse>
|
||||||
|
|
||||||
@GET("getPlaylist.view")
|
@GET("getPlaylist.view")
|
||||||
fun getPlaylist(@Query("id") id: String): Call<GetPlaylistResponse>
|
fun getPlaylist(@Query("id") id: String): Call<GetPlaylistResponse>
|
||||||
|
@ -113,9 +125,11 @@ interface SubsonicAPIDefinition {
|
||||||
fun getPlaylists(@Query("username") username: String? = null): Call<GetPlaylistsResponse>
|
fun getPlaylists(@Query("username") username: String? = null): Call<GetPlaylistsResponse>
|
||||||
|
|
||||||
@GET("createPlaylist.view")
|
@GET("createPlaylist.view")
|
||||||
fun createPlaylist(@Query("playlistId") id: String? = null,
|
fun createPlaylist(
|
||||||
|
@Query("playlistId") id: String? = null,
|
||||||
@Query("name") name: String? = null,
|
@Query("name") name: String? = null,
|
||||||
@Query("songId") songIds: List<String>? = null): Call<SubsonicResponse>
|
@Query("songId") songIds: List<String>? = null
|
||||||
|
): Call<SubsonicResponse>
|
||||||
|
|
||||||
@GET("deletePlaylist.view")
|
@GET("deletePlaylist.view")
|
||||||
fun deletePlaylist(@Query("id") id: String): Call<SubsonicResponse>
|
fun deletePlaylist(@Query("id") id: String): Call<SubsonicResponse>
|
||||||
|
@ -127,21 +141,28 @@ interface SubsonicAPIDefinition {
|
||||||
@Query("comment") comment: String? = null,
|
@Query("comment") comment: String? = null,
|
||||||
@Query("public") public: Boolean? = null,
|
@Query("public") public: Boolean? = null,
|
||||||
@Query("songIdToAdd") songIdsToAdd: List<String>? = null,
|
@Query("songIdToAdd") songIdsToAdd: List<String>? = null,
|
||||||
@Query("songIndexToRemove") songIndexesToRemove: List<Int>? = null):
|
@Query("songIndexToRemove") songIndexesToRemove: List<Int>? = null
|
||||||
|
):
|
||||||
Call<SubsonicResponse>
|
Call<SubsonicResponse>
|
||||||
|
|
||||||
@GET("getPodcasts.view")
|
@GET("getPodcasts.view")
|
||||||
fun getPodcasts(@Query("includeEpisodes") includeEpisodes: Boolean? = null,
|
fun getPodcasts(
|
||||||
@Query("id") id: String? = null): Call<GetPodcastsResponse>
|
@Query("includeEpisodes") includeEpisodes: Boolean? = null,
|
||||||
|
@Query("id") id: String? = null
|
||||||
|
): Call<GetPodcastsResponse>
|
||||||
|
|
||||||
@GET("getLyrics.view")
|
@GET("getLyrics.view")
|
||||||
fun getLyrics(@Query("artist") artist: String? = null,
|
fun getLyrics(
|
||||||
@Query("title") title: String? = null): Call<GetLyricsResponse>
|
@Query("artist") artist: String? = null,
|
||||||
|
@Query("title") title: String? = null
|
||||||
|
): Call<GetLyricsResponse>
|
||||||
|
|
||||||
@GET("scrobble.view")
|
@GET("scrobble.view")
|
||||||
fun scrobble(@Query("id") id: String,
|
fun scrobble(
|
||||||
|
@Query("id") id: String,
|
||||||
@Query("time") time: Long? = null,
|
@Query("time") time: Long? = null,
|
||||||
@Query("submission") submission: Boolean? = null): Call<SubsonicResponse>
|
@Query("submission") submission: Boolean? = null
|
||||||
|
): Call<SubsonicResponse>
|
||||||
|
|
||||||
@GET("getAlbumList.view")
|
@GET("getAlbumList.view")
|
||||||
fun getAlbumList(
|
fun getAlbumList(
|
||||||
|
@ -151,7 +172,8 @@ interface SubsonicAPIDefinition {
|
||||||
@Query("fromYear") fromYear: Int? = null,
|
@Query("fromYear") fromYear: Int? = null,
|
||||||
@Query("toYear") toYear: Int? = null,
|
@Query("toYear") toYear: Int? = null,
|
||||||
@Query("genre") genre: String? = null,
|
@Query("genre") genre: String? = null,
|
||||||
@Query("musicFolderId") musicFolderId: String? = null): Call<GetAlbumListResponse>
|
@Query("musicFolderId") musicFolderId: String? = null
|
||||||
|
): Call<GetAlbumListResponse>
|
||||||
|
|
||||||
@GET("getAlbumList2.view")
|
@GET("getAlbumList2.view")
|
||||||
fun getAlbumList2(
|
fun getAlbumList2(
|
||||||
|
@ -161,7 +183,8 @@ interface SubsonicAPIDefinition {
|
||||||
@Query("fromYear") fromYear: Int? = null,
|
@Query("fromYear") fromYear: Int? = null,
|
||||||
@Query("toYear") toYear: Int? = null,
|
@Query("toYear") toYear: Int? = null,
|
||||||
@Query("genre") genre: String? = null,
|
@Query("genre") genre: String? = null,
|
||||||
@Query("musicFolderId") musicFolderId: String? = null): Call<GetAlbumList2Response>
|
@Query("musicFolderId") musicFolderId: String? = null
|
||||||
|
): Call<GetAlbumList2Response>
|
||||||
|
|
||||||
@GET("getRandomSongs.view")
|
@GET("getRandomSongs.view")
|
||||||
fun getRandomSongs(
|
fun getRandomSongs(
|
||||||
|
@ -169,53 +192,65 @@ interface SubsonicAPIDefinition {
|
||||||
@Query("genre") genre: String? = null,
|
@Query("genre") genre: String? = null,
|
||||||
@Query("fromYear") fromYear: Int? = null,
|
@Query("fromYear") fromYear: Int? = null,
|
||||||
@Query("toYear") toYear: Int? = null,
|
@Query("toYear") toYear: Int? = null,
|
||||||
@Query("musicFolderId") musicFolderId: String? = null): Call<GetRandomSongsResponse>
|
@Query("musicFolderId") musicFolderId: String? = null
|
||||||
|
): Call<GetRandomSongsResponse>
|
||||||
|
|
||||||
@GET("getStarred.view")
|
@GET("getStarred.view")
|
||||||
fun getStarred(@Query("musicFolderId") musicFolderId: String? = null): Call<GetStarredResponse>
|
fun getStarred(@Query("musicFolderId") musicFolderId: String? = null): Call<GetStarredResponse>
|
||||||
|
|
||||||
@GET("getStarred2.view")
|
@GET("getStarred2.view")
|
||||||
fun getStarred2(
|
fun getStarred2(
|
||||||
@Query("musicFolderId") musicFolderId: String? = null): Call<GetStarredTwoResponse>
|
@Query("musicFolderId") musicFolderId: String? = null
|
||||||
|
): Call<GetStarredTwoResponse>
|
||||||
|
|
||||||
@Streaming
|
@Streaming
|
||||||
@GET("getCoverArt.view")
|
@GET("getCoverArt.view")
|
||||||
fun getCoverArt(@Query("id") id: String,
|
fun getCoverArt(
|
||||||
@Query("size") size: Long? = null): Call<ResponseBody>
|
@Query("id") id: String,
|
||||||
|
@Query("size") size: Long? = null
|
||||||
|
): Call<ResponseBody>
|
||||||
|
|
||||||
@Streaming
|
@Streaming
|
||||||
@GET("stream.view")
|
@GET("stream.view")
|
||||||
fun stream(@Query("id") id: String,
|
fun stream(
|
||||||
|
@Query("id") id: String,
|
||||||
@Query("maxBitRate") maxBitRate: Int? = null,
|
@Query("maxBitRate") maxBitRate: Int? = null,
|
||||||
@Query("format") format: String? = null,
|
@Query("format") format: String? = null,
|
||||||
@Query("timeOffset") timeOffset: Int? = null,
|
@Query("timeOffset") timeOffset: Int? = null,
|
||||||
@Query("size") videoSize: String? = null,
|
@Query("size") videoSize: String? = null,
|
||||||
@Query("estimateContentLength") estimateContentLength: Boolean? = null,
|
@Query("estimateContentLength") estimateContentLength: Boolean? = null,
|
||||||
@Query("converted") converted: Boolean? = null,
|
@Query("converted") converted: Boolean? = null,
|
||||||
@Header("Range") offset: Long? = null): Call<ResponseBody>
|
@Header("Range") offset: Long? = null
|
||||||
|
): Call<ResponseBody>
|
||||||
|
|
||||||
@GET("jukeboxControl.view")
|
@GET("jukeboxControl.view")
|
||||||
fun jukeboxControl(@Query("action") action: JukeboxAction,
|
fun jukeboxControl(
|
||||||
|
@Query("action") action: JukeboxAction,
|
||||||
@Query("index") index: Int? = null,
|
@Query("index") index: Int? = null,
|
||||||
@Query("offset") offset: Int? = null,
|
@Query("offset") offset: Int? = null,
|
||||||
@Query("id") ids: List<String>? = null,
|
@Query("id") ids: List<String>? = null,
|
||||||
@Query("gain") gain: Float? = null): Call<JukeboxResponse>
|
@Query("gain") gain: Float? = null
|
||||||
|
): Call<JukeboxResponse>
|
||||||
|
|
||||||
@GET("getShares.view")
|
@GET("getShares.view")
|
||||||
fun getShares(): Call<SharesResponse>
|
fun getShares(): Call<SharesResponse>
|
||||||
|
|
||||||
@GET("createShare.view")
|
@GET("createShare.view")
|
||||||
fun createShare(@Query("id") idsToShare: List<String>,
|
fun createShare(
|
||||||
|
@Query("id") idsToShare: List<String>,
|
||||||
@Query("description") description: String? = null,
|
@Query("description") description: String? = null,
|
||||||
@Query("expires") expires: Long? = null): Call<SharesResponse>
|
@Query("expires") expires: Long? = null
|
||||||
|
): Call<SharesResponse>
|
||||||
|
|
||||||
@GET("deleteShare.view")
|
@GET("deleteShare.view")
|
||||||
fun deleteShare(@Query("id") id: String): Call<SubsonicResponse>
|
fun deleteShare(@Query("id") id: String): Call<SubsonicResponse>
|
||||||
|
|
||||||
@GET("updateShare.view")
|
@GET("updateShare.view")
|
||||||
fun updateShare(@Query("id") id: String,
|
fun updateShare(
|
||||||
|
@Query("id") id: String,
|
||||||
@Query("description") description: String? = null,
|
@Query("description") description: String? = null,
|
||||||
@Query("expires") expires: Long? = null): Call<SubsonicResponse>
|
@Query("expires") expires: Long? = null
|
||||||
|
): Call<SubsonicResponse>
|
||||||
|
|
||||||
@GET("getGenres.view")
|
@GET("getGenres.view")
|
||||||
fun getGenres(): Call<GenresResponse>
|
fun getGenres(): Call<GenresResponse>
|
||||||
|
@ -225,7 +260,8 @@ interface SubsonicAPIDefinition {
|
||||||
@Query("genre") genre: String,
|
@Query("genre") genre: String,
|
||||||
@Query("count") count: Int = 10,
|
@Query("count") count: Int = 10,
|
||||||
@Query("offset") offset: Int = 0,
|
@Query("offset") offset: Int = 0,
|
||||||
@Query("musicFolderId") musicFolderId: String? = null): Call<GetSongsByGenreResponse>
|
@Query("musicFolderId") musicFolderId: String? = null
|
||||||
|
): Call<GetSongsByGenreResponse>
|
||||||
|
|
||||||
@GET("getUser.view")
|
@GET("getUser.view")
|
||||||
fun getUser(@Query("username") username: String): Call<GetUserResponse>
|
fun getUser(@Query("username") username: String): Call<GetUserResponse>
|
||||||
|
@ -243,7 +279,8 @@ interface SubsonicAPIDefinition {
|
||||||
fun createBookmark(
|
fun createBookmark(
|
||||||
@Query("id") id: String,
|
@Query("id") id: String,
|
||||||
@Query("position") position: Long,
|
@Query("position") position: Long,
|
||||||
@Query("comment") comment: String? = null): Call<SubsonicResponse>
|
@Query("comment") comment: String? = null
|
||||||
|
): Call<SubsonicResponse>
|
||||||
|
|
||||||
@GET("deleteBookmark.view")
|
@GET("deleteBookmark.view")
|
||||||
fun deleteBookmark(@Query("id") id: String): Call<SubsonicResponse>
|
fun deleteBookmark(@Query("id") id: String): Call<SubsonicResponse>
|
||||||
|
|
|
@ -56,8 +56,10 @@ enum class SubsonicAPIVersions(val subsonicVersions: String, val restApiVersion:
|
||||||
}
|
}
|
||||||
|
|
||||||
class SubsonicAPIVersionsDeserializer : JsonDeserializer<SubsonicAPIVersions>() {
|
class SubsonicAPIVersionsDeserializer : JsonDeserializer<SubsonicAPIVersions>() {
|
||||||
override fun deserialize(p: JsonParser,
|
override fun deserialize(
|
||||||
ctxt: DeserializationContext?): SubsonicAPIVersions {
|
p: JsonParser,
|
||||||
|
ctxt: DeserializationContext?
|
||||||
|
): SubsonicAPIVersions {
|
||||||
if (p.currentName != "version") {
|
if (p.currentName != "version") {
|
||||||
throw JsonParseException(p, "Not valid token for API version!")
|
throw JsonParseException(p, "Not valid token for API version!")
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ class PasswordHexInterceptor(private val password: String) : Interceptor {
|
||||||
override fun intercept(chain: Chain): Response {
|
override fun intercept(chain: Chain): Response {
|
||||||
val originalRequest = chain.request()
|
val originalRequest = chain.request()
|
||||||
val updatedUrl = originalRequest.url().newBuilder()
|
val updatedUrl = originalRequest.url().newBuilder()
|
||||||
.addQueryParameter("p", passwordHex).build()
|
.addEncodedQueryParameter("p", passwordHex).build()
|
||||||
return chain.proceed(originalRequest.newBuilder().url(updatedUrl).build())
|
return chain.proceed(originalRequest.newBuilder().url(updatedUrl).build())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,8 @@ private const val DEFAULT_PEEK_BYTE_COUNT = 1000L
|
||||||
*/
|
*/
|
||||||
internal class VersionInterceptor(
|
internal class VersionInterceptor(
|
||||||
internal var protocolVersion: SubsonicAPIVersions,
|
internal var protocolVersion: SubsonicAPIVersions,
|
||||||
private val notifier: (SubsonicAPIVersions) -> Unit = {}) : Interceptor {
|
private val notifier: (SubsonicAPIVersions) -> Unit = {}
|
||||||
|
) : Interceptor {
|
||||||
private val jsonFactory = JsonFactory()
|
private val jsonFactory = JsonFactory()
|
||||||
|
|
||||||
override fun intercept(chain: Chain): okhttp3.Response {
|
override fun intercept(chain: Chain): okhttp3.Response {
|
||||||
|
|
|
@ -14,4 +14,5 @@ data class Album(
|
||||||
val created: Calendar? = null,
|
val created: Calendar? = null,
|
||||||
val year: Int = 0,
|
val year: Int = 0,
|
||||||
val genre: String = "",
|
val genre: String = "",
|
||||||
@JsonProperty("song") val songList: List<MusicDirectoryChild> = emptyList())
|
@JsonProperty("song") val songList: List<MusicDirectoryChild> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -3,10 +3,12 @@ package org.moire.ultrasonic.api.subsonic.models
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
|
||||||
data class Artist(val id: String = "",
|
data class Artist(
|
||||||
|
val id: String = "",
|
||||||
val name: String = "",
|
val name: String = "",
|
||||||
val coverArt: String = "",
|
val coverArt: String = "",
|
||||||
val albumCount: Int = 0,
|
val albumCount: Int = 0,
|
||||||
val starred: Calendar? = null,
|
val starred: Calendar? = null,
|
||||||
@JsonProperty("album")
|
@JsonProperty("album")
|
||||||
val albumsList: List<Album> = emptyList())
|
val albumsList: List<Album> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -8,4 +8,5 @@ data class Bookmark(
|
||||||
val comment: String = "",
|
val comment: String = "",
|
||||||
val created: Calendar? = null,
|
val created: Calendar? = null,
|
||||||
val changed: Calendar? = null,
|
val changed: Calendar? = null,
|
||||||
val entry: MusicDirectoryChild = MusicDirectoryChild())
|
val entry: MusicDirectoryChild = MusicDirectoryChild()
|
||||||
|
)
|
||||||
|
|
|
@ -3,4 +3,5 @@ package org.moire.ultrasonic.api.subsonic.models
|
||||||
data class ChatMessage(
|
data class ChatMessage(
|
||||||
val username: String = "",
|
val username: String = "",
|
||||||
val time: Long = 0,
|
val time: Long = 0,
|
||||||
val message: String = "")
|
val message: String = ""
|
||||||
|
)
|
||||||
|
|
|
@ -2,6 +2,8 @@ package org.moire.ultrasonic.api.subsonic.models
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
data class Genre(val songCount: Int = 0,
|
data class Genre(
|
||||||
|
val songCount: Int = 0,
|
||||||
val albumCount: Int = 0,
|
val albumCount: Int = 0,
|
||||||
@JsonProperty("value") val name: String)
|
@JsonProperty("value") val name: String
|
||||||
|
)
|
||||||
|
|
|
@ -2,6 +2,8 @@ package org.moire.ultrasonic.api.subsonic.models
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
data class Index(val name: String = "",
|
data class Index(
|
||||||
|
val name: String = "",
|
||||||
@JsonProperty("artist")
|
@JsonProperty("artist")
|
||||||
val artists: List<Artist> = emptyList())
|
val artists: List<Artist> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -2,9 +2,11 @@ package org.moire.ultrasonic.api.subsonic.models
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
data class Indexes(val lastModified: Long = 0,
|
data class Indexes(
|
||||||
|
val lastModified: Long = 0,
|
||||||
val ignoredArticles: String = "",
|
val ignoredArticles: String = "",
|
||||||
@JsonProperty("index")
|
@JsonProperty("index")
|
||||||
val indexList: List<Index> = emptyList(),
|
val indexList: List<Index> = emptyList(),
|
||||||
@JsonProperty("shortcut")
|
@JsonProperty("shortcut")
|
||||||
val shortcutList: List<Artist> = emptyList())
|
val shortcutList: List<Artist> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -7,4 +7,5 @@ data class JukeboxStatus(
|
||||||
val playing: Boolean = false,
|
val playing: Boolean = false,
|
||||||
val gain: Float = 0.0f,
|
val gain: Float = 0.0f,
|
||||||
val position: Int = 0,
|
val position: Int = 0,
|
||||||
@JsonProperty("entry") val playlistEntries: List<MusicDirectoryChild> = emptyList())
|
@JsonProperty("entry") val playlistEntries: List<MusicDirectoryChild> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -6,4 +6,5 @@ data class License(
|
||||||
val valid: Boolean = false,
|
val valid: Boolean = false,
|
||||||
val email: String = "",
|
val email: String = "",
|
||||||
val trialExpires: Calendar = Calendar.getInstance(),
|
val trialExpires: Calendar = Calendar.getInstance(),
|
||||||
val licenseExpires: Calendar = Calendar.getInstance())
|
val licenseExpires: Calendar = Calendar.getInstance()
|
||||||
|
)
|
||||||
|
|
|
@ -5,4 +5,5 @@ import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
data class Lyrics(
|
data class Lyrics(
|
||||||
val artist: String = "",
|
val artist: String = "",
|
||||||
val title: String = "",
|
val title: String = "",
|
||||||
@JsonProperty("value") val text: String = "")
|
@JsonProperty("value") val text: String = ""
|
||||||
|
)
|
||||||
|
|
|
@ -3,7 +3,8 @@ package org.moire.ultrasonic.api.subsonic.models
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
|
||||||
data class MusicDirectory(val id: String = "",
|
data class MusicDirectory(
|
||||||
|
val id: String = "",
|
||||||
val parent: String = "",
|
val parent: String = "",
|
||||||
val name: String = "",
|
val name: String = "",
|
||||||
val userRating: Int = 0,
|
val userRating: Int = 0,
|
||||||
|
@ -11,4 +12,5 @@ data class MusicDirectory(val id: String = "",
|
||||||
val starred: Calendar? = null,
|
val starred: Calendar? = null,
|
||||||
val playCount: Int = 0,
|
val playCount: Int = 0,
|
||||||
@JsonProperty("child")
|
@JsonProperty("child")
|
||||||
val childList: List<MusicDirectoryChild> = emptyList())
|
val childList: List<MusicDirectoryChild> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -2,7 +2,8 @@ package org.moire.ultrasonic.api.subsonic.models
|
||||||
|
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
|
||||||
data class MusicDirectoryChild(val id: String = "",
|
data class MusicDirectoryChild(
|
||||||
|
val id: String = "",
|
||||||
val parent: String = "",
|
val parent: String = "",
|
||||||
val isDir: Boolean = false,
|
val isDir: Boolean = false,
|
||||||
val title: String = "",
|
val title: String = "",
|
||||||
|
@ -34,4 +35,5 @@ data class MusicDirectoryChild(val id: String = "",
|
||||||
val status: String = "",
|
val status: String = "",
|
||||||
val publishDate: Calendar? = null,
|
val publishDate: Calendar? = null,
|
||||||
val userRating: Int? = null,
|
val userRating: Int? = null,
|
||||||
val averageRating: Float? = null)
|
val averageRating: Float? = null
|
||||||
|
)
|
||||||
|
|
|
@ -11,4 +11,5 @@ data class PodcastChannel(
|
||||||
val originalImageUrl: String = "",
|
val originalImageUrl: String = "",
|
||||||
val status: String = "",
|
val status: String = "",
|
||||||
val errorMessage: String = "",
|
val errorMessage: String = "",
|
||||||
@JsonProperty("episode") val episodeList: List<MusicDirectoryChild> = emptyList())
|
@JsonProperty("episode") val episodeList: List<MusicDirectoryChild> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -5,4 +5,5 @@ import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
data class SearchResult(
|
data class SearchResult(
|
||||||
val offset: Int = 0,
|
val offset: Int = 0,
|
||||||
val totalHits: Int = 0,
|
val totalHits: Int = 0,
|
||||||
@JsonProperty("match") val matchList: List<MusicDirectoryChild> = emptyList())
|
@JsonProperty("match") val matchList: List<MusicDirectoryChild> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -12,4 +12,5 @@ data class Share(
|
||||||
val visitCount: Int = 0,
|
val visitCount: Int = 0,
|
||||||
val description: String = "",
|
val description: String = "",
|
||||||
val lastVisited: Calendar? = null,
|
val lastVisited: Calendar? = null,
|
||||||
@JsonProperty("entry") val items: List<MusicDirectoryChild> = emptyList())
|
@JsonProperty("entry") val items: List<MusicDirectoryChild> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -18,4 +18,5 @@ data class User(
|
||||||
val jukeboxRole: Boolean = false,
|
val jukeboxRole: Boolean = false,
|
||||||
val shareRole: Boolean = false,
|
val shareRole: Boolean = false,
|
||||||
val videoConverstionRole: Boolean = false,
|
val videoConverstionRole: Boolean = false,
|
||||||
@JsonProperty("folder") val folderList: List<Int> = emptyList())
|
@JsonProperty("folder") val folderList: List<Int> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -8,11 +8,13 @@ import org.moire.ultrasonic.api.subsonic.models.Bookmark
|
||||||
class BookmarksResponse(
|
class BookmarksResponse(
|
||||||
status: Status,
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?) : SubsonicResponse(status, version, error) {
|
error: SubsonicError?
|
||||||
|
) : SubsonicResponse(status, version, error) {
|
||||||
@JsonProperty("bookmarks") private val bookmarksWrapper = BookmarkWrapper()
|
@JsonProperty("bookmarks") private val bookmarksWrapper = BookmarkWrapper()
|
||||||
|
|
||||||
val bookmarkList: List<Bookmark> get() = bookmarksWrapper.bookmarkList
|
val bookmarkList: List<Bookmark> get() = bookmarksWrapper.bookmarkList
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class BookmarkWrapper(
|
internal class BookmarkWrapper(
|
||||||
@JsonProperty("bookmark") val bookmarkList: List<Bookmark> = emptyList())
|
@JsonProperty("bookmark") val bookmarkList: List<Bookmark> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -8,11 +8,13 @@ import org.moire.ultrasonic.api.subsonic.models.ChatMessage
|
||||||
class ChatMessagesResponse(
|
class ChatMessagesResponse(
|
||||||
status: Status,
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?) : SubsonicResponse(status, version, error) {
|
error: SubsonicError?
|
||||||
|
) : SubsonicResponse(status, version, error) {
|
||||||
@JsonProperty("chatMessages") private val wrapper = ChatMessagesWrapper()
|
@JsonProperty("chatMessages") private val wrapper = ChatMessagesWrapper()
|
||||||
|
|
||||||
val chatMessages: List<ChatMessage> get() = wrapper.messagesList
|
val chatMessages: List<ChatMessage> get() = wrapper.messagesList
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ChatMessagesWrapper(
|
internal class ChatMessagesWrapper(
|
||||||
@JsonProperty("chatMessage") val messagesList: List<ChatMessage> = emptyList())
|
@JsonProperty("chatMessage") val messagesList: List<ChatMessage> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -5,9 +5,11 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.Genre
|
import org.moire.ultrasonic.api.subsonic.models.Genre
|
||||||
|
|
||||||
class GenresResponse(status: Status,
|
class GenresResponse(
|
||||||
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?) : SubsonicResponse(status, version, error) {
|
error: SubsonicError?
|
||||||
|
) : SubsonicResponse(status, version, error) {
|
||||||
@JsonProperty("genres") private val genresWrapper = GenresWrapper()
|
@JsonProperty("genres") private val genresWrapper = GenresWrapper()
|
||||||
val genresList: List<Genre> get() = genresWrapper.genresList
|
val genresList: List<Genre> get() = genresWrapper.genresList
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,11 @@ import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.Album
|
import org.moire.ultrasonic.api.subsonic.models.Album
|
||||||
|
|
||||||
@Suppress("NamingConventionViolation")
|
@Suppress("NamingConventionViolation")
|
||||||
class GetAlbumList2Response(status: Status,
|
class GetAlbumList2Response(
|
||||||
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?)
|
error: SubsonicError?
|
||||||
: SubsonicResponse(status, version, error) {
|
) : SubsonicResponse(status, version, error) {
|
||||||
@JsonProperty("albumList2") private val albumWrapper2 = AlbumWrapper2()
|
@JsonProperty("albumList2") private val albumWrapper2 = AlbumWrapper2()
|
||||||
|
|
||||||
val albumList: List<Album>
|
val albumList: List<Album>
|
||||||
|
@ -18,4 +19,5 @@ class GetAlbumList2Response(status: Status,
|
||||||
|
|
||||||
@Suppress("NamingConventionViolation")
|
@Suppress("NamingConventionViolation")
|
||||||
private class AlbumWrapper2(
|
private class AlbumWrapper2(
|
||||||
@JsonProperty("album") val albumList: List<Album> = emptyList())
|
@JsonProperty("album") val albumList: List<Album> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -5,10 +5,11 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
||||||
|
|
||||||
class GetAlbumListResponse(status: Status,
|
class GetAlbumListResponse(
|
||||||
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?)
|
error: SubsonicError?
|
||||||
: SubsonicResponse(status, version, error) {
|
) : SubsonicResponse(status, version, error) {
|
||||||
@JsonProperty("albumList") private val albumWrapper = AlbumWrapper()
|
@JsonProperty("albumList") private val albumWrapper = AlbumWrapper()
|
||||||
|
|
||||||
val albumList: List<MusicDirectoryChild>
|
val albumList: List<MusicDirectoryChild>
|
||||||
|
@ -16,4 +17,5 @@ class GetAlbumListResponse(status: Status,
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AlbumWrapper(
|
private class AlbumWrapper(
|
||||||
@JsonProperty("album") val albumList: List<MusicDirectoryChild> = emptyList())
|
@JsonProperty("album") val albumList: List<MusicDirectoryChild> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -4,7 +4,9 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.Album
|
import org.moire.ultrasonic.api.subsonic.models.Album
|
||||||
|
|
||||||
class GetAlbumResponse(status: Status,
|
class GetAlbumResponse(
|
||||||
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?,
|
error: SubsonicError?,
|
||||||
val album: Album = Album()) : SubsonicResponse(status, version, error)
|
val album: Album = Album()
|
||||||
|
) : SubsonicResponse(status, version, error)
|
||||||
|
|
|
@ -4,8 +4,9 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.Artist
|
import org.moire.ultrasonic.api.subsonic.models.Artist
|
||||||
|
|
||||||
class GetArtistResponse(status: Status,
|
class GetArtistResponse(
|
||||||
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?,
|
error: SubsonicError?,
|
||||||
val artist: Artist = Artist())
|
val artist: Artist = Artist()
|
||||||
: SubsonicResponse(status, version, error)
|
) : SubsonicResponse(status, version, error)
|
||||||
|
|
|
@ -5,8 +5,9 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.Indexes
|
import org.moire.ultrasonic.api.subsonic.models.Indexes
|
||||||
|
|
||||||
class GetArtistsResponse(status: Status,
|
class GetArtistsResponse(
|
||||||
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?,
|
error: SubsonicError?,
|
||||||
@JsonProperty("artists") val indexes: Indexes = Indexes()) :
|
@JsonProperty("artists") val indexes: Indexes = Indexes()
|
||||||
SubsonicResponse(status, version, error)
|
) : SubsonicResponse(status, version, error)
|
||||||
|
|
|
@ -4,8 +4,9 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.Indexes
|
import org.moire.ultrasonic.api.subsonic.models.Indexes
|
||||||
|
|
||||||
class GetIndexesResponse(status: Status,
|
class GetIndexesResponse(
|
||||||
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?,
|
error: SubsonicError?,
|
||||||
val indexes: Indexes = Indexes()) :
|
val indexes: Indexes = Indexes()
|
||||||
SubsonicResponse(status, version, error)
|
) : SubsonicResponse(status, version, error)
|
||||||
|
|
|
@ -4,8 +4,9 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.Lyrics
|
import org.moire.ultrasonic.api.subsonic.models.Lyrics
|
||||||
|
|
||||||
class GetLyricsResponse(status: Status,
|
class GetLyricsResponse(
|
||||||
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?,
|
error: SubsonicError?,
|
||||||
val lyrics: Lyrics = Lyrics())
|
val lyrics: Lyrics = Lyrics()
|
||||||
: SubsonicResponse(status, version, error)
|
) : SubsonicResponse(status, version, error)
|
||||||
|
|
|
@ -5,9 +5,10 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.MusicDirectory
|
import org.moire.ultrasonic.api.subsonic.models.MusicDirectory
|
||||||
|
|
||||||
class GetMusicDirectoryResponse(status: Status,
|
class GetMusicDirectoryResponse(
|
||||||
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?,
|
error: SubsonicError?,
|
||||||
@JsonProperty("directory")
|
@JsonProperty("directory")
|
||||||
val musicDirectory: MusicDirectory = MusicDirectory()) :
|
val musicDirectory: MusicDirectory = MusicDirectory()
|
||||||
SubsonicResponse(status, version, error)
|
) : SubsonicResponse(status, version, error)
|
||||||
|
|
|
@ -8,4 +8,5 @@ class GetPlaylistResponse(
|
||||||
status: Status,
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?,
|
error: SubsonicError?,
|
||||||
val playlist: Playlist = Playlist()) : SubsonicResponse(status, version, error)
|
val playlist: Playlist = Playlist()
|
||||||
|
) : SubsonicResponse(status, version, error)
|
||||||
|
|
|
@ -5,10 +5,11 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.Playlist
|
import org.moire.ultrasonic.api.subsonic.models.Playlist
|
||||||
|
|
||||||
class GetPlaylistsResponse(status: Status,
|
class GetPlaylistsResponse(
|
||||||
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?)
|
error: SubsonicError?
|
||||||
: SubsonicResponse(status, version, error) {
|
) : SubsonicResponse(status, version, error) {
|
||||||
@JsonProperty("playlists")
|
@JsonProperty("playlists")
|
||||||
private val playlistsWrapper: PlaylistsWrapper = PlaylistsWrapper()
|
private val playlistsWrapper: PlaylistsWrapper = PlaylistsWrapper()
|
||||||
|
|
||||||
|
@ -17,4 +18,5 @@ class GetPlaylistsResponse(status: Status,
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PlaylistsWrapper(
|
private class PlaylistsWrapper(
|
||||||
@JsonProperty("playlist") val playlistList: List<Playlist> = emptyList())
|
@JsonProperty("playlist") val playlistList: List<Playlist> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -8,7 +8,8 @@ import org.moire.ultrasonic.api.subsonic.models.PodcastChannel
|
||||||
class GetPodcastsResponse(
|
class GetPodcastsResponse(
|
||||||
status: Status,
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?) : SubsonicResponse(status, version, error) {
|
error: SubsonicError?
|
||||||
|
) : SubsonicResponse(status, version, error) {
|
||||||
@JsonProperty("podcasts") private val channelsWrapper = PodcastChannelWrapper()
|
@JsonProperty("podcasts") private val channelsWrapper = PodcastChannelWrapper()
|
||||||
|
|
||||||
val podcastChannels: List<PodcastChannel>
|
val podcastChannels: List<PodcastChannel>
|
||||||
|
@ -16,4 +17,5 @@ class GetPodcastsResponse(
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PodcastChannelWrapper(
|
private class PodcastChannelWrapper(
|
||||||
@JsonProperty("channel") val channelsList: List<PodcastChannel> = emptyList())
|
@JsonProperty("channel") val channelsList: List<PodcastChannel> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -5,10 +5,11 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
||||||
|
|
||||||
class GetRandomSongsResponse(status: Status,
|
class GetRandomSongsResponse(
|
||||||
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?)
|
error: SubsonicError?
|
||||||
: SubsonicResponse(status, version, error) {
|
) : SubsonicResponse(status, version, error) {
|
||||||
@JsonProperty("randomSongs") private val songsWrapper = RandomSongsWrapper()
|
@JsonProperty("randomSongs") private val songsWrapper = RandomSongsWrapper()
|
||||||
|
|
||||||
val songsList
|
val songsList
|
||||||
|
@ -16,4 +17,5 @@ class GetRandomSongsResponse(status: Status,
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RandomSongsWrapper(
|
private class RandomSongsWrapper(
|
||||||
@JsonProperty("song") val songsList: List<MusicDirectoryChild> = emptyList())
|
@JsonProperty("song") val songsList: List<MusicDirectoryChild> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -8,11 +8,13 @@ import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
||||||
class GetSongsByGenreResponse(
|
class GetSongsByGenreResponse(
|
||||||
status: Status,
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?) : SubsonicResponse(status, version, error) {
|
error: SubsonicError?
|
||||||
|
) : SubsonicResponse(status, version, error) {
|
||||||
@JsonProperty("songsByGenre") private val songsByGenreList = SongsByGenreWrapper()
|
@JsonProperty("songsByGenre") private val songsByGenreList = SongsByGenreWrapper()
|
||||||
|
|
||||||
val songsList get() = songsByGenreList.songsList
|
val songsList get() = songsByGenreList.songsList
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class SongsByGenreWrapper(
|
internal class SongsByGenreWrapper(
|
||||||
@JsonProperty("song") val songsList: List<MusicDirectoryChild> = emptyList())
|
@JsonProperty("song") val songsList: List<MusicDirectoryChild> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -4,8 +4,9 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.SearchTwoResult
|
import org.moire.ultrasonic.api.subsonic.models.SearchTwoResult
|
||||||
|
|
||||||
class GetStarredResponse(status: Status,
|
class GetStarredResponse(
|
||||||
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?,
|
error: SubsonicError?,
|
||||||
val starred: SearchTwoResult = SearchTwoResult())
|
val starred: SearchTwoResult = SearchTwoResult()
|
||||||
: SubsonicResponse(status, version, error)
|
) : SubsonicResponse(status, version, error)
|
||||||
|
|
|
@ -4,8 +4,9 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.SearchTwoResult
|
import org.moire.ultrasonic.api.subsonic.models.SearchTwoResult
|
||||||
|
|
||||||
class GetStarredTwoResponse(status: Status,
|
class GetStarredTwoResponse(
|
||||||
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?,
|
error: SubsonicError?,
|
||||||
val starred2: SearchTwoResult = SearchTwoResult())
|
val starred2: SearchTwoResult = SearchTwoResult()
|
||||||
: SubsonicResponse(status, version, error)
|
) : SubsonicResponse(status, version, error)
|
||||||
|
|
|
@ -8,4 +8,5 @@ class GetUserResponse(
|
||||||
status: Status,
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?,
|
error: SubsonicError?,
|
||||||
val user: User = User()) : SubsonicResponse(status, version, error)
|
val user: User = User()
|
||||||
|
) : SubsonicResponse(status, version, error)
|
||||||
|
|
|
@ -5,11 +5,12 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.JukeboxStatus
|
import org.moire.ultrasonic.api.subsonic.models.JukeboxStatus
|
||||||
|
|
||||||
class JukeboxResponse(status: Status,
|
class JukeboxResponse(
|
||||||
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?,
|
error: SubsonicError?,
|
||||||
var jukebox: JukeboxStatus = JukeboxStatus())
|
var jukebox: JukeboxStatus = JukeboxStatus()
|
||||||
: SubsonicResponse(status, version, error) {
|
) : SubsonicResponse(status, version, error) {
|
||||||
@JsonSetter("jukeboxStatus") fun setJukeboxStatus(jukebox: JukeboxStatus) {
|
@JsonSetter("jukeboxStatus") fun setJukeboxStatus(jukebox: JukeboxStatus) {
|
||||||
this.jukebox = jukebox
|
this.jukebox = jukebox
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,9 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.License
|
import org.moire.ultrasonic.api.subsonic.models.License
|
||||||
|
|
||||||
class LicenseResponse(val license: License = License(),
|
class LicenseResponse(
|
||||||
|
val license: License = License(),
|
||||||
status: Status,
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?) :
|
error: SubsonicError?
|
||||||
SubsonicResponse(status, version, error)
|
) : SubsonicResponse(status, version, error)
|
||||||
|
|
|
@ -5,14 +5,16 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.MusicFolder
|
import org.moire.ultrasonic.api.subsonic.models.MusicFolder
|
||||||
|
|
||||||
class MusicFoldersResponse(status: Status,
|
class MusicFoldersResponse(
|
||||||
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?) :
|
error: SubsonicError?
|
||||||
SubsonicResponse(status, version, error) {
|
) : SubsonicResponse(status, version, error) {
|
||||||
@JsonProperty("musicFolders") private val wrapper = MusicFoldersWrapper()
|
@JsonProperty("musicFolders") private val wrapper = MusicFoldersWrapper()
|
||||||
|
|
||||||
val musicFolders get() = wrapper.musicFolders
|
val musicFolders get() = wrapper.musicFolders
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class MusicFoldersWrapper(
|
internal class MusicFoldersWrapper(
|
||||||
@JsonProperty("musicFolder") val musicFolders: List<MusicFolder> = emptyList())
|
@JsonProperty("musicFolder") val musicFolders: List<MusicFolder> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -4,8 +4,9 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.SearchResult
|
import org.moire.ultrasonic.api.subsonic.models.SearchResult
|
||||||
|
|
||||||
class SearchResponse(status: Status,
|
class SearchResponse(
|
||||||
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?,
|
error: SubsonicError?,
|
||||||
val searchResult: SearchResult = SearchResult())
|
val searchResult: SearchResult = SearchResult()
|
||||||
: SubsonicResponse(status, version, error)
|
) : SubsonicResponse(status, version, error)
|
||||||
|
|
|
@ -9,5 +9,5 @@ class SearchThreeResponse(
|
||||||
status: Status,
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?,
|
error: SubsonicError?,
|
||||||
@JsonProperty("searchResult3") val searchResult: SearchThreeResult = SearchThreeResult())
|
@JsonProperty("searchResult3") val searchResult: SearchThreeResult = SearchThreeResult()
|
||||||
: SubsonicResponse(status, version, error)
|
) : SubsonicResponse(status, version, error)
|
||||||
|
|
|
@ -9,5 +9,5 @@ class SearchTwoResponse(
|
||||||
status: Status,
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?,
|
error: SubsonicError?,
|
||||||
@JsonProperty("searchResult2") val searchResult: SearchTwoResult = SearchTwoResult())
|
@JsonProperty("searchResult2") val searchResult: SearchTwoResult = SearchTwoResult()
|
||||||
: SubsonicResponse(status, version, error)
|
) : SubsonicResponse(status, version, error)
|
||||||
|
|
|
@ -5,10 +5,11 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.Share
|
import org.moire.ultrasonic.api.subsonic.models.Share
|
||||||
|
|
||||||
class SharesResponse(status: Status,
|
class SharesResponse(
|
||||||
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?)
|
error: SubsonicError?
|
||||||
: SubsonicResponse(status, version, error) {
|
) : SubsonicResponse(status, version, error) {
|
||||||
@JsonProperty("shares") private val wrappedShares = SharesWrapper()
|
@JsonProperty("shares") private val wrappedShares = SharesWrapper()
|
||||||
|
|
||||||
val shares get() = wrappedShares.share
|
val shares get() = wrappedShares.share
|
||||||
|
|
|
@ -9,9 +9,11 @@ import java.io.InputStream
|
||||||
*
|
*
|
||||||
* [responseHttpCode] will be there always.
|
* [responseHttpCode] will be there always.
|
||||||
*/
|
*/
|
||||||
class StreamResponse(val stream: InputStream? = null,
|
class StreamResponse(
|
||||||
|
val stream: InputStream? = null,
|
||||||
val apiError: SubsonicError? = null,
|
val apiError: SubsonicError? = null,
|
||||||
val responseHttpCode: Int) {
|
val responseHttpCode: Int
|
||||||
|
) {
|
||||||
/**
|
/**
|
||||||
* Check if this response has error.
|
* Check if this response has error.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,9 +13,11 @@ import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
* Base Subsonic API response.
|
* Base Subsonic API response.
|
||||||
*/
|
*/
|
||||||
@JsonRootName(value = "subsonic-response")
|
@JsonRootName(value = "subsonic-response")
|
||||||
open class SubsonicResponse(val status: Status,
|
open class SubsonicResponse(
|
||||||
|
val status: Status,
|
||||||
val version: SubsonicAPIVersions,
|
val version: SubsonicAPIVersions,
|
||||||
val error: SubsonicError?) {
|
val error: SubsonicError?
|
||||||
|
) {
|
||||||
@JsonDeserialize(using = Status.Companion.StatusJsonDeserializer::class)
|
@JsonDeserialize(using = Status.Companion.StatusJsonDeserializer::class)
|
||||||
enum class Status(val jsonValue: String) {
|
enum class Status(val jsonValue: String) {
|
||||||
OK("ok"), ERROR("failed");
|
OK("ok"), ERROR("failed");
|
||||||
|
|
|
@ -8,11 +8,13 @@ import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
||||||
class VideosResponse(
|
class VideosResponse(
|
||||||
status: Status,
|
status: Status,
|
||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?) : SubsonicResponse(status, version, error) {
|
error: SubsonicError?
|
||||||
|
) : SubsonicResponse(status, version, error) {
|
||||||
@JsonProperty("videos") private val videosWrapper = VideosWrapper()
|
@JsonProperty("videos") private val videosWrapper = VideosWrapper()
|
||||||
|
|
||||||
val videosList: List<MusicDirectoryChild> get() = videosWrapper.videosList
|
val videosList: List<MusicDirectoryChild> get() = videosWrapper.videosList
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class VideosWrapper(
|
internal class VideosWrapper(
|
||||||
@JsonProperty("video") val videosList: List<MusicDirectoryChild> = emptyList())
|
@JsonProperty("video") val videosList: List<MusicDirectoryChild> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic.models
|
package org.moire.ultrasonic.api.subsonic.models
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.amshove.kluent.`should equal`
|
import org.amshove.kluent.`should equal`
|
||||||
import org.amshove.kluent.`should throw`
|
import org.amshove.kluent.`should throw`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -36,6 +36,6 @@ class AlbumListTypeTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Should return type name for toString call`() {
|
fun `Should return type name for toString call`() {
|
||||||
AlbumListType.STARRED.typeName `should equal to` AlbumListType.STARRED.toString()
|
AlbumListType.STARRED.typeName `should be equal to` AlbumListType.STARRED.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.moire.ultrasonic.api.subsonic.response
|
package org.moire.ultrasonic.api.subsonic.response
|
||||||
|
|
||||||
import org.amshove.kluent.`should equal to`
|
import org.amshove.kluent.`should be equal to`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicError.RequestedDataWasNotFound
|
import org.moire.ultrasonic.api.subsonic.SubsonicError.RequestedDataWasNotFound
|
||||||
|
|
||||||
|
@ -11,26 +11,26 @@ class StreamResponseTest {
|
||||||
@Test
|
@Test
|
||||||
fun `Should have error if subsonic error is not null`() {
|
fun `Should have error if subsonic error is not null`() {
|
||||||
StreamResponse(apiError = RequestedDataWasNotFound, responseHttpCode = 200)
|
StreamResponse(apiError = RequestedDataWasNotFound, responseHttpCode = 200)
|
||||||
.hasError() `should equal to` true
|
.hasError() `should be equal to` true
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Should have error if http error is greater then 300`() {
|
fun `Should have error if http error is greater then 300`() {
|
||||||
StreamResponse(responseHttpCode = 301).hasError() `should equal to` true
|
StreamResponse(responseHttpCode = 301).hasError() `should be equal to` true
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Should have error of http error code is lower then 200`() {
|
fun `Should have error of http error code is lower then 200`() {
|
||||||
StreamResponse(responseHttpCode = 199).hasError() `should equal to` true
|
StreamResponse(responseHttpCode = 199).hasError() `should be equal to` true
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Should not have error if http code is 200`() {
|
fun `Should not have error if http code is 200`() {
|
||||||
StreamResponse(responseHttpCode = 200).hasError() `should equal to` false
|
StreamResponse(responseHttpCode = 200).hasError() `should be equal to` false
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Should not have error if http code is 300`() {
|
fun `Should not have error if http code is 300`() {
|
||||||
StreamResponse(responseHttpCode = 300).hasError() `should equal to` false
|
StreamResponse(responseHttpCode = 300).hasError() `should be equal to` false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
|
|
||||||
<application
|
<application
|
||||||
a:allowBackup="false"
|
a:allowBackup="false"
|
||||||
a:icon="@drawable/ic_launcher"
|
a:icon="@mipmap/ic_launcher"
|
||||||
|
a:roundIcon="@mipmap/ic_launcher_round"
|
||||||
a:theme="@style/Theme.AppCompat"
|
a:theme="@style/Theme.AppCompat"
|
||||||
a:label="@string/common.appname">
|
a:label="@string/common.appname">
|
||||||
<activity
|
<activity
|
||||||
|
|
|
@ -1094,7 +1094,7 @@ public class DownloadServiceImpl extends Service implements DownloadService
|
||||||
}
|
}
|
||||||
setPlayerState(STOPPED);
|
setPlayerState(STOPPED);
|
||||||
}
|
}
|
||||||
else if (playerState == PAUSED)
|
else
|
||||||
{
|
{
|
||||||
setPlayerState(STOPPED);
|
setPlayerState(STOPPED);
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,9 +131,6 @@ public final class Constants
|
||||||
public static final String PREFERENCES_KEY_SCAN_MEDIA = "scanMedia";
|
public static final String PREFERENCES_KEY_SCAN_MEDIA = "scanMedia";
|
||||||
public static final String PREFERENCES_KEY_IMAGE_LOADER_CONCURRENCY = "imageLoaderConcurrency";
|
public static final String PREFERENCES_KEY_IMAGE_LOADER_CONCURRENCY = "imageLoaderConcurrency";
|
||||||
|
|
||||||
// Name of the preferences file.
|
|
||||||
public static final String PREFERENCES_FILE_NAME = "org.moire.ultrasonic_preferences";
|
|
||||||
|
|
||||||
// Number of free trial days for non-licensed servers.
|
// Number of free trial days for non-licensed servers.
|
||||||
public static final int FREE_TRIAL_DAYS = 30;
|
public static final int FREE_TRIAL_DAYS = 30;
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue