GitBucket
4.23.0
Toggle navigation
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
yhornisse
/
bremer
Browse code
add local path to audio response
master
1 parent
585bcd7
commit
cf6416dbbe41dcc274c7a0d1e5eb4cb4f7c63766
yhornisse
authored
on 21 Aug 2023
Patch
Showing
1 changed file
src/main/kotlin/model/api/Response.kt
Ignore Space
Show notes
View
src/main/kotlin/model/api/Response.kt
/* * Copyright (c) 2023. yo-saito. All Rights Reserved. */ package net.piedpiper.bremer.model.api import com.fasterxml.jackson.annotation.JsonProperty import net.piedpiper.bremer.entity.AudioEntity import net.piedpiper.bremer.entity.PlaylistEntity import net.piedpiper.bremer.entity.TagEntity data class Audio( private val audioEntity: AudioEntity ) { val name: String = audioEntity.name val slug: String = audioEntity.slug val artist: String? = audioEntity?.album?.artist?.name val album: String? = audioEntity?.album?.name var sequence: Int? = if (audioEntity?.sequence == 0) { audioEntity?.sequence } else { null } @field:JsonProperty("local_path") var localPath = audioEntity.path var aliasNames: List<String>? = audioEntity?.aliasNames?.map { it.name } } data class Tag( private val tagEntity: TagEntity ) { val slug: String = tagEntity.slug val name: String = tagEntity.name } data class AllPlaylistResponse( private val entities: List<PlaylistEntity> ) { val playlist: List<Playlist> = entities.map { Playlist(it.name, it.sequence, it.slug) } data class Playlist( val name: String, var sequence: Int, val slug: String ) } data class AudioListResponse( private val entities: List<AudioEntity> = emptyList() ) { @field:JsonProperty("audio_list") val audioList: List<Audio> = entities.map { Audio(it) } } data class PlaylistAudioResponse( private val playlistEntity: PlaylistEntity, private val audioEntityList: List<AudioEntity>? = null ) { val name: String = playlistEntity.name val slug: String = playlistEntity.slug @field:JsonProperty("audio_list") val audioList: List<Audio>? = audioEntityList?.map { Audio(it) } ?: null } data class TagAudioResponse( private val tagEntity: TagEntity, private val audioEntityList: List<AudioEntity> ) { val name: String = tagEntity.name val slug: String = tagEntity.slug @field:JsonProperty("audio_list") val audioList: List<Audio> = audioEntityList.map { Audio(it) } } data class AllTagsResponse( private val tagEntities: List<TagEntity> ) { val tags: List<Tag> = tagEntities.map { Tag(it) } }
/* * Copyright (c) 2023. yo-saito. All Rights Reserved. */ package net.piedpiper.bremer.model.api import com.fasterxml.jackson.annotation.JsonProperty import net.piedpiper.bremer.entity.AudioEntity import net.piedpiper.bremer.entity.PlaylistEntity import net.piedpiper.bremer.entity.TagEntity data class Audio( private val audioEntity: AudioEntity ) { val name: String = audioEntity.name val slug: String = audioEntity.slug val artist: String? = audioEntity?.album?.artist?.name val album: String? = audioEntity?.album?.name var sequence: Int? = if (audioEntity?.sequence == 0) { audioEntity?.sequence } else { null } var aliasNames: List<String>? = audioEntity?.aliasNames?.map { it.name } } data class Tag( private val tagEntity: TagEntity ) { val slug: String = tagEntity.slug val name: String = tagEntity.name } data class AllPlaylistResponse( private val entities: List<PlaylistEntity> ) { val playlist: List<Playlist> = entities.map { Playlist(it.name, it.sequence, it.slug) } data class Playlist( val name: String, var sequence: Int, val slug: String ) } data class AudioListResponse( private val entities: List<AudioEntity> = emptyList() ) { @field:JsonProperty("audio_list") val audioList: List<Audio> = entities.map { Audio(it) } } data class PlaylistAudioResponse( private val playlistEntity: PlaylistEntity, private val audioEntityList: List<AudioEntity>? = null ) { val name: String = playlistEntity.name val slug: String = playlistEntity.slug @field:JsonProperty("audio_list") val audioList: List<Audio>? = audioEntityList?.map { Audio(it) } ?: null } data class TagAudioResponse( private val tagEntity: TagEntity, private val audioEntityList: List<AudioEntity> ) { val name: String = tagEntity.name val slug: String = tagEntity.slug @field:JsonProperty("audio_list") val audioList: List<Audio> = audioEntityList.map { Audio(it) } } data class AllTagsResponse( private val tagEntities: List<TagEntity> ) { val tags: List<Tag> = tagEntities.map { Tag(it) } }
Show line notes below