mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-04-27 22:22:17 +03:00
Use default values for getMusicDirectory response.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
decf680076
commit
0920cc94a8
@ -2,6 +2,7 @@ package org.moire.ultrasonic.api.subsonic
|
|||||||
|
|
||||||
import org.amshove.kluent.`should be`
|
import org.amshove.kluent.`should be`
|
||||||
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.amshove.kluent.`should not be`
|
import org.amshove.kluent.`should not be`
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -17,7 +18,17 @@ class SubsonicApiGetMusicDirectoryTest : SubsonicAPIClientTest() {
|
|||||||
client.api.getMusicDirectory(1).execute()
|
client.api.getMusicDirectory(1).execute()
|
||||||
})
|
})
|
||||||
|
|
||||||
response.musicDirectory `should be` null
|
with(response.musicDirectory) {
|
||||||
|
this `should not be` null
|
||||||
|
id `should equal to` -1L
|
||||||
|
parent `should equal to` -1L
|
||||||
|
name `should equal to` ""
|
||||||
|
userRating `should equal to` 0
|
||||||
|
averageRating `should equal to` 0.0f
|
||||||
|
starred `should be` null
|
||||||
|
playCount `should equal to` 0
|
||||||
|
childList `should be` emptyList<MusicDirectoryChild>()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -39,17 +50,29 @@ 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` 382L
|
id `should equal to` 4836L
|
||||||
name `should equal` "AC_DC"
|
parent `should equal to` 300L
|
||||||
starred `should equal` parseDate("2017-04-02T20:16:29.815Z")
|
name `should equal` "12 Stones"
|
||||||
|
userRating `should equal to` 5
|
||||||
|
averageRating `should equal to` 5.0f
|
||||||
|
starred `should equal` null
|
||||||
|
playCount `should equal to` 1
|
||||||
childList.size `should be` 2
|
childList.size `should be` 2
|
||||||
childList[0] `should equal` MusicDirectoryChild(583L, 382L, true, "Black Ice",
|
childList[0] `should equal` MusicDirectoryChild(id = 4844L, parent = 4836L, isDir = false,
|
||||||
"Black Ice", "AC/DC", 2008, "Hard Rock", 583L,
|
title = "Crash", album = "12 Stones", artist = "12 Stones", track = 1, year = 2002,
|
||||||
parseDate("2016-10-23T15:31:22.000Z"), parseDate("2017-04-02T20:16:15.724Z"))
|
genre = "Alternative Rock", coverArt = 4836L, size = 5348318L,
|
||||||
childList[1] `should equal` MusicDirectoryChild(582L, 382L, true, "Rock or Bust",
|
contentType = "audio/mpeg", suffix = "mp3", duration = 222, bitRate = 192,
|
||||||
"Rock or Bust", "AC/DC", 2014, "Hard Rock", 582L,
|
path = "12 Stones/12 Stones/01 Crash.mp3", isVideo = false, playCount = 0,
|
||||||
parseDate("2016-10-23T15:31:24.000Z"), null)
|
discNumber = 1, created = parseDate("2016-10-23T15:19:10.000Z"),
|
||||||
|
albumId = 454L, artistId = 288L, type = "music")
|
||||||
|
childList[1] `should equal` MusicDirectoryChild(id = 4845L, parent = 4836L, isDir = false,
|
||||||
|
title = "Broken", album = "12 Stones", artist = "12 Stones", track = 2, year = 2002,
|
||||||
|
genre = "Alternative Rock", coverArt = 4836L, size = 4309043L,
|
||||||
|
contentType = "audio/mpeg", suffix = "mp3", duration = 179, bitRate = 192,
|
||||||
|
path = "12 Stones/12 Stones/02 Broken.mp3", isVideo = false, playCount = 0,
|
||||||
|
discNumber = 1, created = parseDate("2016-10-23T15:19:09.000Z"),
|
||||||
|
albumId = 454L, artistId = 288L, type = "music")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,34 +1,62 @@
|
|||||||
{
|
{
|
||||||
"subsonic-response" : {
|
"subsonic-response" : {
|
||||||
"status" : "ok",
|
"status" : "ok",
|
||||||
"version" : "1.13.0",
|
"version" : "1.15.0",
|
||||||
"directory" : {
|
"directory" : {
|
||||||
"id" : "382",
|
"id" : "4836",
|
||||||
"name" : "AC_DC",
|
"parent" : "300",
|
||||||
"starred" : "2017-04-02T20:16:29.815Z",
|
"name" : "12 Stones",
|
||||||
|
"userRating" : 5,
|
||||||
|
"averageRating" : 5.0,
|
||||||
|
"playCount" : 1,
|
||||||
"child" : [ {
|
"child" : [ {
|
||||||
"id" : "583",
|
"id" : "4844",
|
||||||
"parent" : "382",
|
"parent" : "4836",
|
||||||
"isDir" : true,
|
"isDir" : false,
|
||||||
"title" : "Black Ice",
|
"title" : "Crash",
|
||||||
"album" : "Black Ice",
|
"album" : "12 Stones",
|
||||||
"artist" : "AC/DC",
|
"artist" : "12 Stones",
|
||||||
"year" : 2008,
|
"track" : 1,
|
||||||
"genre" : "Hard Rock",
|
"year" : 2002,
|
||||||
"coverArt" : "583",
|
"genre" : "Alternative Rock",
|
||||||
"created" : "2016-10-23T15:31:22.000Z",
|
"coverArt" : "4836",
|
||||||
"starred" : "2017-04-02T20:16:15.724Z"
|
"size" : 5348318,
|
||||||
|
"contentType" : "audio/mpeg",
|
||||||
|
"suffix" : "mp3",
|
||||||
|
"duration" : 222,
|
||||||
|
"bitRate" : 192,
|
||||||
|
"path" : "12 Stones/12 Stones/01 Crash.mp3",
|
||||||
|
"isVideo" : false,
|
||||||
|
"playCount" : 0,
|
||||||
|
"discNumber" : 1,
|
||||||
|
"created" : "2016-10-23T15:19:10.000Z",
|
||||||
|
"albumId" : "454",
|
||||||
|
"artistId" : "288",
|
||||||
|
"type" : "music"
|
||||||
}, {
|
}, {
|
||||||
"id" : "582",
|
"id" : "4845",
|
||||||
"parent" : "382",
|
"parent" : "4836",
|
||||||
"isDir" : true,
|
"isDir" : false,
|
||||||
"title" : "Rock or Bust",
|
"title" : "Broken",
|
||||||
"album" : "Rock or Bust",
|
"album" : "12 Stones",
|
||||||
"artist" : "AC/DC",
|
"artist" : "12 Stones",
|
||||||
"year" : 2014,
|
"track" : 2,
|
||||||
"genre" : "Hard Rock",
|
"year" : 2002,
|
||||||
"coverArt" : "582",
|
"genre" : "Alternative Rock",
|
||||||
"created" : "2016-10-23T15:31:24.000Z"
|
"coverArt" : "4836",
|
||||||
|
"size" : 4309043,
|
||||||
|
"contentType" : "audio/mpeg",
|
||||||
|
"suffix" : "mp3",
|
||||||
|
"duration" : 179,
|
||||||
|
"bitRate" : 192,
|
||||||
|
"path" : "12 Stones/12 Stones/02 Broken.mp3",
|
||||||
|
"isVideo" : false,
|
||||||
|
"playCount" : 0,
|
||||||
|
"discNumber" : 1,
|
||||||
|
"created" : "2016-10-23T15:19:09.000Z",
|
||||||
|
"albumId" : "454",
|
||||||
|
"artistId" : "288",
|
||||||
|
"type" : "music"
|
||||||
} ]
|
} ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,8 +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 MusicDirectory(val id: Long,
|
data class MusicDirectory(val id: Long = -1L,
|
||||||
val name: String,
|
val parent: Long = -1L,
|
||||||
val starred: Calendar?,
|
val name: String = "",
|
||||||
|
val userRating: Int = 0,
|
||||||
|
val averageRating: Float = 0.0f,
|
||||||
|
val starred: Calendar? = null,
|
||||||
|
val playCount: Int = 0,
|
||||||
@JsonProperty("child")
|
@JsonProperty("child")
|
||||||
val childList: List<MusicDirectoryChild> = emptyList())
|
val childList: List<MusicDirectoryChild> = emptyList())
|
||||||
|
@ -2,8 +2,29 @@ package org.moire.ultrasonic.api.subsonic.models
|
|||||||
|
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
|
||||||
data class MusicDirectoryChild(val id: Long, val parent: Long, val isDir: Boolean = false,
|
data class MusicDirectoryChild(val id: Long = -1L,
|
||||||
val title: String = "", val album: String = "",
|
val parent: Long = -1L,
|
||||||
val artist: String = "", val year: Int?,
|
val isDir: Boolean = false,
|
||||||
val genre: String = "", val coverArt: Long = -1,
|
val title: String = "",
|
||||||
val created: Calendar, val starred: Calendar?)
|
val album: String = "",
|
||||||
|
val artist: String = "",
|
||||||
|
val track: Int = -1,
|
||||||
|
val year: Int? = null,
|
||||||
|
val genre: String = "",
|
||||||
|
val coverArt: Long? = null,
|
||||||
|
val size: Long = -1,
|
||||||
|
val contentType: String = "",
|
||||||
|
val suffix: String = "",
|
||||||
|
val transcodedContentType: String = "",
|
||||||
|
val transcodedSuffix: String = "",
|
||||||
|
val duration: Int = -1,
|
||||||
|
val bitRate: Int = -1,
|
||||||
|
val path: String = "",
|
||||||
|
val isVideo: Boolean = false,
|
||||||
|
val playCount: Int = 0,
|
||||||
|
val discNumber: Int = -1,
|
||||||
|
val created: Calendar? = null,
|
||||||
|
val albumId: Long = -1,
|
||||||
|
val artistId: Long = -1,
|
||||||
|
val type: String = "",
|
||||||
|
val starred: Calendar? = null)
|
||||||
|
@ -9,5 +9,5 @@ class GetMusicDirectoryResponse(status: Status,
|
|||||||
version: SubsonicAPIVersions,
|
version: SubsonicAPIVersions,
|
||||||
error: SubsonicError?,
|
error: SubsonicError?,
|
||||||
@JsonProperty("directory")
|
@JsonProperty("directory")
|
||||||
val musicDirectory: MusicDirectory?) :
|
val musicDirectory: MusicDirectory = MusicDirectory()) :
|
||||||
SubsonicResponse(status, version, error)
|
SubsonicResponse(status, version, error)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user