Update Ktlint to 0.20.0 version.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
46922d98ae
commit
eb09e9b417
|
@ -19,9 +19,9 @@ internal const val STORAGE_DIR_NAME = "persistent_storage"
|
||||||
* Look at [org.moire.ultrasonic.cache.serializers] package for available [DomainEntitySerializer]s.
|
* Look at [org.moire.ultrasonic.cache.serializers] package for available [DomainEntitySerializer]s.
|
||||||
*/
|
*/
|
||||||
class PermanentFileStorage(
|
class PermanentFileStorage(
|
||||||
private val directories: Directories,
|
private val directories: Directories,
|
||||||
private val serverId: String,
|
private val serverId: String,
|
||||||
private val debug: Boolean = false
|
private val debug: Boolean = false
|
||||||
) {
|
) {
|
||||||
private val serializationContext = object : SerializationContext {
|
private val serializationContext = object : SerializationContext {
|
||||||
override fun isDebug(): Boolean = debug
|
override fun isDebug(): Boolean = debug
|
||||||
|
@ -34,9 +34,9 @@ class PermanentFileStorage(
|
||||||
* Stores given [objectToStore] using [name] as a key and [objectSerializer] as serializer.
|
* Stores given [objectToStore] using [name] as a key and [objectSerializer] as serializer.
|
||||||
*/
|
*/
|
||||||
fun <T> store(
|
fun <T> store(
|
||||||
name: String,
|
name: String,
|
||||||
objectToStore: T,
|
objectToStore: T,
|
||||||
objectSerializer: DomainEntitySerializer<T>
|
objectSerializer: DomainEntitySerializer<T>
|
||||||
) {
|
) {
|
||||||
val storeFile = getFile(name)
|
val storeFile = getFile(name)
|
||||||
if (!storeFile.exists()) storeFile.createNewFile()
|
if (!storeFile.exists()) storeFile.createNewFile()
|
||||||
|
@ -47,8 +47,8 @@ class PermanentFileStorage(
|
||||||
* Loads object with [name] key using [objectDeserializer] deserializer.
|
* Loads object with [name] key using [objectDeserializer] deserializer.
|
||||||
*/
|
*/
|
||||||
fun <T> load(
|
fun <T> load(
|
||||||
name: String,
|
name: String,
|
||||||
objectDeserializer: DomainEntitySerializer<T>
|
objectDeserializer: DomainEntitySerializer<T>
|
||||||
): T? {
|
): T? {
|
||||||
val storeFile = getFile(name)
|
val storeFile = getFile(name)
|
||||||
if (!storeFile.exists()) return null
|
if (!storeFile.exists()) return null
|
||||||
|
|
|
@ -15,9 +15,9 @@ private const val SERIALIZER_VERSION = 1
|
||||||
|
|
||||||
private val artistSerializer get() = object : ObjectSerializer<Artist>(SERIALIZER_VERSION) {
|
private val artistSerializer get() = object : ObjectSerializer<Artist>(SERIALIZER_VERSION) {
|
||||||
override fun serializeObject(
|
override fun serializeObject(
|
||||||
context: SerializationContext,
|
context: SerializationContext,
|
||||||
output: SerializerOutput<out SerializerOutput<*>>,
|
output: SerializerOutput<out SerializerOutput<*>>,
|
||||||
item: Artist
|
item: Artist
|
||||||
) {
|
) {
|
||||||
output.writeString(item.id)
|
output.writeString(item.id)
|
||||||
.writeString(item.name)
|
.writeString(item.name)
|
||||||
|
@ -31,9 +31,9 @@ private val artistSerializer get() = object : ObjectSerializer<Artist>(SERIALIZE
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun deserializeObject(
|
override fun deserializeObject(
|
||||||
context: SerializationContext,
|
context: SerializationContext,
|
||||||
input: SerializerInput,
|
input: SerializerInput,
|
||||||
versionNumber: Int
|
versionNumber: Int
|
||||||
): Artist? {
|
): Artist? {
|
||||||
if (versionNumber != SERIALIZER_VERSION) return null
|
if (versionNumber != SERIALIZER_VERSION) return null
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ private const val SERIALIZATION_VERSION = 1
|
||||||
|
|
||||||
private val indexesSerializer get() = object : ObjectSerializer<Indexes>(SERIALIZATION_VERSION) {
|
private val indexesSerializer get() = object : ObjectSerializer<Indexes>(SERIALIZATION_VERSION) {
|
||||||
override fun serializeObject(
|
override fun serializeObject(
|
||||||
context: SerializationContext,
|
context: SerializationContext,
|
||||||
output: SerializerOutput<out SerializerOutput<*>>,
|
output: SerializerOutput<out SerializerOutput<*>>,
|
||||||
item: Indexes
|
item: Indexes
|
||||||
) {
|
) {
|
||||||
val artistListSerializer = getArtistListSerializer()
|
val artistListSerializer = getArtistListSerializer()
|
||||||
output.writeLong(item.lastModified)
|
output.writeLong(item.lastModified)
|
||||||
|
@ -26,9 +26,9 @@ private val indexesSerializer get() = object : ObjectSerializer<Indexes>(SERIALI
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun deserializeObject(
|
override fun deserializeObject(
|
||||||
context: SerializationContext,
|
context: SerializationContext,
|
||||||
input: SerializerInput,
|
input: SerializerInput,
|
||||||
versionNumber: Int
|
versionNumber: Int
|
||||||
): Indexes? {
|
): Indexes? {
|
||||||
if (versionNumber != SERIALIZATION_VERSION) return null
|
if (versionNumber != SERIALIZATION_VERSION) return null
|
||||||
|
|
||||||
|
|
|
@ -15,17 +15,17 @@ private const val SERIALIZATION_VERSION = 1
|
||||||
private val musicFolderSerializer = object : ObjectSerializer<MusicFolder>(SERIALIZATION_VERSION) {
|
private val musicFolderSerializer = object : ObjectSerializer<MusicFolder>(SERIALIZATION_VERSION) {
|
||||||
|
|
||||||
override fun serializeObject(
|
override fun serializeObject(
|
||||||
context: SerializationContext,
|
context: SerializationContext,
|
||||||
output: SerializerOutput<out SerializerOutput<*>>,
|
output: SerializerOutput<out SerializerOutput<*>>,
|
||||||
item: MusicFolder
|
item: MusicFolder
|
||||||
) {
|
) {
|
||||||
output.writeString(item.id).writeString(item.name)
|
output.writeString(item.id).writeString(item.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun deserializeObject(
|
override fun deserializeObject(
|
||||||
context: SerializationContext,
|
context: SerializationContext,
|
||||||
input: SerializerInput,
|
input: SerializerInput,
|
||||||
versionNumber: Int
|
versionNumber: Int
|
||||||
): MusicFolder? {
|
): MusicFolder? {
|
||||||
if (versionNumber != SERIALIZATION_VERSION) return null
|
if (versionNumber != SERIALIZATION_VERSION) return null
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ ext.versions = [
|
||||||
gradle : '4.5.1',
|
gradle : '4.5.1',
|
||||||
|
|
||||||
androidTools : "3.0.1",
|
androidTools : "3.0.1",
|
||||||
ktlint : "0.15.1",
|
ktlint : "0.20.0",
|
||||||
ktlintGradle : "3.2.0",
|
ktlintGradle : "3.2.0",
|
||||||
detekt : "1.0.0.RC6-4",
|
detekt : "1.0.0.RC6-4",
|
||||||
jacoco : "0.7.9",
|
jacoco : "0.7.9",
|
||||||
|
|
|
@ -3,12 +3,12 @@ package org.moire.ultrasonic.domain
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
data class Artist(
|
data class Artist(
|
||||||
var id: String? = null,
|
var id: String? = null,
|
||||||
var name: String? = null,
|
var name: String? = null,
|
||||||
var index: String? = null,
|
var index: String? = null,
|
||||||
var coverArt: String? = null,
|
var coverArt: String? = null,
|
||||||
var albumCount: Long? = null,
|
var albumCount: Long? = null,
|
||||||
var closeness: Int = 0
|
var closeness: Int = 0
|
||||||
) : Serializable {
|
) : Serializable {
|
||||||
companion object {
|
companion object {
|
||||||
private const val serialVersionUID = -5790532593784846982L
|
private const val serialVersionUID = -5790532593784846982L
|
||||||
|
|
|
@ -6,12 +6,12 @@ import java.io.Serializable
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
data class Bookmark(
|
data class Bookmark(
|
||||||
val position: Int = 0,
|
val position: Int = 0,
|
||||||
val username: String,
|
val username: String,
|
||||||
val comment: String,
|
val comment: String,
|
||||||
val created: Date? = null,
|
val created: Date? = null,
|
||||||
val changed: Date? = null,
|
val changed: Date? = null,
|
||||||
val entry: Entry
|
val entry: Entry
|
||||||
) : Serializable {
|
) : Serializable {
|
||||||
companion object {
|
companion object {
|
||||||
private const val serialVersionUID = 8988990025189807803L
|
private const val serialVersionUID = 8988990025189807803L
|
||||||
|
|
|
@ -3,9 +3,9 @@ package org.moire.ultrasonic.domain
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
data class ChatMessage(
|
data class ChatMessage(
|
||||||
val username: String,
|
val username: String,
|
||||||
val time: Long,
|
val time: Long,
|
||||||
val message: String
|
val message: String
|
||||||
) : Serializable {
|
) : Serializable {
|
||||||
companion object {
|
companion object {
|
||||||
private const val serialVersionUID = 496544310289324167L
|
private const val serialVersionUID = 496544310289324167L
|
||||||
|
|
|
@ -3,8 +3,8 @@ package org.moire.ultrasonic.domain
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
data class Genre(
|
data class Genre(
|
||||||
val name: String,
|
val name: String,
|
||||||
val index: String
|
val index: String
|
||||||
) : Serializable {
|
) : Serializable {
|
||||||
companion object {
|
companion object {
|
||||||
private const val serialVersionUID = -3943025175219134028L
|
private const val serialVersionUID = -3943025175219134028L
|
||||||
|
|
|
@ -3,10 +3,10 @@ package org.moire.ultrasonic.domain
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
data class Indexes(
|
data class Indexes(
|
||||||
val lastModified: Long,
|
val lastModified: Long,
|
||||||
val ignoredArticles: String,
|
val ignoredArticles: String,
|
||||||
val shortcuts: MutableList<Artist> = mutableListOf(),
|
val shortcuts: MutableList<Artist> = mutableListOf(),
|
||||||
val artists: MutableList<Artist> = mutableListOf()
|
val artists: MutableList<Artist> = mutableListOf()
|
||||||
) : Serializable {
|
) : Serializable {
|
||||||
companion object {
|
companion object {
|
||||||
private const val serialVersionUID = 8156117238598414701L
|
private const val serialVersionUID = 8156117238598414701L
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package org.moire.ultrasonic.domain
|
package org.moire.ultrasonic.domain
|
||||||
|
|
||||||
data class JukeboxStatus(
|
data class JukeboxStatus(
|
||||||
var positionSeconds: Int? = null,
|
var positionSeconds: Int? = null,
|
||||||
var currentPlayingIndex: Int? = null,
|
var currentPlayingIndex: Int? = null,
|
||||||
var gain: Float? = null,
|
var gain: Float? = null,
|
||||||
var isPlaying: Boolean = false
|
var isPlaying: Boolean = false
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,7 +4,7 @@ package org.moire.ultrasonic.domain
|
||||||
* Song lyrics.
|
* Song lyrics.
|
||||||
*/
|
*/
|
||||||
data class Lyrics(
|
data class Lyrics(
|
||||||
val artist: String? = null,
|
val artist: String? = null,
|
||||||
val title: String? = null,
|
val title: String? = null,
|
||||||
val text: String? = null
|
val text: String? = null
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,8 +25,9 @@ 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
|
||||||
}
|
}
|
||||||
|
@ -35,34 +36,34 @@ class MusicDirectory {
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Entry(
|
data class Entry(
|
||||||
var id: String? = null,
|
var id: String? = null,
|
||||||
var parent: String? = null,
|
var parent: String? = null,
|
||||||
var isDirectory: Boolean = false,
|
var isDirectory: Boolean = false,
|
||||||
var title: String? = null,
|
var title: String? = null,
|
||||||
var album: String? = null,
|
var album: String? = null,
|
||||||
var albumId: String? = null,
|
var albumId: String? = null,
|
||||||
var artist: String? = null,
|
var artist: String? = null,
|
||||||
var artistId: String? = null,
|
var artistId: String? = null,
|
||||||
var track: Int? = 0,
|
var track: Int? = 0,
|
||||||
var year: Int? = 0,
|
var year: Int? = 0,
|
||||||
var genre: String? = null,
|
var genre: String? = null,
|
||||||
var contentType: String? = null,
|
var contentType: String? = null,
|
||||||
var suffix: String? = null,
|
var suffix: String? = null,
|
||||||
var transcodedContentType: String? = null,
|
var transcodedContentType: String? = null,
|
||||||
var transcodedSuffix: String? = null,
|
var transcodedSuffix: String? = null,
|
||||||
var coverArt: String? = null,
|
var coverArt: String? = null,
|
||||||
var size: Long? = null,
|
var size: Long? = null,
|
||||||
var songCount: Long? = null,
|
var songCount: Long? = null,
|
||||||
var duration: Int? = null,
|
var duration: Int? = null,
|
||||||
var bitRate: Int? = null,
|
var bitRate: Int? = null,
|
||||||
var path: String? = null,
|
var path: String? = null,
|
||||||
var isVideo: Boolean = false,
|
var isVideo: Boolean = false,
|
||||||
var starred: Boolean = false,
|
var starred: Boolean = false,
|
||||||
var discNumber: Int? = null,
|
var discNumber: Int? = null,
|
||||||
var type: String? = null,
|
var type: String? = null,
|
||||||
var created: Date? = null,
|
var created: Date? = null,
|
||||||
var closeness: Int = 0,
|
var closeness: Int = 0,
|
||||||
var bookmarkPosition: Int = 0
|
var bookmarkPosition: Int = 0
|
||||||
) : Serializable {
|
) : Serializable {
|
||||||
fun setDuration(duration: Long) {
|
fun setDuration(duration: Long) {
|
||||||
this.duration = duration.toInt()
|
this.duration = duration.toInt()
|
||||||
|
|
|
@ -4,6 +4,6 @@ package org.moire.ultrasonic.domain
|
||||||
* Represents a top level directory in which music or other media is stored.
|
* Represents a top level directory in which music or other media is stored.
|
||||||
*/
|
*/
|
||||||
data class MusicFolder(
|
data class MusicFolder(
|
||||||
val id: String,
|
val id: String,
|
||||||
val name: String
|
val name: String
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,13 +3,13 @@ package org.moire.ultrasonic.domain
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
data class Playlist @JvmOverloads constructor(
|
data class Playlist @JvmOverloads constructor(
|
||||||
val id: String,
|
val id: String,
|
||||||
var name: String,
|
var name: String,
|
||||||
val owner: String = "",
|
val owner: String = "",
|
||||||
val comment: String = "",
|
val comment: String = "",
|
||||||
val songCount: String = "",
|
val songCount: String = "",
|
||||||
val created: String = "",
|
val created: String = "",
|
||||||
val public: Boolean? = null
|
val public: Boolean? = null
|
||||||
) : Serializable {
|
) : Serializable {
|
||||||
companion object {
|
companion object {
|
||||||
private const val serialVersionUID = -4160515427075433798L
|
private const val serialVersionUID = -4160515427075433798L
|
||||||
|
|
|
@ -3,11 +3,11 @@ package org.moire.ultrasonic.domain
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
data class PodcastsChannel(
|
data class PodcastsChannel(
|
||||||
val id: String,
|
val id: String,
|
||||||
val title: String?,
|
val title: String?,
|
||||||
val url: String?,
|
val url: String?,
|
||||||
val description: String?,
|
val description: String?,
|
||||||
val status: String?
|
val status: String?
|
||||||
) : Serializable {
|
) : Serializable {
|
||||||
companion object {
|
companion object {
|
||||||
private const val serialVersionUID = -4160515427075433798L
|
private const val serialVersionUID = -4160515427075433798L
|
||||||
|
|
|
@ -4,8 +4,8 @@ package org.moire.ultrasonic.domain
|
||||||
* The criteria for a music search.
|
* The criteria for a music search.
|
||||||
*/
|
*/
|
||||||
data class SearchCriteria(
|
data class SearchCriteria(
|
||||||
val query: String,
|
val query: String,
|
||||||
val artistCount: Int,
|
val artistCount: Int,
|
||||||
val albumCount: Int,
|
val albumCount: Int,
|
||||||
val songCount: Int
|
val songCount: Int
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.moire.ultrasonic.domain.MusicDirectory.Entry
|
||||||
* The result of a search. Contains matching artists, albums and songs.
|
* The result of a search. Contains matching artists, albums and songs.
|
||||||
*/
|
*/
|
||||||
data class SearchResult(
|
data class SearchResult(
|
||||||
val artists: List<Artist>,
|
val artists: List<Artist>,
|
||||||
val albums: List<Entry>,
|
val albums: List<Entry>,
|
||||||
val songs: List<Entry>
|
val songs: List<Entry>
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,15 +4,15 @@ import org.moire.ultrasonic.domain.MusicDirectory.Entry
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
data class Share(
|
data class Share(
|
||||||
var id: String? = null,
|
var id: String? = null,
|
||||||
var url: String? = null,
|
var url: String? = null,
|
||||||
var description: String? = null,
|
var description: String? = null,
|
||||||
var username: String? = null,
|
var username: String? = null,
|
||||||
var created: String? = null,
|
var created: String? = null,
|
||||||
var lastVisited: String? = null,
|
var lastVisited: String? = null,
|
||||||
var expires: String? = null,
|
var expires: String? = null,
|
||||||
var visitCount: Long? = null,
|
var visitCount: Long? = null,
|
||||||
private val entries: MutableList<Entry> = mutableListOf()
|
private val entries: MutableList<Entry> = mutableListOf()
|
||||||
) : Serializable {
|
) : Serializable {
|
||||||
val name: String?
|
val name: String?
|
||||||
get() = url?.let { urlPattern.matcher(url).replaceFirst("$1") }
|
get() = url?.let { urlPattern.matcher(url).replaceFirst("$1") }
|
||||||
|
|
|
@ -6,7 +6,7 @@ import net.swiftzer.semver.SemVer
|
||||||
* Represents the version number of the Subsonic Android app.
|
* Represents the version number of the Subsonic Android app.
|
||||||
*/
|
*/
|
||||||
data class Version(
|
data class Version(
|
||||||
val version: SemVer
|
val version: SemVer
|
||||||
) : Comparable<Version> {
|
) : Comparable<Version> {
|
||||||
|
|
||||||
override fun compareTo(other: Version): Int {
|
override fun compareTo(other: Version): Int {
|
||||||
|
|
|
@ -57,8 +57,10 @@ 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()
|
||||||
|
@ -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(
|
||||||
expectedParam: String,
|
responseResourceName: String = "ping_ok.json",
|
||||||
apiRequest: () -> Response<out Any>) {
|
expectedParam: String,
|
||||||
|
apiRequest: () -> Response<out Any>
|
||||||
|
) {
|
||||||
this.enqueueResponse(responseResourceName)
|
this.enqueueResponse(responseResourceName)
|
||||||
apiRequest()
|
apiRequest()
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,11 @@ class SubsonicApiSSLTest {
|
||||||
mockWebServer.shutdown()
|
mockWebServer.shutdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createSSLContext(certificatePemStream: InputStream,
|
private fun createSSLContext(
|
||||||
certificatePkcs12Stream: InputStream,
|
certificatePemStream: InputStream,
|
||||||
password: String): SSLContext {
|
certificatePkcs12Stream: InputStream,
|
||||||
|
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)
|
||||||
|
|
|
@ -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")
|
||||||
|
|
|
@ -43,8 +43,9 @@ import retrofit2.Call
|
||||||
* for this call.
|
* for this 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(
|
||||||
artistCount: Int?,
|
query: String,
|
||||||
artistOffset: Int?,
|
artistCount: Int?,
|
||||||
albumCount: Int?,
|
artistOffset: Int?,
|
||||||
albumOffset: Int?,
|
albumCount: Int?,
|
||||||
songCount: Int?,
|
albumOffset: Int?,
|
||||||
musicFolderId: String?): Call<SearchTwoResponse> {
|
songCount: Int?,
|
||||||
|
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(
|
||||||
artistCount: Int?,
|
query: String,
|
||||||
artistOffset: Int?,
|
artistCount: Int?,
|
||||||
albumCount: Int?,
|
artistOffset: Int?,
|
||||||
albumOffset: Int?,
|
albumCount: Int?,
|
||||||
songCount: Int?,
|
albumOffset: Int?,
|
||||||
musicFolderId: String?): Call<SearchThreeResponse> {
|
songCount: Int?,
|
||||||
|
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(
|
||||||
name: String?,
|
id: String?,
|
||||||
songIds: List<String>?): Call<SubsonicResponse> {
|
name: String?,
|
||||||
|
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(
|
||||||
name: String?,
|
id: String,
|
||||||
comment: String?,
|
name: String?,
|
||||||
public: Boolean?,
|
comment: String?,
|
||||||
songIdsToAdd: List<String>?,
|
public: Boolean?,
|
||||||
songIndexesToRemove: List<Int>?): Call<SubsonicResponse> {
|
songIdsToAdd: List<String>?,
|
||||||
|
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(
|
||||||
size: Int?,
|
type: AlbumListType,
|
||||||
offset: Int?,
|
size: Int?,
|
||||||
fromYear: Int?,
|
offset: Int?,
|
||||||
toYear: Int?,
|
fromYear: Int?,
|
||||||
genre: String?,
|
toYear: Int?,
|
||||||
musicFolderId: String?): Call<GetAlbumListResponse> {
|
genre: String?,
|
||||||
|
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(
|
||||||
size: Int?,
|
type: AlbumListType,
|
||||||
offset: Int?,
|
size: Int?,
|
||||||
fromYear: Int?,
|
offset: Int?,
|
||||||
toYear: Int?,
|
fromYear: Int?,
|
||||||
genre: String?,
|
toYear: Int?,
|
||||||
musicFolderId: String?): Call<GetAlbumList2Response> {
|
genre: String?,
|
||||||
|
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(
|
||||||
genre: String?,
|
size: Int?,
|
||||||
fromYear: Int?,
|
genre: String?,
|
||||||
toYear: Int?,
|
fromYear: Int?,
|
||||||
musicFolderId: String?): Call<GetRandomSongsResponse> {
|
toYear: Int?,
|
||||||
|
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(
|
||||||
maxBitRate: Int?,
|
id: String,
|
||||||
format: String?,
|
maxBitRate: Int?,
|
||||||
timeOffset: Int?,
|
format: String?,
|
||||||
videoSize: String?,
|
timeOffset: Int?,
|
||||||
estimateContentLength: Boolean?,
|
videoSize: String?,
|
||||||
converted: Boolean?,
|
estimateContentLength: Boolean?,
|
||||||
offset: Long?): Call<ResponseBody> {
|
converted: Boolean?,
|
||||||
|
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(
|
||||||
index: Int?,
|
action: JukeboxAction,
|
||||||
offset: Int?,
|
index: Int?,
|
||||||
ids: List<String>?,
|
offset: Int?,
|
||||||
gain: Float?): Call<JukeboxResponse> {
|
ids: List<String>?,
|
||||||
|
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(
|
||||||
description: String?,
|
idsToShare: List<String>,
|
||||||
expires: Long?): Call<SharesResponse> {
|
description: String?,
|
||||||
|
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(
|
||||||
description: String?,
|
id: String,
|
||||||
expires: Long?): Call<SubsonicResponse> {
|
description: String?,
|
||||||
|
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(
|
||||||
count: Int,
|
genre: String,
|
||||||
offset: Int,
|
count: Int,
|
||||||
musicFolderId: String?): Call<GetSongsByGenreResponse> {
|
offset: Int,
|
||||||
|
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(
|
||||||
position: Long,
|
id: String,
|
||||||
comment: String?): Call<SubsonicResponse> {
|
position: Long,
|
||||||
|
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(
|
||||||
username: String,
|
baseUrl: String,
|
||||||
password: String,
|
username: String,
|
||||||
minimalProtocolVersion: SubsonicAPIVersions,
|
password: String,
|
||||||
clientID: String,
|
minimalProtocolVersion: SubsonicAPIVersions,
|
||||||
allowSelfSignedCertificate: Boolean = false,
|
clientID: String,
|
||||||
enableLdapUserSupport: Boolean = false,
|
allowSelfSignedCertificate: Boolean = false,
|
||||||
debug: Boolean = false) {
|
enableLdapUserSupport: Boolean = false,
|
||||||
|
debug: Boolean = false
|
||||||
|
) {
|
||||||
private val versionInterceptor = VersionInterceptor(minimalProtocolVersion) {
|
private val versionInterceptor = VersionInterceptor(minimalProtocolVersion) {
|
||||||
protocolVersion = it
|
protocolVersion = it
|
||||||
}
|
}
|
||||||
|
|
|
@ -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("albumId") albumId: String? = null,
|
@Query("id") id: String? = null,
|
||||||
@Query("artistId") artistId: String? = null): Call<SubsonicResponse>
|
@Query("albumId") albumId: String? = null,
|
||||||
|
@Query("artistId") artistId: String? = null
|
||||||
|
): Call<SubsonicResponse>
|
||||||
|
|
||||||
@GET("unstar.view")
|
@GET("unstar.view")
|
||||||
fun unstar(@Query("id") id: String? = null,
|
fun unstar(
|
||||||
@Query("albumId") albumId: String? = null,
|
@Query("id") id: String? = null,
|
||||||
@Query("artistId") artistId: String? = null): Call<SubsonicResponse>
|
@Query("albumId") albumId: String? = null,
|
||||||
|
@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("album") album: String? = null,
|
@Query("artist") artist: String? = null,
|
||||||
@Query("title") title: String? = null,
|
@Query("album") album: String? = null,
|
||||||
@Query("any") any: String? = null,
|
@Query("title") title: String? = null,
|
||||||
@Query("count") count: Int? = null,
|
@Query("any") any: String? = null,
|
||||||
@Query("offset") offset: Int? = null,
|
@Query("count") count: Int? = null,
|
||||||
@Query("newerThan") newerThan: Long? = null): Call<SearchResponse>
|
@Query("offset") offset: Int? = null,
|
||||||
|
@Query("newerThan") newerThan: Long? = null
|
||||||
|
): Call<SearchResponse>
|
||||||
|
|
||||||
@GET("search2.view")
|
@GET("search2.view")
|
||||||
fun search2(@Query("query") query: String,
|
fun search2(
|
||||||
@Query("artistCount") artistCount: Int? = null,
|
@Query("query") query: String,
|
||||||
@Query("artistOffset") artistOffset: Int? = null,
|
@Query("artistCount") artistCount: Int? = null,
|
||||||
@Query("albumCount") albumCount: Int? = null,
|
@Query("artistOffset") artistOffset: Int? = null,
|
||||||
@Query("albumOffset") albumOffset: Int? = null,
|
@Query("albumCount") albumCount: Int? = null,
|
||||||
@Query("songCount") songCount: Int? = null,
|
@Query("albumOffset") albumOffset: Int? = null,
|
||||||
@Query("musicFolderId") musicFolderId: String? = null): Call<SearchTwoResponse>
|
@Query("songCount") songCount: Int? = null,
|
||||||
|
@Query("musicFolderId") musicFolderId: String? = null
|
||||||
|
): Call<SearchTwoResponse>
|
||||||
|
|
||||||
@GET("search3.view")
|
@GET("search3.view")
|
||||||
fun search3(@Query("query") query: String,
|
fun search3(
|
||||||
@Query("artistCount") artistCount: Int? = null,
|
@Query("query") query: String,
|
||||||
@Query("artistOffset") artistOffset: Int? = null,
|
@Query("artistCount") artistCount: Int? = null,
|
||||||
@Query("albumCount") albumCount: Int? = null,
|
@Query("artistOffset") artistOffset: Int? = null,
|
||||||
@Query("albumOffset") albumOffset: Int? = null,
|
@Query("albumCount") albumCount: Int? = null,
|
||||||
@Query("songCount") songCount: Int? = null,
|
@Query("albumOffset") albumOffset: Int? = null,
|
||||||
@Query("musicFolderId") musicFolderId: String? = null): Call<SearchThreeResponse>
|
@Query("songCount") songCount: Int? = null,
|
||||||
|
@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,119 +125,143 @@ 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("name") name: String? = null,
|
@Query("playlistId") id: String? = null,
|
||||||
@Query("songId") songIds: List<String>? = null): Call<SubsonicResponse>
|
@Query("name") name: String? = null,
|
||||||
|
@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>
|
||||||
|
|
||||||
@GET("updatePlaylist.view")
|
@GET("updatePlaylist.view")
|
||||||
fun updatePlaylist(
|
fun updatePlaylist(
|
||||||
@Query("playlistId") id: String,
|
@Query("playlistId") id: String,
|
||||||
@Query("name") name: String? = null,
|
@Query("name") name: String? = null,
|
||||||
@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("time") time: Long? = null,
|
@Query("id") id: String,
|
||||||
@Query("submission") submission: Boolean? = null): Call<SubsonicResponse>
|
@Query("time") time: Long? = null,
|
||||||
|
@Query("submission") submission: Boolean? = null
|
||||||
|
): Call<SubsonicResponse>
|
||||||
|
|
||||||
@GET("getAlbumList.view")
|
@GET("getAlbumList.view")
|
||||||
fun getAlbumList(
|
fun getAlbumList(
|
||||||
@Query("type") type: AlbumListType,
|
@Query("type") type: AlbumListType,
|
||||||
@Query("size") size: Int? = null,
|
@Query("size") size: Int? = null,
|
||||||
@Query("offset") offset: Int? = null,
|
@Query("offset") offset: Int? = null,
|
||||||
@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(
|
||||||
@Query("type") type: AlbumListType,
|
@Query("type") type: AlbumListType,
|
||||||
@Query("size") size: Int? = null,
|
@Query("size") size: Int? = null,
|
||||||
@Query("offset") offset: Int? = null,
|
@Query("offset") offset: Int? = null,
|
||||||
@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(
|
||||||
@Query("size") size: Int? = null,
|
@Query("size") size: Int? = null,
|
||||||
@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("maxBitRate") maxBitRate: Int? = null,
|
@Query("id") id: String,
|
||||||
@Query("format") format: String? = null,
|
@Query("maxBitRate") maxBitRate: Int? = null,
|
||||||
@Query("timeOffset") timeOffset: Int? = null,
|
@Query("format") format: String? = null,
|
||||||
@Query("size") videoSize: String? = null,
|
@Query("timeOffset") timeOffset: Int? = null,
|
||||||
@Query("estimateContentLength") estimateContentLength: Boolean? = null,
|
@Query("size") videoSize: String? = null,
|
||||||
@Query("converted") converted: Boolean? = null,
|
@Query("estimateContentLength") estimateContentLength: Boolean? = null,
|
||||||
@Header("Range") offset: Long? = null): Call<ResponseBody>
|
@Query("converted") converted: Boolean? = null,
|
||||||
|
@Header("Range") offset: Long? = null
|
||||||
|
): Call<ResponseBody>
|
||||||
|
|
||||||
@GET("jukeboxControl.view")
|
@GET("jukeboxControl.view")
|
||||||
fun jukeboxControl(@Query("action") action: JukeboxAction,
|
fun jukeboxControl(
|
||||||
@Query("index") index: Int? = null,
|
@Query("action") action: JukeboxAction,
|
||||||
@Query("offset") offset: Int? = null,
|
@Query("index") index: Int? = null,
|
||||||
@Query("id") ids: List<String>? = null,
|
@Query("offset") offset: Int? = null,
|
||||||
@Query("gain") gain: Float? = null): Call<JukeboxResponse>
|
@Query("id") ids: List<String>? = null,
|
||||||
|
@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("description") description: String? = null,
|
@Query("id") idsToShare: List<String>,
|
||||||
@Query("expires") expires: Long? = null): Call<SharesResponse>
|
@Query("description") description: String? = null,
|
||||||
|
@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("description") description: String? = null,
|
@Query("id") id: String,
|
||||||
@Query("expires") expires: Long? = null): Call<SubsonicResponse>
|
@Query("description") description: String? = null,
|
||||||
|
@Query("expires") expires: Long? = null
|
||||||
|
): Call<SubsonicResponse>
|
||||||
|
|
||||||
@GET("getGenres.view")
|
@GET("getGenres.view")
|
||||||
fun getGenres(): Call<GenresResponse>
|
fun getGenres(): Call<GenresResponse>
|
||||||
|
|
||||||
@GET("getSongsByGenre.view")
|
@GET("getSongsByGenre.view")
|
||||||
fun getSongsByGenre(
|
fun getSongsByGenre(
|
||||||
@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>
|
||||||
|
@ -241,9 +277,10 @@ interface SubsonicAPIDefinition {
|
||||||
|
|
||||||
@GET("createBookmark.view")
|
@GET("createBookmark.view")
|
||||||
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!")
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,10 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
* ldap users.
|
* ldap users.
|
||||||
*/
|
*/
|
||||||
internal class ProxyPasswordInterceptor(
|
internal class ProxyPasswordInterceptor(
|
||||||
initialAPIVersions: SubsonicAPIVersions,
|
initialAPIVersions: SubsonicAPIVersions,
|
||||||
private val hexInterceptor: PasswordHexInterceptor,
|
private val hexInterceptor: PasswordHexInterceptor,
|
||||||
private val mD5Interceptor: PasswordMD5Interceptor,
|
private val mD5Interceptor: PasswordMD5Interceptor,
|
||||||
private val forceHexPassword: Boolean = false
|
private val forceHexPassword: Boolean = false
|
||||||
) : Interceptor {
|
) : Interceptor {
|
||||||
var apiVersion: SubsonicAPIVersions = initialAPIVersions
|
var apiVersion: SubsonicAPIVersions = initialAPIVersions
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,9 @@ private const val DEFAULT_PEEK_BYTE_COUNT = 1000L
|
||||||
* @author Yahor Berdnikau
|
* @author Yahor Berdnikau
|
||||||
*/
|
*/
|
||||||
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 {
|
||||||
|
|
|
@ -4,14 +4,15 @@ import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
|
||||||
data class Album(
|
data class Album(
|
||||||
val id: String = "",
|
val id: String = "",
|
||||||
val name: String = "",
|
val name: String = "",
|
||||||
val coverArt: String = "",
|
val coverArt: String = "",
|
||||||
val artist: String = "",
|
val artist: String = "",
|
||||||
val artistId: String = "",
|
val artistId: String = "",
|
||||||
val songCount: Int = 0,
|
val songCount: Int = 0,
|
||||||
val duration: Int = 0,
|
val duration: Int = 0,
|
||||||
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 name: String = "",
|
val id: String = "",
|
||||||
val coverArt: String = "",
|
val name: String = "",
|
||||||
val albumCount: Int = 0,
|
val coverArt: String = "",
|
||||||
val starred: Calendar? = null,
|
val albumCount: Int = 0,
|
||||||
@JsonProperty("album")
|
val starred: Calendar? = null,
|
||||||
val albumsList: List<Album> = emptyList())
|
@JsonProperty("album")
|
||||||
|
val albumsList: List<Album> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -3,9 +3,10 @@ package org.moire.ultrasonic.api.subsonic.models
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
|
||||||
data class Bookmark(
|
data class Bookmark(
|
||||||
val position: Long = 0,
|
val position: Long = 0,
|
||||||
val username: String = "",
|
val username: String = "",
|
||||||
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()
|
||||||
|
)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.moire.ultrasonic.api.subsonic.models
|
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 albumCount: Int = 0,
|
val songCount: Int = 0,
|
||||||
@JsonProperty("value") val name: String)
|
val albumCount: Int = 0,
|
||||||
|
@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(
|
||||||
@JsonProperty("artist")
|
val name: String = "",
|
||||||
val artists: List<Artist> = emptyList())
|
@JsonProperty("artist")
|
||||||
|
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 ignoredArticles: String = "",
|
val lastModified: Long = 0,
|
||||||
@JsonProperty("index")
|
val ignoredArticles: String = "",
|
||||||
val indexList: List<Index> = emptyList(),
|
@JsonProperty("index")
|
||||||
@JsonProperty("shortcut")
|
val indexList: List<Index> = emptyList(),
|
||||||
val shortcutList: List<Artist> = emptyList())
|
@JsonProperty("shortcut")
|
||||||
|
val shortcutList: List<Artist> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -3,8 +3,9 @@ package org.moire.ultrasonic.api.subsonic.models
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
data class JukeboxStatus(
|
data class JukeboxStatus(
|
||||||
val currentIndex: Int = -1,
|
val currentIndex: Int = -1,
|
||||||
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()
|
||||||
|
)
|
||||||
|
|
|
@ -3,7 +3,8 @@ package org.moire.ultrasonic.api.subsonic.models
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
|
||||||
data class License(
|
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()
|
||||||
|
)
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.moire.ultrasonic.api.subsonic.models
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
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,12 +3,14 @@ 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 parent: String = "",
|
val id: String = "",
|
||||||
val name: String = "",
|
val parent: String = "",
|
||||||
val userRating: Int = 0,
|
val name: String = "",
|
||||||
val averageRating: Float = 0.0f,
|
val userRating: Int = 0,
|
||||||
val starred: Calendar? = null,
|
val averageRating: Float = 0.0f,
|
||||||
val playCount: Int = 0,
|
val starred: Calendar? = null,
|
||||||
@JsonProperty("child")
|
val playCount: Int = 0,
|
||||||
val childList: List<MusicDirectoryChild> = emptyList())
|
@JsonProperty("child")
|
||||||
|
val childList: List<MusicDirectoryChild> = emptyList()
|
||||||
|
)
|
||||||
|
|
|
@ -2,36 +2,38 @@ 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 parent: String = "",
|
val id: String = "",
|
||||||
val isDir: Boolean = false,
|
val parent: String = "",
|
||||||
val title: String = "",
|
val isDir: Boolean = false,
|
||||||
val album: String = "",
|
val title: String = "",
|
||||||
val artist: String = "",
|
val album: String = "",
|
||||||
val track: Int = -1,
|
val artist: String = "",
|
||||||
val year: Int? = null,
|
val track: Int = -1,
|
||||||
val genre: String = "",
|
val year: Int? = null,
|
||||||
val coverArt: String = "",
|
val genre: String = "",
|
||||||
val size: Long = -1,
|
val coverArt: String = "",
|
||||||
val contentType: String = "",
|
val size: Long = -1,
|
||||||
val suffix: String = "",
|
val contentType: String = "",
|
||||||
val transcodedContentType: String = "",
|
val suffix: String = "",
|
||||||
val transcodedSuffix: String = "",
|
val transcodedContentType: String = "",
|
||||||
val duration: Int = -1,
|
val transcodedSuffix: String = "",
|
||||||
val bitRate: Int = -1,
|
val duration: Int = -1,
|
||||||
val path: String = "",
|
val bitRate: Int = -1,
|
||||||
val isVideo: Boolean = false,
|
val path: String = "",
|
||||||
val playCount: Int = 0,
|
val isVideo: Boolean = false,
|
||||||
val discNumber: Int = -1,
|
val playCount: Int = 0,
|
||||||
val created: Calendar? = null,
|
val discNumber: Int = -1,
|
||||||
val albumId: String = "",
|
val created: Calendar? = null,
|
||||||
val artistId: String = "",
|
val albumId: String = "",
|
||||||
val type: String = "",
|
val artistId: String = "",
|
||||||
val starred: Calendar? = null,
|
val type: String = "",
|
||||||
val streamId: String = "",
|
val starred: Calendar? = null,
|
||||||
val channelId: String = "",
|
val streamId: String = "",
|
||||||
val description: String = "",
|
val channelId: String = "",
|
||||||
val status: String = "",
|
val description: String = "",
|
||||||
val publishDate: Calendar? = null,
|
val status: String = "",
|
||||||
val userRating: Int? = null,
|
val publishDate: Calendar? = null,
|
||||||
val averageRating: Float? = null)
|
val userRating: Int? = null,
|
||||||
|
val averageRating: Float? = null
|
||||||
|
)
|
||||||
|
|
|
@ -4,15 +4,15 @@ import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
|
||||||
data class Playlist(
|
data class Playlist(
|
||||||
val id: String = "",
|
val id: String = "",
|
||||||
val name: String = "",
|
val name: String = "",
|
||||||
val owner: String = "",
|
val owner: String = "",
|
||||||
val comment: String = "",
|
val comment: String = "",
|
||||||
val public: Boolean = false,
|
val public: Boolean = false,
|
||||||
val songCount: Int = 0,
|
val songCount: Int = 0,
|
||||||
val duration: Long = 0,
|
val duration: Long = 0,
|
||||||
val created: Calendar? = null,
|
val created: Calendar? = null,
|
||||||
val changed: Calendar? = null,
|
val changed: Calendar? = null,
|
||||||
val coverArt: String = "",
|
val coverArt: String = "",
|
||||||
@JsonProperty("entry") val entriesList: List<MusicDirectoryChild> = emptyList()
|
@JsonProperty("entry") val entriesList: List<MusicDirectoryChild> = emptyList()
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,12 +3,13 @@ package org.moire.ultrasonic.api.subsonic.models
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
data class PodcastChannel(
|
data class PodcastChannel(
|
||||||
val id: String = "",
|
val id: String = "",
|
||||||
val url: String = "",
|
val url: String = "",
|
||||||
val title: String = "",
|
val title: String = "",
|
||||||
val description: String = "",
|
val description: String = "",
|
||||||
val coverArt: String = "",
|
val coverArt: String = "",
|
||||||
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()
|
||||||
|
)
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.moire.ultrasonic.api.subsonic.models
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
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()
|
||||||
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@ package org.moire.ultrasonic.api.subsonic.models
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
data class SearchThreeResult(
|
data class SearchThreeResult(
|
||||||
@JsonProperty("artist") val artistList: List<Artist> = emptyList(),
|
@JsonProperty("artist") val artistList: List<Artist> = emptyList(),
|
||||||
@JsonProperty("album") val albumList: List<Album> = emptyList(),
|
@JsonProperty("album") val albumList: List<Album> = emptyList(),
|
||||||
@JsonProperty("song") val songList: List<MusicDirectoryChild> = emptyList()
|
@JsonProperty("song") val songList: List<MusicDirectoryChild> = emptyList()
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@ package org.moire.ultrasonic.api.subsonic.models
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
data class SearchTwoResult(
|
data class SearchTwoResult(
|
||||||
@JsonProperty("artist") val artistList: List<Artist> = emptyList(),
|
@JsonProperty("artist") val artistList: List<Artist> = emptyList(),
|
||||||
@JsonProperty("album") val albumList: List<MusicDirectoryChild> = emptyList(),
|
@JsonProperty("album") val albumList: List<MusicDirectoryChild> = emptyList(),
|
||||||
@JsonProperty("song") val songList: List<MusicDirectoryChild> = emptyList()
|
@JsonProperty("song") val songList: List<MusicDirectoryChild> = emptyList()
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,12 +4,13 @@ import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
|
||||||
data class Share(
|
data class Share(
|
||||||
val id: String = "",
|
val id: String = "",
|
||||||
val url: String = "",
|
val url: String = "",
|
||||||
val username: String = "",
|
val username: String = "",
|
||||||
val created: Calendar? = null,
|
val created: Calendar? = null,
|
||||||
val expires: Calendar? = null,
|
val expires: Calendar? = null,
|
||||||
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()
|
||||||
|
)
|
||||||
|
|
|
@ -3,19 +3,20 @@ package org.moire.ultrasonic.api.subsonic.models
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
data class User(
|
data class User(
|
||||||
val username: String = "",
|
val username: String = "",
|
||||||
val email: String = "",
|
val email: String = "",
|
||||||
val scrobblingEnabled: Boolean = false,
|
val scrobblingEnabled: Boolean = false,
|
||||||
val adminRole: Boolean = false,
|
val adminRole: Boolean = false,
|
||||||
val settingsRole: Boolean = false,
|
val settingsRole: Boolean = false,
|
||||||
val downloadRole: Boolean = false,
|
val downloadRole: Boolean = false,
|
||||||
val uploadRole: Boolean = false,
|
val uploadRole: Boolean = false,
|
||||||
val playlistRole: Boolean = false,
|
val playlistRole: Boolean = false,
|
||||||
val coverArtRole: Boolean = false,
|
val coverArtRole: Boolean = false,
|
||||||
val commentRole: Boolean = false,
|
val commentRole: Boolean = false,
|
||||||
val podcastRole: Boolean = false,
|
val podcastRole: Boolean = false,
|
||||||
val streamRole: Boolean = false,
|
val streamRole: Boolean = false,
|
||||||
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()
|
||||||
|
)
|
||||||
|
|
|
@ -6,13 +6,15 @@ import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.Bookmark
|
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()
|
||||||
|
)
|
||||||
|
|
|
@ -6,13 +6,15 @@ import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.ChatMessage
|
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(
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?) : SubsonicResponse(status, version, error) {
|
version: SubsonicAPIVersions,
|
||||||
|
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(
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?)
|
version: SubsonicAPIVersions,
|
||||||
: SubsonicResponse(status, version, error) {
|
error: SubsonicError?
|
||||||
|
) : 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(
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?)
|
version: SubsonicAPIVersions,
|
||||||
: SubsonicResponse(status, version, error) {
|
error: SubsonicError?
|
||||||
|
) : 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(
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?,
|
version: SubsonicAPIVersions,
|
||||||
val album: Album = Album()) : SubsonicResponse(status, version, error)
|
error: SubsonicError?,
|
||||||
|
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(
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?,
|
version: SubsonicAPIVersions,
|
||||||
val artist: Artist = Artist())
|
error: SubsonicError?,
|
||||||
: SubsonicResponse(status, version, error)
|
val artist: Artist = Artist()
|
||||||
|
) : 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(
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?,
|
version: SubsonicAPIVersions,
|
||||||
@JsonProperty("artists") val indexes: Indexes = Indexes()) :
|
error: SubsonicError?,
|
||||||
SubsonicResponse(status, version, error)
|
@JsonProperty("artists") val indexes: Indexes = Indexes()
|
||||||
|
) : 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(
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?,
|
version: SubsonicAPIVersions,
|
||||||
val indexes: Indexes = Indexes()) :
|
error: SubsonicError?,
|
||||||
SubsonicResponse(status, version, error)
|
val indexes: Indexes = Indexes()
|
||||||
|
) : 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(
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?,
|
version: SubsonicAPIVersions,
|
||||||
val lyrics: Lyrics = Lyrics())
|
error: SubsonicError?,
|
||||||
: SubsonicResponse(status, version, error)
|
val lyrics: Lyrics = Lyrics()
|
||||||
|
) : 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(
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?,
|
version: SubsonicAPIVersions,
|
||||||
@JsonProperty("directory")
|
error: SubsonicError?,
|
||||||
val musicDirectory: MusicDirectory = MusicDirectory()) :
|
@JsonProperty("directory")
|
||||||
SubsonicResponse(status, version, error)
|
val musicDirectory: MusicDirectory = MusicDirectory()
|
||||||
|
) : SubsonicResponse(status, version, error)
|
||||||
|
|
|
@ -5,7 +5,8 @@ import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.Playlist
|
import org.moire.ultrasonic.api.subsonic.models.Playlist
|
||||||
|
|
||||||
class GetPlaylistResponse(
|
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(
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?)
|
version: SubsonicAPIVersions,
|
||||||
: SubsonicResponse(status, version, error) {
|
error: SubsonicError?
|
||||||
|
) : 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()
|
||||||
|
)
|
||||||
|
|
|
@ -6,9 +6,10 @@ import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.PodcastChannel
|
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(
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?)
|
version: SubsonicAPIVersions,
|
||||||
: SubsonicResponse(status, version, error) {
|
error: SubsonicError?
|
||||||
|
) : 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()
|
||||||
|
)
|
||||||
|
|
|
@ -6,13 +6,15 @@ import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
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(
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?,
|
version: SubsonicAPIVersions,
|
||||||
val starred: SearchTwoResult = SearchTwoResult())
|
error: SubsonicError?,
|
||||||
: SubsonicResponse(status, version, error)
|
val starred: SearchTwoResult = SearchTwoResult()
|
||||||
|
) : 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(
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?,
|
version: SubsonicAPIVersions,
|
||||||
val starred2: SearchTwoResult = SearchTwoResult())
|
error: SubsonicError?,
|
||||||
: SubsonicResponse(status, version, error)
|
val starred2: SearchTwoResult = SearchTwoResult()
|
||||||
|
) : SubsonicResponse(status, version, error)
|
||||||
|
|
|
@ -5,7 +5,8 @@ import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.User
|
import org.moire.ultrasonic.api.subsonic.models.User
|
||||||
|
|
||||||
class GetUserResponse(
|
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(
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?,
|
version: SubsonicAPIVersions,
|
||||||
var jukebox: JukeboxStatus = JukeboxStatus())
|
error: SubsonicError?,
|
||||||
: SubsonicResponse(status, version, error) {
|
var jukebox: JukeboxStatus = JukeboxStatus()
|
||||||
|
) : 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(
|
||||||
status: Status,
|
val license: License = License(),
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?) :
|
version: SubsonicAPIVersions,
|
||||||
SubsonicResponse(status, version, error)
|
error: SubsonicError?
|
||||||
|
) : 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(
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?) :
|
version: SubsonicAPIVersions,
|
||||||
SubsonicResponse(status, version, error) {
|
error: SubsonicError?
|
||||||
|
) : 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(
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?,
|
version: SubsonicAPIVersions,
|
||||||
val searchResult: SearchResult = SearchResult())
|
error: SubsonicError?,
|
||||||
: SubsonicResponse(status, version, error)
|
val searchResult: SearchResult = SearchResult()
|
||||||
|
) : SubsonicResponse(status, version, error)
|
||||||
|
|
|
@ -6,8 +6,8 @@ import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.SearchThreeResult
|
import org.moire.ultrasonic.api.subsonic.models.SearchThreeResult
|
||||||
|
|
||||||
class SearchThreeResponse(
|
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)
|
||||||
|
|
|
@ -6,8 +6,8 @@ import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.SearchTwoResult
|
import org.moire.ultrasonic.api.subsonic.models.SearchTwoResult
|
||||||
|
|
||||||
class SearchTwoResponse(
|
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(
|
||||||
version: SubsonicAPIVersions,
|
status: Status,
|
||||||
error: SubsonicError?)
|
version: SubsonicAPIVersions,
|
||||||
: SubsonicResponse(status, version, error) {
|
error: SubsonicError?
|
||||||
|
) : 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 apiError: SubsonicError? = null,
|
val stream: InputStream? = null,
|
||||||
val responseHttpCode: Int) {
|
val apiError: SubsonicError? = null,
|
||||||
|
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 version: SubsonicAPIVersions,
|
val status: Status,
|
||||||
val error: SubsonicError?) {
|
val version: SubsonicAPIVersions,
|
||||||
|
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");
|
||||||
|
|
|
@ -6,13 +6,15 @@ import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||||
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
|
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()
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue