Incorporates new models

This commit is contained in:
aarbit 2024-06-07 22:45:52 -05:00
parent b1e997430b
commit 88d07b0fa0
3 changed files with 21 additions and 8 deletions

View File

@ -1,16 +1,26 @@
package net.halfbinary.prettyplayerapi.controller package net.halfbinary.prettyplayerapi.controller
import net.halfbinary.prettyplayerapi.model.AlbumInfo 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 net.halfbinary.prettyplayerapi.service.AlbumService
import org.springframework.web.bind.annotation.CrossOrigin import org.springframework.web.bind.annotation.*
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController
@RestController @RestController
@CrossOrigin @RequestMapping("album")
class AlbumController(private val albumService: AlbumService) { class AlbumController(private val albumService: AlbumService) {
@GetMapping("albums") @GetMapping
fun listFolders(): List<AlbumInfo> { fun listFolders(): List<AlbumMetadata> {
return albumService.getAlbumList() 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)
}
} }

View File

@ -0,0 +1,3 @@
package net.halfbinary.prettyplayerapi.model
data class AlbumMetadata(val albumTitle: String, val albumFolder: String, val hash: String)

View File

@ -1,9 +1,9 @@
package net.halfbinary.prettyplayerapi.repository package net.halfbinary.prettyplayerapi.repository
import net.halfbinary.prettyplayerapi.model.AlbumInfo import net.halfbinary.prettyplayerapi.model.AlbumMetadata
import org.springframework.stereotype.Repository import org.springframework.stereotype.Repository
@Repository @Repository
class AlbumRepository { class AlbumRepository {
var albumCache: LinkedHashMap<String, AlbumInfo> = linkedMapOf() var albumCache: LinkedHashMap<String, AlbumMetadata> = linkedMapOf()
} }