Incorporates new models
This commit is contained in:
parent
b1e997430b
commit
88d07b0fa0
@ -1,16 +1,26 @@
|
||||
package net.halfbinary.prettyplayerapi.controller
|
||||
|
||||
import net.halfbinary.prettyplayerapi.model.AlbumInfo
|
||||
import net.halfbinary.prettyplayerapi.model.AlbumMetadata
|
||||
import net.halfbinary.prettyplayerapi.model.TrackInfo
|
||||
import net.halfbinary.prettyplayerapi.service.AlbumService
|
||||
import org.springframework.web.bind.annotation.CrossOrigin
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import org.springframework.web.bind.annotation.*
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping("album")
|
||||
class AlbumController(private val albumService: AlbumService) {
|
||||
@GetMapping("albums")
|
||||
fun listFolders(): List<AlbumInfo> {
|
||||
@GetMapping
|
||||
fun listFolders(): List<AlbumMetadata> {
|
||||
return albumService.getAlbumList()
|
||||
}
|
||||
|
||||
@GetMapping("/{albumHash}")
|
||||
fun getAlbumInfo(@PathVariable albumHash: String): AlbumInfo {
|
||||
return albumService.getAlbumInfo(albumHash)
|
||||
}
|
||||
|
||||
@GetMapping("/{albumHash}/track/{trackNumber}")
|
||||
fun getTrackInfo(@PathVariable albumHash: String, @PathVariable trackNumber: Int): TrackInfo {
|
||||
return albumService.getTrackInfo(albumHash, trackNumber)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
package net.halfbinary.prettyplayerapi.model
|
||||
|
||||
data class AlbumMetadata(val albumTitle: String, val albumFolder: String, val hash: String)
|
||||
@ -1,9 +1,9 @@
|
||||
package net.halfbinary.prettyplayerapi.repository
|
||||
|
||||
import net.halfbinary.prettyplayerapi.model.AlbumInfo
|
||||
import net.halfbinary.prettyplayerapi.model.AlbumMetadata
|
||||
import org.springframework.stereotype.Repository
|
||||
|
||||
@Repository
|
||||
class AlbumRepository {
|
||||
var albumCache: LinkedHashMap<String, AlbumInfo> = linkedMapOf()
|
||||
var albumCache: LinkedHashMap<String, AlbumMetadata> = linkedMapOf()
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user