Skip to content

Commit 0407a15

Browse files
committed
feat(subsonic): add stub lyrics.view
fixes #274
1 parent 2bf8595 commit 0407a15

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

server/ctrlsubsonic/handlers_common.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,3 +407,9 @@ func (c *Controller) ServeJukebox(r *http.Request) *spec.Response { // nolint:go
407407
sub.JukeboxStatus = status
408408
return sub
409409
}
410+
411+
func (c *Controller) ServeGetLyrics(r *http.Request) *spec.Response {
412+
sub := spec.NewResponse()
413+
sub.Lyrics = &spec.Lyrics{}
414+
return sub
415+
}

server/ctrlsubsonic/spec/spec.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ type Response struct {
5858
SimilarSongs *SimilarSongs `xml:"similarSongs" json:"similarSongs,omitempty"`
5959
SimilarSongsTwo *SimilarSongsTwo `xml:"similarSongs2" json:"similarSongs2,omitempty"`
6060
InternetRadioStations *InternetRadioStations `xml:"internetRadioStations" json:"internetRadioStations,omitempty"`
61+
Lyrics *Lyrics `xml:"lyrics" json:"lyrics,omitempty"`
6162
}
6263

6364
func NewResponse() *Response {
@@ -409,6 +410,12 @@ type InternetRadioStation struct {
409410
HomepageURL string `xml:"homepageUrl,attr" json:"homepageUrl"`
410411
}
411412

413+
type Lyrics struct {
414+
Value string `xml:",chardata" json:"value,omitempty"`
415+
Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`
416+
Title string `xml:"title,attr,omitempty" json:"title,omitempty"`
417+
}
418+
412419
func formatRating(rating float64) string {
413420
if rating == 0 {
414421
return ""

server/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ func setupSubsonic(r *mux.Router, ctrl *ctrlsubsonic.Controller) {
236236
r.Handle("/getTopSongs{_:(?:\\.view)?}", ctrl.H(ctrl.ServeGetTopSongs))
237237
r.Handle("/getSimilarSongs{_:(?:\\.view)?}", ctrl.H(ctrl.ServeGetSimilarSongs))
238238
r.Handle("/getSimilarSongs2{_:(?:\\.view)?}", ctrl.H(ctrl.ServeGetSimilarSongsTwo))
239+
r.Handle("/getLyrics{_:(?:\\.view)?}", ctrl.H(ctrl.ServeGetLyrics))
239240

240241
// raw
241242
r.Handle("/getCoverArt{_:(?:\\.view)?}", ctrl.HR(ctrl.ServeGetCoverArt))

0 commit comments

Comments
 (0)